Search in sources :

Example 1 with GroupCreation

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());
}
Also used : GroupFormCreationDto(org.mifos.dto.domain.GroupFormCreationDto) GroupCreation(org.mifos.dto.domain.GroupCreation) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) CenterBO(org.mifos.customers.center.business.CenterBO) GroupCustActionForm(org.mifos.customers.group.struts.actionforms.GroupCustActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

CenterBO (org.mifos.customers.center.business.CenterBO)1 GroupCustActionForm (org.mifos.customers.group.struts.actionforms.GroupCustActionForm)1 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)1 GroupCreation (org.mifos.dto.domain.GroupCreation)1 GroupFormCreationDto (org.mifos.dto.domain.GroupFormCreationDto)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1