@RequestMapping(method = RequestMethod.GET) public String view( final Model model, @PathVariable final Long id, final HttpServletRequest request) { VacancyRemissionApproval vacancyRemissionApproval = vacancyRemissionService.getVacancyRemissionApprovalById(id); String userDesgn = ""; if (null != designation) userDesgn = designation.getName(); if (vacancyRemissionApproval != null) { model.addAttribute("stateType", vacancyRemissionApproval.getClass().getSimpleName()); model.addAttribute("currentState", vacancyRemissionApproval.getCurrentState().getValue()); prepareWorkflow(model, vacancyRemissionApproval, new WorkflowContainer()); BasicProperty basicProperty = vacancyRemissionApproval.getVacancyRemission().getBasicProperty(); vacancyRemissionService.addModelAttributes(model, basicProperty); model.addAttribute( "detailsHistory", vacancyRemissionService.getMonthlyDetailsHistory( vacancyRemissionApproval.getVacancyRemission())); model.addAttribute("workflowHistory", vacancyRemissionApproval.getStateHistory()); model.addAttribute("userDesgn", userDesgn); model.addAttribute("designation", COMMISSIONER_DESGN); } return VRAPPROVAL_EDIT; }
@RequestMapping(method = RequestMethod.POST) public String update( @Valid @ModelAttribute VacancyRemissionApproval vacancyRemissionApproval, final BindingResult resultBinder, final RedirectAttributes redirectAttributes, final HttpServletRequest request, final Model model) { String senderName = vacancyRemissionApproval.getCurrentState().getSenderName(); if (!resultBinder.hasErrors()) { String workFlowAction = ""; if (request.getParameter("workFlowAction") != null) workFlowAction = request.getParameter("workFlowAction"); Long approvalPosition = 0l; String approvalComent = ""; String successMsg = ""; if (request.getParameter("approvalComent") != null) approvalComent = request.getParameter("approvalComent"); if (request.getParameter("approvalPosition") != null && !request.getParameter("approvalPosition").isEmpty()) approvalPosition = Long.valueOf(request.getParameter("approvalPosition")); vacancyRemissionService.saveVacancyRemissionApproval( vacancyRemissionApproval, approvalPosition, approvalComent, null, workFlowAction); if (StringUtils.isNotBlank(workFlowAction)) { if (workFlowAction.equalsIgnoreCase(PropertyTaxConstants.WFLOW_ACTION_STEP_APPROVE)) { successMsg = "Vacancy Remission Approved Successfully in the System and forwarded to " + vacancyRemissionApproval.getVacancyRemission().getCreatedBy().getUsername(); } else if (workFlowAction.equalsIgnoreCase(PropertyTaxConstants.WFLOW_ACTION_STEP_REJECT)) { if (designation.getName().equalsIgnoreCase(REVENUE_INSPECTOR_DESGN)) { successMsg = "Vacancy Remission rejected successfully and forwarded to : " + vacancyRemissionApproval.getVacancyRemission().getCreatedBy().getUsername(); } else { successMsg = "Vacancy Remission rejected successfully and forwarded to : " + vacancyRemissionApproval.getCreatedBy().getUsername(); } } else { successMsg = "Vacancy Remission Saved Successfully in the System and forwarded to : " + propertyTaxUtil.getApproverUserName(approvalPosition); } } model.addAttribute("successMessage", successMsg); if (StringUtils.isNotBlank(workFlowAction) && workFlowAction.equalsIgnoreCase( PropertyTaxConstants.WFLOW_ACTION_STEP_NOTICE_GENERATE)) { String pathVars = vacancyRemissionApproval.getVacancyRemission().getBasicProperty().getUpicNo() + "," + senderName; return "redirect:/vacancyremission/rejectionacknowledgement?pathVar=" + pathVars; } } return "vacancyRemission-success"; }