List of usage examples for com.liferay.portal.kernel.util ParamUtil getDate
public static Date getDate(ServiceContext serviceContext, String param, DateFormat dateFormat)
From source file:com.labimo.portlet.LicenseManage.java
@ProcessAction(name = "addLicense") public void addLicense(ActionRequest actionRequest, ActionResponse response) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat(liferay_pattern); User currentUser = PortalUtil.getUser(actionRequest); Utils utils = new Utils(); long userId = ParamUtil.getLong(actionRequest, "userId"); // String hardwareUuid = ParamUtil.getString(actionRequest, // "hardwareUuid"); Date issueDate = ParamUtil.getDate(actionRequest, "issueDate", sdf); Date validDate = ParamUtil.getDate(actionRequest, "validDate", sdf); // Integer issue_day = ParamUtil.getInteger(actionRequest, "issue_day"); // Integer issue_month = ParamUtil.getInteger(actionRequest, // "issue_month"); // Integer issue_year = ParamUtil.getInteger(actionRequest, // "issue_year"); // Calendar issueCalendar = Calendar.getInstance(); // issueCalendar.set(issue_year, issue_month, issue_day, 0, 0, 0); // issueDate =issueCalendar.getTime(); ///*from w w w . j a va2 s . c o m*/ // Integer valid_day = ParamUtil.getInteger(actionRequest, "valid_day"); // Integer valid_month = ParamUtil.getInteger(actionRequest, // "valid_month"); // Integer valid_year = ParamUtil.getInteger(actionRequest, // "valid_year"); // Calendar validCalendar = Calendar.getInstance(); // validCalendar.set(valid_year, valid_month, valid_day, 0, 0, 0); // validDate = validCalendar.getTime(); long currentTime = new Date().getTime(); System.out.println("userId = " + userId); // System.out.println("hardwareUuid = " + hardwareUuid); System.out.println("issueDate = " + issueDate); System.out.println("validDate = " + validDate); User user = UserLocalServiceUtil.fetchUser(userId); if (Validator.isNotNull(user) && validDate.after(issueDate) && validDate.getTime() > currentTime) { License ChargesLincense = new LicenseImpl(); String licenseId = LicenseUtils.getCustomUuid(UUID.randomUUID()); ChargesLincense.setLicenseUuid(licenseId); ChargesLincense.setIssueDate(issueDate); ChargesLincense.setValidDate(validDate); ChargesLincense.setUserId(userId); ChargesLincense.setValid(true); ChargesLincense.setCreateDate(new Date()); ChargesLincense.setModifiedDate(new Date()); LicenseLocalServiceUtil.addLicense(ChargesLincense); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long gourpId = themeDisplay.getScopeGroupId(); JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject(); extraDataJSONObject.put("title", currentUser.getScreenName() + LicenseConstants.ADD_LICENSE_MSG + ChargesLincense.getLicenseUuid()); SocialActivityLocalServiceUtil.addActivity(currentUser.getUserId(), gourpId, LicenseConstants.LICENSE_CLASS_NAME, LicenseConstants.LICENSE_CLASS_NAME_ID, LicenseConstants.ADD_LICENSE, extraDataJSONObject.toString(), 0); } }
From source file:com.labimo.portlet.LicenseManage.java
@ProcessAction(name = "updateLicense") public void updateLicense(ActionRequest actionRequest, ActionResponse response) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat(liferay_pattern); User currentUser = PortalUtil.getUser(actionRequest); Utils utils = new Utils(); long userId = ParamUtil.getLong(actionRequest, "userId"); String licenseUuid = ParamUtil.getString(actionRequest, "licenseUuid"); licenseUuid = LicenseUtils.formatToString(licenseUuid); String hardwareUuid = ParamUtil.getString(actionRequest, "hardwareUuid"); Boolean valid = ParamUtil.getBoolean(actionRequest, "valid"); Date issueDate = ParamUtil.getDate(actionRequest, "issueDate", sdf); Date validDate = ParamUtil.getDate(actionRequest, "validDate", sdf); long currentTime = new Date().getTime(); System.out.println("userId = " + userId); System.out.println("licenseUuid = " + licenseUuid); System.out.println("issueDate = " + issueDate); System.out.println("hardwareUuid = " + hardwareUuid); System.out.println("validDate = " + validDate); System.out.println("valid = " + valid + " valid=" + ParamUtil.getString(actionRequest, "valid")); License license = LicenseLocalServiceUtil.getLicense(licenseUuid); if (license != null && license.getUserId() == userId && validDate.after(issueDate) && validDate.getTime() > currentTime) { System.out.println("======"); license.setModifiedDate(new Date()); license.setIssueDate(issueDate); license.setValidDate(validDate); license.setValid(valid);/* w w w . ja va 2s . c o m*/ LicenseLocalServiceUtil.updateLicense(license); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long gourpId = themeDisplay.getScopeGroupId(); JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject(); extraDataJSONObject.put("title", currentUser.getScreenName() + LicenseConstants.UPDATE_LICENSE_MSG + license.getLicenseUuid()); SocialActivityLocalServiceUtil.addActivity(currentUser.getUserId(), gourpId, LicenseConstants.LICENSE_CLASS_NAME, LicenseConstants.LICENSE_CLASS_NAME_ID, LicenseConstants.UPDATE_LICENSE, extraDataJSONObject.toString(), 0); } }
From source file:com.liferay.projects.dashboard.web.internal.portlet.action.EditProblemMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long problemId = ParamUtil.getLong(actionRequest, "problemId"); long projectId = ParamUtil.getLong(actionRequest, "projectId"); int type = ParamUtil.getInteger(actionRequest, "type"); String description = ParamUtil.getString(actionRequest, "description"); int status = ParamUtil.getInteger(actionRequest, "status"); Date statusDate = ParamUtil.getDate(actionRequest, "statusDate", null); if (problemId > 0) { _problemLocalService.updateProblem(problemId, projectId, type, description, status, statusDate); } else {// w w w . j av a 2 s .c om _problemLocalService.addProblem(themeDisplay.getUserId(), projectId, type, description, status, statusDate); } }
From source file:com.liferay.projects.dashboard.web.internal.portlet.action.EditProjectMVCActionCommand.java
License:Open Source License
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long projectId = ParamUtil.getLong(actionRequest, "projectId"); String name = ParamUtil.getString(actionRequest, "name"); String description = ParamUtil.getString(actionRequest, "description"); int priority = ParamUtil.getInteger(actionRequest, "priority"); Date expectedStartDate = ParamUtil.getDate(actionRequest, "expectedStartDate", DateFormat.getDateTimeInstance()); Date expectedEndDate = ParamUtil.getDate(actionRequest, "expectedEndDate", DateFormat.getDateTimeInstance()); Date actualStartDate = ParamUtil.getDate(actionRequest, "actualStartDate", DateFormat.getDateTimeInstance()); Date actualEndDate = ParamUtil.getDate(actionRequest, "actualEndDate", DateFormat.getDateTimeInstance()); int health = ParamUtil.getInteger(actionRequest, "health"); int status = ParamUtil.getInteger(actionRequest, "status"); long businessUnitId = ParamUtil.getLong(actionRequest, "businessUnitId"); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); if (projectId > 0) { _projectLocalService.updateProject(projectId, name, description, priority, health, expectedStartDate, expectedEndDate, actualStartDate, actualEndDate, status); } else {/* w w w .ja v a2 s . com*/ _projectLocalService.addProject(serviceContext.getUserId(), businessUnitId, name, description, priority, health, expectedStartDate, expectedEndDate, actualStartDate, actualEndDate, status); } }
From source file:com.rknowsys.eapp.EmployeeAction.java
/** This method updates EmpPersonalDetails record in Database*/ public void updateEmpPersonalDetails(ActionRequest actionRequest, ActionResponse actionResponse) { long fileEntryId = ParamUtil.getLong(actionRequest, "fileIdemp"); Long empId = ParamUtil.getLong(actionRequest, "perEmpId"); Date date = new Date(); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String firstName = ParamUtil.getString(actionRequest, EMPLOYEE_FIRST_NAME_COL_NAME); String middleName = ParamUtil.getString(actionRequest, EMPLOYEE_MIDDLE_NAME_COL_NAME); String lastName = ParamUtil.getString(actionRequest, EMPLOYEE_LAST_NAME_COL_NAME); String empNo = ParamUtil.getString(actionRequest, "employee_no"); String otherId = ParamUtil.getString(actionRequest, "other_id"); String driverLicenseNo = ParamUtil.getString(actionRequest, "driver_license_no"); Date expiryDate = ParamUtil.getDate(actionRequest, "expiry_date", dateFormat); String gender = ParamUtil.getString(actionRequest, "gender"); String maritalStatus = ParamUtil.getString(actionRequest, "marital_status"); long nationality = ParamUtil.getLong(actionRequest, "emp_nationality"); Date dateOfB = ParamUtil.getDate(actionRequest, "date_of_birth", dateFormat); long perEmpId = ParamUtil.getLong(actionRequest, "personalDetailsId"); EmpPersonalDetails empPersonalDetails = null; log.info("first name and last anme are" + " " + firstName + " " + lastName + " " + empId); try {//from w w w. j a v a2 s . c om empPersonalDetails = EmpPersonalDetailsLocalServiceUtil.getEmpPersonalDetails(perEmpId); } catch (PortalException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } if (empPersonalDetails != null) { empPersonalDetails.setFirstName(firstName); empPersonalDetails.setMiddleName(middleName); empPersonalDetails.setLastName(lastName); empPersonalDetails.setDateOfBirth(dateOfB); empPersonalDetails.setEmployeeId(empId); empPersonalDetails.setEmployeeNo(empNo); empPersonalDetails.setLicenseExpDate(expiryDate); empPersonalDetails.setLicenseNo(driverLicenseNo); empPersonalDetails.setOtherId(otherId); empPersonalDetails.setCompanyId(themeDisplay.getCompanyId()); empPersonalDetails.setUserId(themeDisplay.getUserId()); empPersonalDetails.setModifiedDate(date); empPersonalDetails.setNationalityId(nationality); empPersonalDetails.setMaritalStatus(maritalStatus); empPersonalDetails.setGender(gender); try { EmpPersonalDetailsLocalServiceUtil.updateEmpPersonalDetails(empPersonalDetails); } catch (SystemException e) { e.printStackTrace(); } } Map map = new HashMap(); map.put("empId", empId); map.put("jsp", "jsp1"); map.put("fileId", fileEntryId); actionRequest.getPortletSession(true).setAttribute("empId", map, PortletSession.APPLICATION_SCOPE); log.info("updateEmpPersonalDetails method"); actionResponse.setRenderParameter("jspPage", "/html/employee/edit_employee.jsp"); }
From source file:com.rknowsys.eapp.EmployeeAction.java
/** * <p>/*from w w w .j a v a2s .co m*/ * This method inserts new EmpSkill,EmpEducation,EmpWorkExperience, * EmpLanguage,EmpLicense records in database for a particular Employee * </p>*/ public void addQualifications(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); long fileEntryId = ParamUtil.getLong(actionRequest, "QualFileId"); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Date date = new Date(); Long empId = 0l; System.out.println("Constants.CMD: " + cmd); if (cmd.equals("empExperience")) { log.info("updating employee work experience"); empId = ParamUtil.getLong(actionRequest, "empWrkExpId"); String expCompany = ParamUtil.getString(actionRequest, "exp_company"); String jobTitle = ParamUtil.getString(actionRequest, "exp_jobtitle"); Date fromDate = ParamUtil.getDate(actionRequest, "exp_from_date", dateFormat); Date toDate = ParamUtil.getDate(actionRequest, "exp_to_date", dateFormat); String comments = ParamUtil.getString(actionRequest, "exp_comments"); EmpWorkExp empWorkExp = null; try { empWorkExp = EmpWorkExpLocalServiceUtil.createEmpWorkExp(CounterLocalServiceUtil.increment()); } catch (SystemException e) { e.printStackTrace(); } empWorkExp.setEmployeeId(empId); empWorkExp.setComment(comments); empWorkExp.setCompany(expCompany); empWorkExp.setFromDate(fromDate); empWorkExp.setToDate(toDate); empWorkExp.setJobTitle(jobTitle); empWorkExp.setCreateDate(date); empWorkExp.setModifiedDate(date); empWorkExp.setUserId(themeDisplay.getUserId()); empWorkExp.setCompanyId(themeDisplay.getCompanyId()); empWorkExp.setGroupId(themeDisplay.getCompanyGroupId()); try { EmpWorkExpLocalServiceUtil.addEmpWorkExp(empWorkExp); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (cmd.equals("empEducation")) { log.info("updating employee education"); empId = ParamUtil.getLong(actionRequest, "empEduId"); long level = ParamUtil.getLong(actionRequest, "edu_level"); String institute = ParamUtil.getString(actionRequest, "edu_institute"); String splization = ParamUtil.getString(actionRequest, "edu_major"); String year = ParamUtil.getString(actionRequest, "edu_year"); //String score=ParamUtil.getString(actionRequest, "edu_score"); Date from = ParamUtil.getDate(actionRequest, "edu_from_date", dateFormat); Date to = ParamUtil.getDate(actionRequest, "edu_to_date", dateFormat); EmpEducation education = null; try { education = EmpEducationLocalServiceUtil.createEmpEducation(CounterLocalServiceUtil.increment()); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } education.setEmployeeId(empId); education.setInstitute(institute); education.setMajor(splization); education.setYear(year); education.setStartDate(from); education.setEndDate(to); education.setEducationId(level); education.setCreateDate(date); education.setModifiedDate(date); education.setCompanyId(themeDisplay.getCompanyId()); education.setGroupId(themeDisplay.getCompanyGroupId()); education.setUserId(themeDisplay.getUserId()); try { EmpEducationLocalServiceUtil.addEmpEducation(education); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (cmd.equals("empSkills")) { log.info("updating employee skills"); empId = ParamUtil.getLong(actionRequest, "empSkillId"); long skill = ParamUtil.getLong(actionRequest, "emp_skill"); String exp = ParamUtil.getString(actionRequest, "skill_exp"); String comments = ParamUtil.getString(actionRequest, "skill_comments"); EmpSkill empSkill = null; try { empSkill = EmpSkillLocalServiceUtil.createEmpSkill(CounterLocalServiceUtil.increment()); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } empSkill.setEmployeeId(empId); empSkill.setYears(exp); empSkill.setComments(comments); empSkill.setSkillId(skill); empSkill.setCreateDate(date); empSkill.setModifiedDate(date); empSkill.setCompanyId(themeDisplay.getCompanyId()); empSkill.setGroupId(themeDisplay.getCompanyGroupId()); empSkill.setUserId(themeDisplay.getUserId()); try { EmpSkillLocalServiceUtil.addEmpSkill(empSkill); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (cmd.equals("empLanguage")) { log.info("updating employee language"); empId = ParamUtil.getLong(actionRequest, "empLanId"); Long language = ParamUtil.getLong(actionRequest, "emp_language"); String skill = ParamUtil.getString(actionRequest, "lan_skill"); String fluency = ParamUtil.getString(actionRequest, "lan_fluency"); EmpLanguage empLanguage = null; try { empLanguage = EmpLanguageLocalServiceUtil.createEmpLanguage(CounterLocalServiceUtil.increment()); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } empLanguage.setEmployeeId(empId); empLanguage.setLanguageId(language); empLanguage.setLanguageSkill(skill); empLanguage.setLanguageFluency(fluency); empLanguage.setCreateDate(date); empLanguage.setModifiedDate(date); empLanguage.setCompanyId(themeDisplay.getCompanyId()); empLanguage.setGroupId(themeDisplay.getCompanyGroupId()); empLanguage.setUserId(themeDisplay.getUserId()); try { EmpLanguageLocalServiceUtil.addEmpLanguage(empLanguage); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (cmd.equals("empLicense")) { log.info("updating employee license"); empId = ParamUtil.getLong(actionRequest, "empLicId"); long licenseId = ParamUtil.getLong(actionRequest, "emp_license_type"); String licenseNo = ParamUtil.getString(actionRequest, "emp_license_no"); Date issueDate = ParamUtil.getDate(actionRequest, "license_issue_date", dateFormat); Date expiryDate = ParamUtil.getDate(actionRequest, "license_exp_date", dateFormat); EmpLicense empLicense = null; try { empLicense = EmpLicenseLocalServiceUtil.createEmpLicense(CounterLocalServiceUtil.increment()); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } empLicense.setEmployeeId(empId); empLicense.setExpiryDate(expiryDate); empLicense.setIssuedDate(issueDate); empLicense.setLicenseNumber(licenseNo); empLicense.setLicenseId(licenseId); empLicense.setCreateDate(date); empLicense.setModifiedDate(date); empLicense.setCompanyId(themeDisplay.getCompanyId()); empLicense.setGroupId(themeDisplay.getCompanyGroupId()); empLicense.setUserId(themeDisplay.getUserId()); try { EmpLicenseLocalServiceUtil.addEmpLicense(empLicense); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Map map = new HashMap(); map.put("empId", empId); map.put("jsp", "jsp7"); map.put("fileId", fileEntryId); actionRequest.getPortletSession(true).setAttribute("empId", map, PortletSession.APPLICATION_SCOPE); actionResponse.setRenderParameter("jspPage", "/html/employee/edit_employee.jsp"); }
From source file:com.rknowsys.eapp.EmployeeAction.java
public void addImmigrationDetails(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Date date = new Date(); System.out.println("in addImmigrationDetails method"); long empId = ParamUtil.getLong(actionRequest, "empImgId"); String docType = ParamUtil.getString(actionRequest, "document_type"); String number = ParamUtil.getString(actionRequest, "img_number"); Date issuedDate = ParamUtil.getDate(actionRequest, "img_issued_date", dateFormat); String issuedBy = ParamUtil.getString(actionRequest, "issued_by"); String eligibleStatus = ParamUtil.getString(actionRequest, "eligible_status"); Date reviewDate = ParamUtil.getDate(actionRequest, "review_date", dateFormat); String comments = ParamUtil.getString(actionRequest, "img_comments"); Date expiryDate = ParamUtil.getDate(actionRequest, "img_exp_date", dateFormat); long fileEntryId = ParamUtil.getLong(actionRequest, "immiFileId"); EmpImmigrationDocument empImmigrationDocument = null; try {// ww w . java 2 s.c o m empImmigrationDocument = EmpImmigrationDocumentLocalServiceUtil .createEmpImmigrationDocument(CounterLocalServiceUtil.increment()); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } empImmigrationDocument.setEmployeeId(empId); empImmigrationDocument.setDocNumber(number); empImmigrationDocument.setIssuedBy(issuedBy); empImmigrationDocument.setIssuedDate(issuedDate); empImmigrationDocument.setExpiryDate(expiryDate); empImmigrationDocument.setEligibleStatus(eligibleStatus); empImmigrationDocument.setEligibleReviewDate(reviewDate); empImmigrationDocument.setComments(comments); empImmigrationDocument.setDocType(docType); empImmigrationDocument.setCreateDate(date); empImmigrationDocument.setModifiedDate(date); empImmigrationDocument.setCompanyId(themeDisplay.getCompanyId()); empImmigrationDocument.setGroupId(themeDisplay.getCompanyGroupId()); empImmigrationDocument.setUserId(themeDisplay.getUserId()); try { EmpImmigrationDocumentLocalServiceUtil.addEmpImmigrationDocument(empImmigrationDocument); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } Map map = new HashMap(); map.put("empId", empImmigrationDocument.getEmployeeId()); map.put("jsp", "jsp5"); map.put("fileId", fileEntryId); actionRequest.getPortletSession(true).setAttribute("empId", map, PortletSession.APPLICATION_SCOPE); actionResponse.setRenderParameter("jspPage", "/html/employee/edit_employee.jsp"); }
From source file:com.rknowsys.eapp.EmployeeAction.java
public void updateEmpJobHistory(ActionRequest actionRequest, ActionResponse actionResponse) { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Date date = new Date(); System.out.println("in updateEmpJobHistory method"); long empId = ParamUtil.getLong(actionRequest, "empJId"); Date joinedDate = ParamUtil.getDate(actionRequest, "joined_date", dateFormat); Date probationDte = ParamUtil.getDate(actionRequest, "probation_date", dateFormat); Date dateOfPermanency = ParamUtil.getDate(actionRequest, "date_permanency", dateFormat); long jobTitle = ParamUtil.getLong(actionRequest, "emp_job_title"); long employmentStatus = ParamUtil.getLong(actionRequest, "emp_status"); long jobCategory = ParamUtil.getLong(actionRequest, "emp_job_category"); long subUnit = ParamUtil.getLong(actionRequest, "emp_sub_unit"); long location = ParamUtil.getLong(actionRequest, "emp_location"); Date effectiveDate = ParamUtil.getDate(actionRequest, "effective_date", dateFormat); long workshift = ParamUtil.getLong(actionRequest, "emp_workshift"); String comments = ParamUtil.getString(actionRequest, "job_comments"); long fileEntryId = ParamUtil.getLong(actionRequest, "jobFileId"); EmpJob empJob = null;/*from w ww.ja va 2 s .c om*/ try { empJob = EmpJobLocalServiceUtil.createEmpJob(CounterLocalServiceUtil.increment()); } catch (Exception e) { System.out.println("cannot add job details"); } empJob.setEmployeeId(empId); empJob.setJoinedDate(joinedDate); empJob.setEffectiveDate(effectiveDate); empJob.setPermanentDate(dateOfPermanency); empJob.setEmploymentStatusId(employmentStatus); empJob.setJobCategoryId(jobCategory); empJob.setJobTitleId(jobTitle); empJob.setSubUnitId(subUnit); empJob.setLocationId(location); empJob.setProbationEndDate(probationDte); empJob.setComments(comments); empJob.setShiftId(workshift); empJob.setCreateDate(date); empJob.setModifiedDate(date); empJob.setCompanyId(themeDisplay.getCompanyId()); empJob.setGroupId(themeDisplay.getCompanyGroupId()); empJob.setUserId(themeDisplay.getUserId()); try { EmpJobLocalServiceUtil.addEmpJob(empJob); } catch (SystemException e) { // TODO Auto-generated catch block System.out.println("cannot add job"); e.printStackTrace(); } Map map = new HashMap(); map.put("empId", empId); map.put("jsp", "jsp9"); map.put("fileId", fileEntryId); actionRequest.getPortletSession(true).setAttribute("empId", map, PortletSession.APPLICATION_SCOPE); actionResponse.setRenderParameter("jspPage", "/html/employee/edit_employee.jsp"); }
From source file:com.rknowsys.eapp.EmployeeAction.java
public void updatePersonalDetails(ActionRequest actionRequest, ActionResponse actionResponse) { Long empId = ParamUtil.getLong(actionRequest, "perEmpId"); String firstName = ParamUtil.getString(actionRequest, EMPLOYEE_FIRST_NAME_COL_NAME); String middleName = ParamUtil.getString(actionRequest, EMPLOYEE_MIDDLE_NAME_COL_NAME); String lastName = ParamUtil.getString(actionRequest, EMPLOYEE_LAST_NAME_COL_NAME); String empNo = ParamUtil.getString(actionRequest, "employee_no"); String otherId = ParamUtil.getString(actionRequest, "other_id"); String driverLicenseNo = ParamUtil.getString(actionRequest, "driver_license_no"); Date expiryDate = ParamUtil.getDate(actionRequest, "expiry_date", null); String gender = ParamUtil.getString(actionRequest, "gender"); String maritalStatus = ParamUtil.getString(actionRequest, "marital_status"); String nationality = ParamUtil.getString(actionRequest, "emp_nationality"); Date dateOfB = ParamUtil.getDate(actionRequest, "date_of_birth", null); long perEmpId = ParamUtil.getLong(actionRequest, "personalDetailsId"); long fileEntryId = ParamUtil.getLong(actionRequest, "fileIdemp"); System.out.println("file entry id is" + fileEntryId); EmpPersonalDetails empPersonalDetails = null; log.info("first name and last anme are" + " " + firstName + " " + lastName + " " + empId); try {//w w w . j a v a 2 s. com empPersonalDetails = EmpPersonalDetailsLocalServiceUtil.getEmpPersonalDetails(perEmpId); } catch (PortalException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } if (empPersonalDetails != null) { empPersonalDetails.setFirstName(firstName); empPersonalDetails.setMiddleName(middleName); empPersonalDetails.setLastName(lastName); empPersonalDetails.setDateOfBirth(dateOfB); empPersonalDetails.setEmployeeNo(empNo); empPersonalDetails.setLicenseExpDate(expiryDate); empPersonalDetails.setLicenseNo(driverLicenseNo); empPersonalDetails.setOtherId(otherId); try { EmpPersonalDetailsLocalServiceUtil.updateEmpPersonalDetails(empPersonalDetails); } catch (SystemException e) { e.printStackTrace(); } Map map = new HashMap(); map.put("empId", empId); map.put("jsp", "jsp2"); map.put("fileId", fileEntryId); actionRequest.getPortletSession(true).setAttribute("empId", map, PortletSession.APPLICATION_SCOPE); } }
From source file:gr.open.loglevelsmanager.loglevel.LogLevelsManager.java
License:Open Source License
private LogLevel getLogLevelFromRequest(PortletRequest request) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); LogLevelImpl logLevel = new LogLevelImpl(); try {//from www .ja v a 2 s . c o m logLevel.setLogLevelId(ParamUtil.getLong(request, "LogLevelId")); } catch (Exception nfe) { // Controled en Validator } logLevel.setLogLevelDescription(ParamUtil.getString(request, "logLevelDescription")); logLevel.setLogLevelPriority(ParamUtil.getString(request, "logLevelPriority")); logLevel.setActivateOnStartup(ParamUtil.getBoolean(request, "activateOnStartup")); logLevel.setLogLevelScheduled(ParamUtil.getBoolean(request, "logLevelScheduled")); logLevel.setLogLevelCategory(ParamUtil.getString(request, "logLevelCategory")); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); logLevel.setLogLevelEndDate(ParamUtil.getDate(request, "logLevelEndDate", sdf)); int LogLevelStartDateTimeAno = ParamUtil.getInteger(request, "logLevelStartDateYear"); int LogLevelStartDateTimeMes = ParamUtil.getInteger(request, "logLevelStartDateMonth") + 1; int LogLevelStartDateTimeDia = ParamUtil.getInteger(request, "logLevelStartDateDay"); int LogLevelStartDateTimeHora = ParamUtil.getInteger(request, "logLevelStartDateHour"); int LogLevelStartDateTimeMinuto = ParamUtil.getInteger(request, "logLevelStartDateMinute"); int LogLevelStartDateTimeAmPm = ParamUtil.getInteger(request, "logLevelStartDateAmPm"); if (LogLevelStartDateTimeAmPm == Calendar.PM) { LogLevelStartDateTimeHora += 12; } try { SimpleDateFormat formatterDateTime = new SimpleDateFormat("yyyy/MM/dd HH:mm"); logLevel.setLogLevelStartDate(formatterDateTime.parse( LogLevelStartDateTimeAno + "/" + LogLevelStartDateTimeMes + "/" + LogLevelStartDateTimeDia + " " + LogLevelStartDateTimeHora + ":" + LogLevelStartDateTimeMinuto)); } catch (ParseException e) { logLevel.setLogLevelStartDate(new Date()); } int LogLevelEndDateTimeAno = ParamUtil.getInteger(request, "logLevelEndDateYear"); int LogLevelEndDateTimeMes = ParamUtil.getInteger(request, "logLevelEndDateMonth") + 1; int LogLevelEndDateTimeDia = ParamUtil.getInteger(request, "logLevelEndDateDay"); int LogLevelEndDateTimeHora = ParamUtil.getInteger(request, "logLevelEndDateHour"); int LogLevelEndDateTimeMinuto = ParamUtil.getInteger(request, "logLevelEndDateMinute"); int LogLevelEndDateTimeAmPm = ParamUtil.getInteger(request, "logLevelEndDateAmPm"); if (LogLevelEndDateTimeAmPm == Calendar.PM) { LogLevelEndDateTimeHora += 12; } try { SimpleDateFormat formatterDateTime = new SimpleDateFormat("yyyy/MM/dd HH:mm"); logLevel.setLogLevelEndDate(formatterDateTime .parse(LogLevelEndDateTimeAno + "/" + LogLevelEndDateTimeMes + "/" + LogLevelEndDateTimeDia + " " + LogLevelEndDateTimeHora + ":" + LogLevelEndDateTimeMinuto)); } catch (ParseException e) { logLevel.setLogLevelEndDate(new Date()); } try { logLevel.setPrimaryKey(ParamUtil.getLong(request, "resourcePrimKey")); } catch (NumberFormatException nfe) { // Controled en Validator } logLevel.setCompanyId(themeDisplay.getCompanyId()); logLevel.setGroupId(themeDisplay.getScopeGroupId()); logLevel.setUserId(themeDisplay.getUserId()); logger.debug("GOT FROM REQUEST:" + logLevel); return logLevel; }