use of org.mifos.service.BusinessRuleException in project head by mifos.
the class EditCustomerStatusAction method updateStatus.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward updateStatus(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
EditCustomerStatusActionForm editStatusActionForm = (EditCustomerStatusActionForm) form;
CustomerBO customerBOInSession = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
if (customerBOInSession.isBlackListed() && customerBOInSession.getStatus().getValue() == CustomerConstants.CLIENT_CLOSED) {
try {
this.clientServiceFacade.removeFromBlacklist(customerBOInSession.getCustomerId());
customerBOInSession.setVersionNo(customerBOInSession.getVersionNo() + 1);
} catch (AccessDeniedException e) {
throw new CustomerException(SecurityConstants.KEY_ACTIVITY_NOT_ALLOWED);
}
}
try {
this.centerServiceFacade.updateCustomerStatus(customerBOInSession.getCustomerId(), customerBOInSession.getVersionNo(), editStatusActionForm.getFlagId(), editStatusActionForm.getNewStatusId(), editStatusActionForm.getNotes());
createClientQuestionnaire.saveResponses(request, editStatusActionForm, customerBOInSession.getCustomerId());
} catch (BusinessRuleException e) {
throw new ApplicationException(e.getMessageKey(), e);
}
return mapping.findForward(getDetailAccountPage(form));
}
use of org.mifos.service.BusinessRuleException in project head by mifos.
the class PersonAction method create.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
PersonActionForm personActionForm = (PersonActionForm) form;
CreateOrUpdatePersonnelInformation perosonnelInfo = translateFormToCreatePersonnelInformationDto(request, personActionForm);
try {
UserDetailDto userDetails = this.personnelServiceFacade.createPersonnelInformation(perosonnelInfo);
String globalPersonnelNum = userDetails.getSystemId();
Name name = new Name(personActionForm.getFirstName(), personActionForm.getMiddleName(), personActionForm.getSecondLastName(), personActionForm.getLastName());
request.setAttribute("displayName", name.getDisplayName());
request.setAttribute("globalPersonnelNum", globalPersonnelNum);
createGroupQuestionnaire.saveResponses(request, personActionForm, userDetails.getId());
return mapping.findForward(ActionForwards.create_success.toString());
} catch (BusinessRuleException e) {
throw new PersonnelException(e.getMessageKey(), e, e.getMessageValues());
}
}
use of org.mifos.service.BusinessRuleException in project head by mifos.
the class HolidayBO method validateFromDateAgainstThruDate.
private void validateFromDateAgainstThruDate(final Date fromDate, final Date thruDate) {
LocalDate fromLocalDate = new LocalDate(fromDate);
LocalDate thruLocalDate = new LocalDate(thruDate);
if (fromLocalDate.isAfter(thruLocalDate)) {
throw new BusinessRuleException(HolidayConstants.INVALIDTHRUDATE);
}
}
use of org.mifos.service.BusinessRuleException in project head by mifos.
the class HolidayBO method validateFromDateAgainstCurrentDate.
private void validateFromDateAgainstCurrentDate(final Date fromDate) {
LocalDate currentDate = new LocalDate();
LocalDate fromLocalDate = new LocalDate(fromDate);
if (!fromLocalDate.isAfter(currentDate)) {
throw new BusinessRuleException(HolidayConstants.INVALIDFROMDATE);
}
}
use of org.mifos.service.BusinessRuleException in project head by mifos.
the class NewFundPreviewController method processFormSubmit.
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = EDIT_PARAM, required = false) String edit, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") FundFormBean formBean, BindingResult result, SessionStatus status) {
ModelAndView mav = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN);
if (StringUtils.isNotBlank(edit)) {
mav = new ModelAndView("editFunds");
mav.addObject("formBean", formBean);
mav.addObject("previewView", "newFundPreview");
} else if (StringUtils.isNotBlank(cancel)) {
mav = new ModelAndView(REDIRECT_TO_VIEW_FUNDS);
status.setComplete();
} else if (result.hasErrors()) {
mav = new ModelAndView("newFundPreview");
} else {
FundCodeDto codeDto = new FundCodeDto();
codeDto.setId(formBean.getCodeId());
codeDto.setValue(formBean.getCodeValue());
FundDto fundDto = new FundDto();
fundDto.setCode(codeDto);
fundDto.setId(formBean.getId());
fundDto.setName(formBean.getName());
try {
this.fundServiceFacade.createFund(fundDto);
status.setComplete();
} catch (BusinessRuleException e) {
ObjectError error = new ObjectError("formBean", new String[] { e.getMessageKey() }, new Object[] {}, "default: ");
result.addError(error);
mav.setViewName("newFundPreview");
mav.addObject("formBean", formBean);
}
}
return mav;
}
Aggregations