use of org.mifos.customers.client.business.ClientFamilyDetailEntity in project head by mifos.
the class ClientServiceFacadeWebTier method retrieveFamilyInfoForEdit.
@Override
public ClientFamilyInfoDto retrieveFamilyInfoForEdit(String clientGlobalCustNum) {
ClientBO client = this.customerDao.findClientBySystemId(clientGlobalCustNum);
ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
ClientRulesDto clientRules = retrieveClientRules();
CustomerDetailDto customerDetail = client.toCustomerDetailDto();
ClientDetailDto clientDetail = client.toClientDetailDto(clientRules.isFamilyDetailsRequired());
List<ClientNameDetailDto> familyMembers = new ArrayList<ClientNameDetailDto>();
Map<Integer, List<ClientFamilyDetailDto>> clientFamilyDetails = new HashMap<Integer, List<ClientFamilyDetailDto>>();
int familyMemberCount = 0;
for (ClientNameDetailEntity clientNameDetailEntity : client.getNameDetailSet()) {
if (clientNameDetailEntity.isNotClientNameType()) {
ClientNameDetailDto nameView1 = clientNameDetailEntity.toDto();
familyMembers.add(nameView1);
for (ClientFamilyDetailEntity clientFamilyDetailEntity : client.getFamilyDetailSet()) {
if (clientNameDetailEntity.matchesCustomerId(clientFamilyDetailEntity.getClientName().getCustomerNameId())) {
ClientFamilyDetailDto clientFamilyDetail = clientFamilyDetailEntity.toDto();
addFamilyDetailsDtoToMap(clientFamilyDetails, familyMemberCount, clientFamilyDetail);
}
}
familyMemberCount++;
}
}
return new ClientFamilyInfoDto(clientDropdowns, customerDetail, clientDetail, familyMembers, clientFamilyDetails);
}
Aggregations