use of org.mifos.dto.domain.OfficeDto in project head by mifos.
the class OfficeServiceFacadeWebTier method divisionalOffices.
private List<OfficeDto> divisionalOffices(List<OfficeDto> allOffices) {
List<OfficeDto> divisionalOffices = new ArrayList<OfficeDto>();
for (OfficeDto officeDto : allOffices) {
if (OfficeLevel.SUBREGIONALOFFICE.getValue().equals(officeDto.getLevelId())) {
divisionalOffices.add(officeDto);
}
}
// sort branch offices by parent due to UI dependency on this.
Collections.sort(divisionalOffices, new Comparator<OfficeDto>() {
@Override
public int compare(OfficeDto first, OfficeDto next) {
return first.getParentId().compareTo(next.getParentId());
}
});
return divisionalOffices;
}
use of org.mifos.dto.domain.OfficeDto in project head by mifos.
the class OfficeServiceFacadeWebTier method retrieveAllNonBranchOfficesApplicableToLoggedInUser.
@Override
public List<OfficeDto> retrieveAllNonBranchOfficesApplicableToLoggedInUser() {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
OfficeDto office = officeDao.findOfficeDtoById(user.getBranchId());
return officeDao.findNonBranchesOnlyWithParentsMatching(office.getSearchId());
}
use of org.mifos.dto.domain.OfficeDto in project head by mifos.
the class OfficeServiceFacadeWebTier method retrieveActiveBranchesUnderUser.
@Override
public List<OfficeDto> retrieveActiveBranchesUnderUser(Short userId) {
PersonnelBO personnel = personnelDao.findPersonnelById(userId);
try {
List<OfficeBO> officesListBO = new OfficePersistence().getActiveBranchesUnderUser(personnel.getOfficeSearchId());
List<OfficeDto> officesList = new ArrayList<OfficeDto>();
for (OfficeBO officeBO : officesListBO) {
OfficeDto officeDto = new OfficeDto(officeBO.getOfficeId(), officeBO.getOfficeName(), officeBO.getSearchId(), officeBO.getShortName(), officeBO.getGlobalOfficeNum(), officeBO.getParentOffice().getOfficeId(), officeBO.getStatus().getId(), officeBO.getLevel().getId());
officesList.add(officeDto);
}
return officesList;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.domain.OfficeDto in project head by mifos.
the class OfficeServiceFacadeWebTier method regionalOfficeSpecification.
private List<OfficeDto> regionalOfficeSpecification(List<OfficeDto> allOffices) {
List<OfficeDto> regionalOffices = new ArrayList<OfficeDto>();
for (OfficeDto officeDto : allOffices) {
if (OfficeLevel.REGIONALOFFICE.getValue().equals(officeDto.getLevelId())) {
regionalOffices.add(officeDto);
}
}
// sort branch offices by parent due to UI dependency on this.
Collections.sort(regionalOffices, new Comparator<OfficeDto>() {
@Override
public int compare(OfficeDto first, OfficeDto next) {
return first.getParentId().compareTo(next.getParentId());
}
});
return regionalOffices;
}
use of org.mifos.dto.domain.OfficeDto in project head by mifos.
the class OfficeServiceFacadeWebTier method areaOffices.
private List<OfficeDto> areaOffices(List<OfficeDto> allOffices) {
List<OfficeDto> areaOffices = new ArrayList<OfficeDto>();
for (OfficeDto officeDto : allOffices) {
if (OfficeLevel.AREAOFFICE.getValue().equals(officeDto.getLevelId())) {
areaOffices.add(officeDto);
}
}
// sort branch offices by parent due to UI dependency on this.
Collections.sort(areaOffices, new Comparator<OfficeDto>() {
@Override
public int compare(OfficeDto first, OfficeDto next) {
return first.getParentId().compareTo(next.getParentId());
}
});
return areaOffices;
}
Aggregations