use of org.mifos.dto.domain.CustomerPositionDto in project head by mifos.
the class CenterServiceFacadeWebTier method generatePositionsFromExistingCustomerPositions.
private void generatePositionsFromExistingCustomerPositions(CustomerBO customer, List<PositionEntity> customerPositions, List<CustomerPositionDto> customerPositionDtos) {
for (PositionEntity position : customerPositions) {
for (CustomerPositionEntity entity : customer.getCustomerPositions()) {
if (position.getId().equals(entity.getPosition().getId())) {
CustomerPositionDto customerPosition;
if (entity.getCustomer() != null) {
customerPosition = new CustomerPositionDto(entity.getCustomer().getCustomerId(), entity.getPosition().getId(), entity.getPosition().getName());
} else {
customerPosition = new CustomerPositionDto(customer.getCustomerId(), entity.getPosition().getId(), entity.getPosition().getName());
}
customerPositionDtos.add(customerPosition);
}
}
}
}
use of org.mifos.dto.domain.CustomerPositionDto in project head by mifos.
the class GroupCustActionForm method cleanForm.
public void cleanForm() {
setDefaultFees(new ArrayList<ApplicableAccountFeeDto>());
setAdditionalFees(new ArrayList<ApplicableAccountFeeDto>());
setCustomerPositions(new ArrayList<CustomerPositionDto>());
setCustomFields(new ArrayList<CustomFieldDto>());
setAddress(new Address());
setDisplayName(null);
setMfiJoiningDate(null);
setGlobalCustNum(null);
setCustomerId(null);
setExternalId(null);
setLoanOfficerId(null);
setTrained(null);
setTrainedDate(null);
setFormedByPersonnel(null);
setQuestionGroups(null);
}
use of org.mifos.dto.domain.CustomerPositionDto in project head by mifos.
the class GroupServiceFacadeWebTier method retrieveGroupDetailsForUpdate.
@Override
public CenterDto retrieveGroupDetailsForUpdate(String globalCustNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
List<PersonnelDto> activeLoanOfficersForBranch = new ArrayList<PersonnelDto>();
GroupBO group = this.customerDao.findGroupBySystemId(globalCustNum);
Short officeId = group.getOffice().getOfficeId();
String searchId = group.getSearchId();
Short loanOfficerId = extractLoanOfficerId(group);
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
if (!isCenterHierarchyExists) {
CenterCreation centerCreation = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
activeLoanOfficersForBranch = personnelDao.findActiveLoanOfficersForOffice(centerCreation);
}
List<CustomerDto> customerList = customerDao.findClientsThatAreNotCancelledOrClosed(searchId, officeId);
List<CustomerPositionDto> customerPositionDtos = generateCustomerPositionViews(group, userContext.getLocaleId());
DateTime mfiJoiningDate = new DateTime();
String mfiJoiningDateAsString = "";
if (group.getMfiJoiningDate() != null) {
mfiJoiningDate = new DateTime(group.getMfiJoiningDate());
mfiJoiningDateAsString = DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), group.getMfiJoiningDate().toString());
}
AddressDto address = null;
if (group.getAddress() != null) {
address = Address.toDto(group.getAddress());
}
return new CenterDto(loanOfficerId, group.getCustomerId(), group.getGlobalCustNum(), mfiJoiningDate, mfiJoiningDateAsString, group.getExternalId(), address, customerPositionDtos, customerList, activeLoanOfficersForBranch, isCenterHierarchyExists);
}
use of org.mifos.dto.domain.CustomerPositionDto in project head by mifos.
the class CenterCustActionForm method clearActionFormFields.
public void clearActionFormFields() {
setDefaultFees(new ArrayList<ApplicableAccountFeeDto>());
setAdditionalFees(new ArrayList<ApplicableAccountFeeDto>());
setCustomerPositions(new ArrayList<CustomerPositionDto>());
setCustomFields(new ArrayList<CustomFieldDto>());
setAddress(new Address());
setDisplayName(null);
setMfiJoiningDate(null);
setGlobalCustNum(null);
setCustomerId(null);
setExternalId(null);
setLoanOfficerId(null);
setQuestionGroups(null);
}
use of org.mifos.dto.domain.CustomerPositionDto in project head by mifos.
the class CenterUpdateUsingCustomerServiceIntegrationTest method canUpdateCenterWithDifferentLoanOfficer.
@Test
public void canUpdateCenterWithDifferentLoanOfficer() throws Exception {
// setup
String externalId = center.getExternalId();
String mfiJoiningDate = new SimpleDateFormat("dd/MM/yyyy").format(center.getMfiJoiningDate());
AddressDto address = null;
if (center.getAddress() != null) {
address = Address.toDto(center.getAddress());
}
List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
List<CustomerPositionDto> customerPositions = new ArrayList<CustomerPositionDto>();
UserContext userContext = TestUtils.makeUser();
otherLoanOfficer.setPreferredLocale(userContext.getLocaleId());
IntegrationTestObjectMother.createPersonnel(otherLoanOfficer);
String updatedDisplayName = "Center " + RandomStringUtils.randomAlphanumeric(5);
CenterUpdate centerUpdate = new CenterUpdate(center.getCustomerId(), updatedDisplayName, center.getVersionNo(), otherLoanOfficer.getPersonnelId(), externalId, mfiJoiningDate, address, customFields, customerPositions);
// exercise test
customerService.updateCenter(userContext, centerUpdate);
// verification
center = customerDao.findCenterBySystemId(center.getGlobalCustNum());
assertThat(center.getPersonnel().getDisplayName(), is(otherLoanOfficer.getDisplayName()));
}
Aggregations