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