Search in sources :

Example 1 with ClientDetailDto

use of org.mifos.dto.screen.ClientDetailDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveMfiInfoForEdit.

@Override
public ClientMfiInfoDto retrieveMfiInfoForEdit(String clientSystemId) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
    String groupDisplayName = "";
    String centerDisplayName = "";
    if (client.getParentCustomer() != null) {
        groupDisplayName = client.getParentCustomer().getDisplayName();
        if (client.getParentCustomer().getParentCustomer() != null) {
            centerDisplayName = client.getParentCustomer().getParentCustomer().getDisplayName();
        }
    }
    List<PersonnelDto> loanOfficersList = new ArrayList<PersonnelDto>();
    if (!client.isClientUnderGroup()) {
        CenterCreation centerCreation = new CenterCreation(client.getOffice().getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
        loanOfficersList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
    }
    CustomerDetailDto customerDetail = client.toCustomerDetailDto();
    ClientDetailDto clientDetail = client.toClientDetailDto(ClientRules.isFamilyDetailsRequired());
    return new ClientMfiInfoDto(groupDisplayName, centerDisplayName, loanOfficersList, customerDetail, clientDetail);
}
Also used : UserContext(org.mifos.security.util.UserContext) CenterCreation(org.mifos.dto.domain.CenterCreation) ClientBO(org.mifos.customers.client.business.ClientBO) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) ArrayList(java.util.ArrayList) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) ClientMfiInfoDto(org.mifos.dto.screen.ClientMfiInfoDto)

Example 2 with ClientDetailDto

use of org.mifos.dto.screen.ClientDetailDto 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);
}
Also used : HashMap(java.util.HashMap) ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientNameDetailEntity(org.mifos.customers.client.business.ClientNameDetailEntity) ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ArrayList(java.util.ArrayList) List(java.util.List) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto) ClientFamilyDetailEntity(org.mifos.customers.client.business.ClientFamilyDetailEntity) ClientFamilyInfoDto(org.mifos.dto.screen.ClientFamilyInfoDto)

Example 3 with ClientDetailDto

use of org.mifos.dto.screen.ClientDetailDto in project head by mifos.

the class ClientBO method toClientDetailDto.

public ClientDetailDto toClientDetailDto(boolean isFamilyDetailsRequired) {
    ClientPersonalDetailDto customerDetailView = this.getCustomerDetail().toDto();
    String dateOfBirthAsString = "";
    if (this.dateOfBirth != null) {
        dateOfBirthAsString = DateUtils.makeDateAsSentFromBrowser(this.dateOfBirth);
    }
    List<ClientNameDetailDto> clientNameViews = toClientNameDetailViews();
    ClientNameDetailDto clientName = null;
    ClientNameDetailDto spouseName = null;
    for (ClientNameDetailDto nameView : clientNameViews) {
        if (nameView.getNameType() != null) {
            if (nameView.getNameType().equals(ClientConstants.CLIENT_NAME_TYPE)) {
                clientName = nameView;
            } else if (!isFamilyDetailsRequired) {
                spouseName = nameView;
            }
        } else {
            spouseName = new ClientNameDetailDto();
        }
    }
    boolean groupFlagIsSet = false;
    Integer parentGroupId = Integer.valueOf(0);
    if (isClientUnderGroup()) {
        groupFlagIsSet = true;
        parentGroupId = getParentCustomer().getCustomerId();
    }
    boolean trained = isTrained();
    String trainedDate = "";
    if (getTrainedDate() != null) {
        trainedDate = DateUtils.makeDateAsSentFromBrowser(getTrainedDate());
    }
    return new ClientDetailDto(this.governmentId, dateOfBirthAsString, customerDetailView, clientName, spouseName, groupFlagIsSet, parentGroupId, trained, trainedDate);
}
Also used : ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto)

Example 4 with ClientDetailDto

use of org.mifos.dto.screen.ClientDetailDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveClientPersonalInfoForUpdate.

@Override
public ClientPersonalInfoDto retrieveClientPersonalInfoForUpdate(String clientSystemId, String clientStatus, short loanOfficerId) {
    ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
    ClientRulesDto clientRules = retrieveClientRules();
    ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
    CustomerDetailDto customerDetailDto = client.toCustomerDetailDto();
    ClientDetailDto clientDetailDto = client.toClientDetailDto(clientRules.isFamilyDetailsRequired());
    return new ClientPersonalInfoDto(clientDropdowns, clientRules, customerDetailDto, clientDetailDto);
}
Also used : ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) ClientBO(org.mifos.customers.client.business.ClientBO) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ClientPersonalInfoDto(org.mifos.dto.screen.ClientPersonalInfoDto) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto)

Aggregations

ClientDetailDto (org.mifos.dto.screen.ClientDetailDto)4 ClientBO (org.mifos.customers.client.business.ClientBO)3 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)3 ArrayList (java.util.ArrayList)2 ClientRulesDto (org.mifos.dto.domain.ClientRulesDto)2 ClientDropdownsDto (org.mifos.dto.screen.ClientDropdownsDto)2 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)2 HashMap (java.util.HashMap)1 List (java.util.List)1 ClientFamilyDetailEntity (org.mifos.customers.client.business.ClientFamilyDetailEntity)1 ClientNameDetailEntity (org.mifos.customers.client.business.ClientNameDetailEntity)1 CenterCreation (org.mifos.dto.domain.CenterCreation)1 PersonnelDto (org.mifos.dto.domain.PersonnelDto)1 ClientFamilyDetailDto (org.mifos.dto.screen.ClientFamilyDetailDto)1 ClientFamilyInfoDto (org.mifos.dto.screen.ClientFamilyInfoDto)1 ClientMfiInfoDto (org.mifos.dto.screen.ClientMfiInfoDto)1 ClientPersonalDetailDto (org.mifos.dto.screen.ClientPersonalDetailDto)1 ClientPersonalInfoDto (org.mifos.dto.screen.ClientPersonalInfoDto)1 MifosUser (org.mifos.security.MifosUser)1 UserContext (org.mifos.security.util.UserContext)1