/** * This method is to delete alert * * @param formBase * @param result * @param request * @param response * @return ModelAndView */ @RequestMapping(params = "methodToCall=approveAlert") public ModelAndView approveAlert( @ModelAttribute("KualiForm") DocumentFormBase formBase, BindingResult result, HttpServletRequest request, HttpServletResponse response) { AlertBo alertBo = null; MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase; OlePersistableBusinessObjectBase olePersistableBusinessObjectBase = (OlePersistableBusinessObjectBase) maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject(); int index = Integer.parseInt( maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX)); olePersistableBusinessObjectBase.getAlertBoList().get(index).setAlertStatus(false); olePersistableBusinessObjectBase .getAlertBoList() .get(index) .setAlertModifierId(GlobalVariables.getUserSession().getPrincipalId()); if (olePersistableBusinessObjectBase.getAlertBoList().get(index).isRepeatable()) { alertBo = alertHelperService.createNewAlertBo( olePersistableBusinessObjectBase.getAlertBoList().get(index)); olePersistableBusinessObjectBase.getAlertBoList().add(alertBo); } return super.navigate(formBase, result, request, response); }
/** * This method is to save alert * * @param formBase * @param result * @param request * @param response * @return ModelAndView */ @RequestMapping(params = "methodToCall=saveAlert") public ModelAndView saveAlert( @ModelAttribute("KualiForm") DocumentFormBase formBase, BindingResult result, HttpServletRequest request, HttpServletResponse response) { MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase; OlePersistableBusinessObjectBase olePersistableBusinessObjectBase = (OlePersistableBusinessObjectBase) maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject(); int index = Integer.parseInt( maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX)); olePersistableBusinessObjectBase.getAlertBoList().get(index).setEditFlag(false); AlertBo alertBo = olePersistableBusinessObjectBase.getAlertBoList().get(index); String status = null; if (alertBo.getAlertDate() != null) { Date alertDate = alertBo.getAlertDate(); if (alertDate.toString().equals(new Date(System.currentTimeMillis()).toString())) { status = "Active"; } else { int dateCompare = alertBo.getAlertDate().compareTo(new Date(System.currentTimeMillis())); if (dateCompare > 0) { status = "Future"; } else if (dateCompare < 0) { status = "Complete"; } } } alertBo.setStatus(status); return super.navigate(maintenanceDocumentForm, result, request, response); }
/** * This method is to delete alert * * @param formBase * @param result * @param request * @param response * @return ModelAndView */ @RequestMapping(params = "methodToCall=deleteAlert") public ModelAndView deleteAlert( @ModelAttribute("KualiForm") DocumentFormBase formBase, BindingResult result, HttpServletRequest request, HttpServletResponse response) { MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase; OlePersistableBusinessObjectBase olePersistableBusinessObjectBase = (OlePersistableBusinessObjectBase) maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject(); int index = Integer.parseInt( maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX)); if (olePersistableBusinessObjectBase.getAlertBoList().size() > index) { olePersistableBusinessObjectBase.getAlertBoList().remove(index); } return super.navigate(formBase, result, request, response); }
/** * This method is to edit alert * * @param formBase * @param result * @param request * @param response * @return ModelAndView */ @RequestMapping(params = "methodToCall=editAlert") public ModelAndView editAlert( @ModelAttribute("KualiForm") DocumentFormBase formBase, BindingResult result, HttpServletRequest request, HttpServletResponse response) { MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) formBase; OlePersistableBusinessObjectBase olePersistableBusinessObjectBase = (OlePersistableBusinessObjectBase) maintenanceDocumentForm.getDocument().getNewMaintainableObject().getDataObject(); int index = Integer.parseInt( maintenanceDocumentForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX)); AlertBo alertBo = olePersistableBusinessObjectBase.getAlertBoList().get(index); alertBo.setEditFlag(true); alertBo.setAlertModifierId(GlobalVariables.getUserSession().getPrincipalId()); alertBo.setAlertModifiedDate(new Date(System.currentTimeMillis())); alertBo.setAlertModifierName( alertService.getName(GlobalVariables.getUserSession().getPrincipalId())); return super.navigate(maintenanceDocumentForm, result, request, response); }