Search in sources :

Example 26 with OfficeDto

use of org.mifos.dto.domain.OfficeDto in project head by mifos.

the class SystemUserController method showBranchHierarchy.

@SuppressWarnings("PMD")
public OfficeHierarchyFormBean showBranchHierarchy() {
    OnlyBranchOfficeHierarchyDto hierarchy = this.officeServiceFacade.retrieveBranchOnlyOfficeHierarchy();
    List<BranchOnlyHierarchyBean> branchOnlyHierarchyList = new ArrayList<BranchOnlyHierarchyBean>();
    for (OfficeHierarchyDto office : hierarchy.getBranchOnlyOfficeHierarchy()) {
        BranchOnlyHierarchyBean branchOnlyHierarchyBean = new BranchOnlyHierarchyBean();
        branchOnlyHierarchyBean.setId(office.getOfficeId().intValue());
        branchOnlyHierarchyBean.setName(office.getOfficeName());
        List<ListElement> branches = new ArrayList<ListElement>();
        for (OfficeHierarchyDto child : office.getChildren()) {
            branches.add(new ListElement(child.getOfficeId().intValue(), child.getOfficeName()));
        }
        branchOnlyHierarchyBean.setChildren(branches);
        branchOnlyHierarchyList.add(branchOnlyHierarchyBean);
    }
    List<OfficeDto> nonBranchOffices = this.officeServiceFacade.retrieveAllNonBranchOfficesApplicableToLoggedInUser();
    List<ListElement> nonBranches = new ArrayList<ListElement>();
    for (OfficeDto office : nonBranchOffices) {
        nonBranches.add(new ListElement(office.getId().intValue(), office.getName()));
    }
    OfficeHierarchyFormBean bean = new OfficeHierarchyFormBean();
    bean.setNonBranches(nonBranches);
    bean.setBranchOnlyOfficeHierarchy(branchOnlyHierarchyList);
    return bean;
}
Also used : OfficeHierarchyDto(org.mifos.dto.domain.OfficeHierarchyDto) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) OfficeDto(org.mifos.dto.domain.OfficeDto) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) ArrayList(java.util.ArrayList) ListElement(org.mifos.dto.screen.ListElement)

Example 27 with OfficeDto

use of org.mifos.dto.domain.OfficeDto in project head by mifos.

the class EditOfficeInformationController method getParentDetails.

public Map<String, String> getParentDetails(String officelevelId) {
    List<OfficeDto> headOffices = officeServiceFacade.retrieveAllOffices().getHeadOffices();
    List<OfficeDto> regionalOffices = officeServiceFacade.retrieveAllOffices().getRegionalOffices();
    List<OfficeDto> divisionalOffices = officeServiceFacade.retrieveAllOffices().getDivisionalOffices();
    List<OfficeDto> areaOffices = officeServiceFacade.retrieveAllOffices().getAreaOffices();
    Map<String, String> parentOffices = new LinkedHashMap<String, String>();
    if (!officelevelId.equals("")) {
        int officeId = Integer.parseInt(officelevelId);
        if (officeId >= 2) {
            for (OfficeDto officeDto : headOffices) {
                parentOffices.put(officeDto.getLevelId().toString(), "Head Office(" + officeDto.getName() + ")");
            }
        }
        if (officeId >= 3) {
            for (OfficeDto officeDto : regionalOffices) {
                parentOffices.put(officeDto.getLevelId().toString(), "Regional Office(" + officeDto.getName() + ")");
            }
        }
        if (officeId >= 4) {
            for (OfficeDto officeDto : divisionalOffices) {
                parentOffices.put(officeDto.getLevelId().toString(), "Divisional Office(" + officeDto.getName() + ")");
            }
        }
        if (officeId >= 5) {
            for (OfficeDto officeDto : areaOffices) {
                parentOffices.put(officeDto.getLevelId().toString(), "Area Office(" + officeDto.getName() + ")");
            }
        }
    } else {
        parentOffices.put("", "");
    }
    return parentOffices;
}
Also used : OfficeDto(org.mifos.dto.domain.OfficeDto) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

OfficeDto (org.mifos.dto.domain.OfficeDto)27 ArrayList (java.util.ArrayList)14 OffActionForm (org.mifos.customers.office.struts.actionforms.OffActionForm)6 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)6 MifosUser (org.mifos.security.MifosUser)6 OfficeBO (org.mifos.customers.office.business.OfficeBO)5 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)5 HashMap (java.util.HashMap)3 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)3 OfficeHierarchyDto (org.mifos.dto.domain.OfficeHierarchyDto)3 ValueListElement (org.mifos.dto.domain.ValueListElement)3 ListElement (org.mifos.dto.screen.ListElement)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ModelAndView (org.springframework.web.servlet.ModelAndView)3 LinkedHashMap (java.util.LinkedHashMap)2 Test (org.junit.Test)2 MessageLookup (org.mifos.application.master.MessageLookup)2 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)2 MifosRuntimeException (org.mifos.core.MifosRuntimeException)2 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)2