Search in sources :

Example 6 with OnlyBranchOfficeHierarchyDto

use of org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto in project head by mifos.

the class OfficeServiceFacadeWebTier method retrieveBranchOnlyOfficeHierarchy.

@Override
public OnlyBranchOfficeHierarchyDto retrieveBranchOnlyOfficeHierarchy() {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    OfficeDto office = officeDao.findOfficeDtoById(user.getBranchId());
    List<OfficeBO> branchParents = officeDao.findBranchsOnlyWithParentsMatching(office.getSearchId());
    List<OfficeDetailsDto> levels = officeDao.findActiveOfficeLevels();
    List<OfficeHierarchyDto> branchOnlyOfficeHierarchy = OfficeBO.convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(branchParents);
    return new OnlyBranchOfficeHierarchyDto(Locale.getDefault(), levels, office.getSearchId(), branchOnlyOfficeHierarchy);
}
Also used : OfficeHierarchyDto(org.mifos.dto.domain.OfficeHierarchyDto) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) OfficeDto(org.mifos.dto.domain.OfficeDto) OfficeBO(org.mifos.customers.office.business.OfficeBO) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) MifosUser(org.mifos.security.MifosUser) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 7 with OnlyBranchOfficeHierarchyDto

use of org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto 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)

Aggregations

OnlyBranchOfficeHierarchyDto (org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto)7 OfficeHierarchyDto (org.mifos.dto.domain.OfficeHierarchyDto)4 OfficeBO (org.mifos.customers.office.business.OfficeBO)3 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)3 OfficeDto (org.mifos.dto.domain.OfficeDto)3 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)3 MifosUser (org.mifos.security.MifosUser)2 UserContext (org.mifos.security.util.UserContext)2 ArrayList (java.util.ArrayList)1 JspException (javax.servlet.jsp.JspException)1 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)1 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)1 ListElement (org.mifos.dto.screen.ListElement)1