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);
}
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;
}
Aggregations