use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class AddGroupMembershipAction method updateParent.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward updateParent(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
AddGroupMembershipForm actionForm = (AddGroupMembershipForm) form;
Integer parentGroupId = actionForm.getParentGroupIdValue();
ClientBO clientInSession = (ClientBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
String globalCustNum = this.clientServiceFacade.transferClientToGroup(parentGroupId, clientInSession.getGlobalCustNum(), clientInSession.getVersionNo());
ClientBO client = this.customerDao.findClientBySystemId(globalCustNum);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
return mapping.findForward(ActionForwards.view_client_details_page.toString());
}
use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class GroupCustAction method update.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupBO group = (GroupBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
GroupCustActionForm actionForm = (GroupCustActionForm) form;
boolean trained = false;
if (actionForm.getTrainedValue() != null && actionForm.getTrainedValue().equals(Short.valueOf("1"))) {
trained = true;
}
AddressDto address = null;
if (actionForm.getAddress() != null) {
address = Address.toDto(actionForm.getAddress());
}
GroupUpdate groupUpdate = new GroupUpdate(group.getCustomerId(), group.getGlobalCustNum(), group.getVersionNo(), actionForm.getDisplayName(), actionForm.getLoanOfficerIdValue(), actionForm.getExternalId(), trained, actionForm.getTrainedDate(), address, actionForm.getCustomFields(), actionForm.getCustomerPositions());
try {
this.groupServiceFacade.updateGroup(groupUpdate);
} catch (BusinessRuleException e) {
throw new ApplicationException(e.getMessageKey(), e);
}
return mapping.findForward(ActionForwards.update_success.toString());
}
use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class OffAction method update.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OffActionForm offActionForm = (OffActionForm) form;
ActionForward forward = null;
OfficeDto sessionOffice = (OfficeDto) SessionUtils.getAttribute(OfficeConstants.OFFICE_DTO, request);
Short officeId = sessionOffice.getOfficeId();
Integer versionNum = sessionOffice.getVersionNum();
OfficeUpdateRequest officeUpdateRequest = officeUpdateRequestFrom(offActionForm);
boolean isParentOfficeChanged = this.officeServiceFacade.updateOffice(officeId, versionNum, officeUpdateRequest);
if (isParentOfficeChanged) {
forward = mapping.findForward(ActionForwards.update_cache_success.toString());
} else {
forward = mapping.findForward(ActionForwards.update_success.toString());
}
return forward;
}
use of org.mifos.framework.util.helpers.CloseSession in project head by mifos.
the class CustomerApplyAdjustmentAction method applyAdjustment.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward applyAdjustment(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
String forward = null;
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_APPLY_ADJUSTMENT);
CustomerApplyAdjustmentActionForm applyAdjustmentActionForm = (CustomerApplyAdjustmentActionForm) form;
String globalCustNum = applyAdjustmentActionForm.getGlobalCustNum();
CustomerBO customerBO = this.customerDao.findCustomerBySystemId(globalCustNum);
SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, customerBO, request);
if (null == customerBO.getCustomerAccount().findMostRecentNonzeroPaymentByPaymentDate()) {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_PREVIEW_ADJUSTMENT);
throw new ApplicationException(AccountExceptionConstants.ZEROAMNTADJUSTMENT);
}
try {
this.centerServiceFacade.revertLastChargesPayment(globalCustNum, applyAdjustmentActionForm.getAdjustmentNote());
} catch (BusinessRuleException e) {
request.setAttribute(CustomerConstants.METHOD, CustomerConstants.METHOD_PREVIEW_ADJUSTMENT);
throw e;
}
String inputPage = applyAdjustmentActionForm.getInput();
resetActionFormFields(applyAdjustmentActionForm);
if (inputPage != null) {
if (inputPage.equals(CustomerConstants.VIEW_GROUP_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_GROUP_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CENTER_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_CENTER_SUCCESS;
} else if (inputPage.equals(CustomerConstants.VIEW_CLIENT_CHARGES)) {
forward = CustomerConstants.APPLY_ADJUSTMENT_CLIENT_SUCCESS;
}
}
return mapping.findForward(forward);
}
use of org.mifos.framework.util.helpers.CloseSession 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));
}
Aggregations