use of org.mifos.dto.screen.ClientNameDetailDto 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);
}
use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class ClientBO method updateFamilyAndNameDetails.
/**
* This method is used to update the Client Family and Name Details
*/
public void updateFamilyAndNameDetails(ClientFamilyInfoUpdate clientFamilyInfoUpdate) {
List<Integer> primaryKeys = clientFamilyInfoUpdate.getFamilyPrimaryKey();
for (int key = 0; key < primaryKeys.size(); key++) {
if (primaryKeys.get(key) != null) {
List<ClientNameDetailDto> clientNameDetailDto = clientFamilyInfoUpdate.getFamilyNames();
for (ClientNameDetailEntity clientNameDetailEntity : getNameDetailSet()) {
if (clientNameDetailEntity.getCustomerNameId().intValue() == primaryKeys.get(key).intValue()) {
ClientNameDetailDto nameView = clientNameDetailDto.get(key);
if (nameView != null) {
clientNameDetailEntity.updateNameDetails(nameView);
// details table.
if (ClientRules.isFamilyDetailsRequired()) {
List<ClientFamilyDetailDto> clientFamilyDetailDto = clientFamilyInfoUpdate.getFamilyDetails();
// familyDetails
for (ClientFamilyDetailDto clientFamilyDetail : clientFamilyDetailDto) {
if (familyDetailsDoesNotAlreadyContain(clientNameDetailEntity.getCustomerNameId())) {
ClientFamilyDetailEntity clientFamilyEntity = new ClientFamilyDetailEntity(this, clientNameDetailEntity, clientFamilyDetail);
familyDetailSet.add(clientFamilyEntity);
}
}
}
}
}
List<ClientFamilyDetailDto> clientFamilyDetailDto = clientFamilyInfoUpdate.getFamilyDetails();
for (ClientFamilyDetailEntity clientFamilyDetailEntity : familyDetailSet) {
if (clientFamilyDetailEntity.getClientName().getCustomerNameId().intValue() == primaryKeys.get(key).intValue()) {
clientFamilyDetailEntity.updateClientFamilyDetails(clientFamilyDetailDto.get(key));
}
}
}
}
}
}
use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class ClientBO method setFamilyAndNameDetailSets.
public void setFamilyAndNameDetailSets(final List<ClientNameDetailDto> familyNameDetailView, final List<ClientFamilyDetailDto> familyDetailView) {
Iterator<ClientFamilyDetailDto> iterator2 = familyDetailView.iterator();
familyDetailSet = new HashSet<ClientFamilyDetailEntity>();
for (Object element : familyNameDetailView) {
ClientNameDetailDto clientNameDetailView2 = (ClientNameDetailDto) element;
ClientFamilyDetailDto clientFamilyDetailView2 = iterator2.next();
ClientNameDetailEntity nameEntity = new ClientNameDetailEntity(this, null, clientNameDetailView2);
this.addNameDetailSet(nameEntity);
this.addFamilyDetailSet(new ClientFamilyDetailEntity(this, nameEntity, clientFamilyDetailView2));
}
}
use of org.mifos.dto.screen.ClientNameDetailDto in project head by mifos.
the class ClientBO method updatePersonalInfo.
public void updatePersonalInfo(ClientPersonalInfoUpdate personalInfo) throws CustomerException {
this.governmentId = personalInfo.getGovernmentId();
try {
setDateOfBirth(DateUtils.getDateAsSentFromBrowser(personalInfo.getDateOfBirth()));
} catch (InvalidDateException e) {
throw new CustomerException(ClientConstants.INVALID_DOB_EXCEPTION);
}
ClientNameDetailDto clientName = personalInfo.getClientNameDetails();
this.getClientName().updateNameDetails(clientName);
this.firstName = clientName.getFirstName();
this.lastName = clientName.getLastName();
this.secondLastName = clientName.getSecondLastName();
if (personalInfo.getSpouseFather() != null) {
// can be null when family details configuration is turned on
if (this.getSpouseName() != null) {
this.getSpouseName().updateNameDetails(personalInfo.getSpouseFather());
} else {
ClientNameDetailEntity spouseFatherNameDetailEntity = new ClientNameDetailEntity(this, personalInfo.getSpouseFather().getSecondLastName(), personalInfo.getSpouseFather());
addNameDetailSet(spouseFatherNameDetailEntity);
}
}
this.updateClientDetails(personalInfo.getClientDetail());
setDisplayName(personalInfo.getClientDisplayName());
Address address = null;
if (personalInfo.getAddress() != null) {
;
}
{
address = new Address(personalInfo.getAddress().getLine1(), personalInfo.getAddress().getLine2(), personalInfo.getAddress().getLine3(), personalInfo.getAddress().getCity(), personalInfo.getAddress().getState(), personalInfo.getAddress().getCountry(), personalInfo.getAddress().getZip(), personalInfo.getAddress().getPhoneNumber());
updateAddress(address);
}
}
use of org.mifos.dto.screen.ClientNameDetailDto 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);
}
Aggregations