use of org.mifos.dto.domain.GroupFormCreationDto in project head by mifos.
the class GroupServiceFacadeWebTier method retrieveGroupFormCreationData.
@Override
public GroupFormCreationDto retrieveGroupFormCreationData(GroupCreation groupCreation) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
CustomerBO parentCustomer = null;
Short parentOfficeId = groupCreation.getOfficeId();
CustomerApplicableFeesDto applicableFees = CustomerApplicableFeesDto.empty();
List<PersonnelDto> personnelList = new ArrayList<PersonnelDto>();
CenterCreation centerCreation;
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
if (isCenterHierarchyExists) {
parentCustomer = this.customerDao.findCenterBySystemId(groupCreation.getParentSystemId());
parentOfficeId = parentCustomer.getOffice().getOfficeId();
centerCreation = new CenterCreation(parentOfficeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
MeetingBO customerMeeting = parentCustomer.getCustomerMeetingValue();
List<FeeBO> fees = customerDao.retrieveFeesApplicableToGroupsRefinedBy(customerMeeting);
applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
} else {
centerCreation = new CenterCreation(groupCreation.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
personnelList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
List<FeeBO> fees = customerDao.retrieveFeesApplicableToGroups();
applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
}
List<ApplicableAccountFeeDto> applicableDefaultAccountFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getDefaultFees()) {
applicableDefaultAccountFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<ApplicableAccountFeeDto> applicableDefaultAdditionalFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getAdditionalFees()) {
applicableDefaultAdditionalFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<PersonnelDto> formedByPersonnel = customerDao.findLoanOfficerThatFormedOffice(centerCreation.getOfficeId());
return new GroupFormCreationDto(isCenterHierarchyExists, personnelList, formedByPersonnel, applicableDefaultAccountFees, applicableDefaultAdditionalFees);
}
use of org.mifos.dto.domain.GroupFormCreationDto 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