use of org.mifos.dto.domain.GroupCreation in project head by mifos.
the class GroupCustAction method load.
@TransactionDemarcate(saveToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupCustActionForm actionForm = (GroupCustActionForm) form;
actionForm.cleanForm();
SessionUtils.removeAttribute(CustomerConstants.CUSTOMER_MEETING, request.getSession());
GroupCreation groupCreation = null;
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
if (isCenterHierarchyExists) {
String centerSystemId = actionForm.getCenterSystemId();
CenterBO center = this.customerDao.findCenterBySystemId(centerSystemId);
groupCreation = new GroupCreation(actionForm.getOfficeIdValue(), centerSystemId);
// inherit these settings from center/parent if center hierarchy is configured
actionForm.setParentCustomer(center);
actionForm.setOfficeId(center.getOfficeId().toString());
actionForm.setFormedByPersonnel(center.getLoanOfficerId().toString());
} else {
groupCreation = new GroupCreation(actionForm.getOfficeIdValue(), "");
}
GroupFormCreationDto groupFormCreationDto = this.groupServiceFacade.retrieveGroupFormCreationData(groupCreation);
actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
actionForm.setDefaultFees(groupFormCreationDto.getDefaultFees());
SessionUtils.setCollectionAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, groupFormCreationDto.getAdditionalFees(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, groupFormCreationDto.getPersonnelList(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.FORMEDBY_LOAN_OFFICER_LIST, groupFormCreationDto.getFormedByPersonnel(), request);
SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, groupFormCreationDto.isCenterHierarchyExists(), request);
return mapping.findForward(ActionForwards.load_success.toString());
}
Aggregations