in service/src/main/java/org/apache/fineract/cn/office/internal/service/OfficeService.java [155:174]
public List<Office> extractOfficeEntities(final Page<OfficeEntity> officeEntityPage, final String parentIdentifier) {
final List<Office> offices = new ArrayList<>(officeEntityPage.getSize());
officeEntityPage.forEach(officeEntity -> {
final Office office = OfficeMapper.map(officeEntity);
if (parentIdentifier != null) {
office.setParentIdentifier(parentIdentifier);
}
offices.add(office);
final Optional<AddressEntity> addressEntityOptional = this.addressRepository.findByOffice(officeEntity);
addressEntityOptional.ifPresent(addressEntity -> office.setAddress(AddressMapper.map(addressEntity)));
office.setExternalReferences(
this.branchExists(office.getIdentifier())
|| this.hasEmployees(office.getIdentifier())
|| this.hasExternalReferences(office.getIdentifier())
);
});
return offices;
}