use of org.mifos.dto.domain.OfficeHierarchyDto in project head by mifos.
the class CustomerServiceFacadeWebTier method retrieveBranchOnlyOfficeHierarchy.
@Override
public OnlyBranchOfficeHierarchyDto retrieveBranchOnlyOfficeHierarchy() {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
OfficeDto office = officeDao.findOfficeDtoById(userContext.getBranchId());
List<OfficeBO> branchParents = officeDao.findBranchsOnlyWithParentsMatching(office.getSearchId());
List<OfficeDetailsDto> levels = officeDao.findActiveOfficeLevels();
List<OfficeHierarchyDto> branchOnlyOfficeHierarchy = OfficeBO.convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(branchParents);
return new OnlyBranchOfficeHierarchyDto(userContext.getPreferredLocale(), levels, office.getSearchId(), branchOnlyOfficeHierarchy);
}
use of org.mifos.dto.domain.OfficeHierarchyDto in project head by mifos.
the class OfficeListTag method getBranchOffices.
void getBranchOffices(XmlBuilder html, List<OfficeHierarchyDto> officeList, Locale preferredUserLocale, String loggedInOfficeSearchId, String branchName) {
html.singleTag("br");
html.startTag("span", "class", "fontnormalBold");
html.text(branchName);
html.endTag("span");
html.singleTag("br");
if (officeList == null) {
html.startTag("span", "class", "fontnormal");
html.text(MessageLookup.getLocalizedMessage("Office.labelNo"));
html.text(" ");
html.text(branchName.toLowerCase());
html.text(" ");
html.text(MessageLookup.getLocalizedMessage("Office.labelPresent"));
html.endTag("span");
} else {
for (int i = 0; i < officeList.size(); i++) {
OfficeHierarchyDto officeParent = officeList.get(i);
Set<OfficeHierarchyDto> branchList = new TreeSet<OfficeHierarchyDto>();
for (OfficeHierarchyDto dataScopeBranch : officeParent.getChildren()) {
if (dataScopeBranch.getSearchId().startsWith(loggedInOfficeSearchId) && dataScopeBranch.isActive()) {
branchList.add(dataScopeBranch);
}
}
if (branchList.size() > 0) {
if (i > 0) {
html.singleTag("br");
}
html.startTag("span", "class", "fontnormal");
html.text(officeParent.getOfficeName());
html.endTag("span");
html.startTag("table", "width", "90%", "border", "0", "cellspacing", "0", "cellpadding", "0");
for (OfficeHierarchyDto office : branchList) {
html.startTag("tr", "class", "fontnormal");
bullet(html);
html.startTag("td", "width", "99%");
html.append(getLink(office.getOfficeId(), office.getOfficeName()));
html.endTag("td");
html.endTag("tr");
}
html.endTag("table");
}
}
}
}
use of org.mifos.dto.domain.OfficeHierarchyDto in project head by mifos.
the class OfficeBO method convertToBranchOnlyHierarchyWithParentsOfficeHierarchy.
public static List<OfficeHierarchyDto> convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(List<OfficeBO> branchParents) {
List<OfficeHierarchyDto> hierarchy = new ArrayList<OfficeHierarchyDto>();
for (OfficeBO officeBO : branchParents) {
List<OfficeHierarchyDto> children = new ArrayList<OfficeHierarchyDto>();
Set<OfficeBO> branchOnlyChildren = officeBO.getBranchOnlyChildren();
if (branchOnlyChildren != null && !branchOnlyChildren.isEmpty()) {
children = convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(new ArrayList<OfficeBO>(branchOnlyChildren));
}
OfficeHierarchyDto officeHierarchy = new OfficeHierarchyDto(officeBO.getOfficeId(), officeBO.getOfficeName(), officeBO.getSearchId(), officeBO.isActive(), children);
hierarchy.add(officeHierarchy);
}
return hierarchy;
}
use of org.mifos.dto.domain.OfficeHierarchyDto in project head by mifos.
the class OfficeDaoHibernate method officeHierarchy.
private OfficeHierarchyDto officeHierarchy(OfficeBO office) {
List<OfficeHierarchyDto> childOfficeList = new LinkedList<OfficeHierarchyDto>();
Set<OfficeBO> children = office.getChildren();
for (OfficeBO child : children) {
childOfficeList.add(officeHierarchy(child));
}
Collections.sort(childOfficeList);
OfficeHierarchyDto hierarchy = new OfficeHierarchyDto(office.getOfficeId(), office.getOfficeName().trim(), office.getSearchId(), office.isActive(), childOfficeList);
return hierarchy;
}
use of org.mifos.dto.domain.OfficeHierarchyDto 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);
}
Aggregations