@CloseSession @TransactionDemarcate(validateAndResetToken = true) public ActionForward create( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug("In CustomerNotesAction::create()"); ActionForward forward = null; CustomerNotesActionForm notesActionForm = (CustomerNotesActionForm) form; CustomerBO customerBO = getCustomerBusinessService() .getCustomer(Integer.valueOf(((CustomerNotesActionForm) form).getCustomerId())); UserContext uc = getUserContext(request); if (customerBO.getPersonnel() != null) { checkPermissionForAddingNotes( AccountTypes.CUSTOMER_ACCOUNT, customerBO.getLevel(), uc, customerBO.getOffice().getOfficeId(), customerBO.getPersonnel().getPersonnelId()); } else { checkPermissionForAddingNotes( AccountTypes.CUSTOMER_ACCOUNT, customerBO.getLevel(), uc, customerBO.getOffice().getOfficeId(), uc.getId()); } PersonnelBO personnelBO = new PersonnelPersistence().getPersonnel(uc.getId()); CustomerNoteEntity customerNote = new CustomerNoteEntity( notesActionForm.getComment(), new DateTimeService().getCurrentJavaSqlDate(), personnelBO, customerBO); customerBO.addCustomerNotes(customerNote); customerBO.setUserContext(uc); customerBO.update(); forward = mapping.findForward(getDetailCustomerPage(notesActionForm)); customerBO = null; return forward; }
@TransactionDemarcate(joinToken = true) public ActionForward load( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug("In CustomerNotesAction::load()"); clearActionForm(form); UserContext userContext = getUserContext(request); CustomerBO customerBO = getCustomerBusinessService() .getCustomer(Integer.valueOf(((CustomerNotesActionForm) form).getCustomerId())); customerBO.setUserContext(userContext); setFormAttributes(userContext, form, customerBO); PersonnelBO personnelBO = new PersonnelPersistence().getPersonnel(userContext.getId()); SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request); SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request); SessionUtils.setAttribute( CustomerConstants.PERSONNEL_NAME, personnelBO.getDisplayName(), request); return mapping.findForward(ActionForwards.load_success.toString()); }