use of org.mifos.dto.domain.CenterDto 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.CenterDto in project head by mifos.
the class CenterCustAction method manage.
// NOTE edit center details
@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
CenterCustActionForm actionForm = (CenterCustActionForm) form;
actionForm.clearActionFormFields();
CenterBO center = (CenterBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
final Integer centerId = center.getCustomerId();
center = this.customerDao.findCenterBySystemId(center.getGlobalCustNum());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, null, request);
CenterDto centerDto = this.centerServiceFacade.retrieveCenterDetailsForUpdate(centerId);
actionForm.setLoanOfficerId(centerDto.getLoanOfficerIdAsString());
actionForm.setCustomerId(centerDto.getCustomerIdAsString());
actionForm.setGlobalCustNum(centerDto.getGlobalCustNum());
actionForm.setExternalId(centerDto.getExternalId());
actionForm.setMfiJoiningDate(centerDto.getMfiJoiningDateAsString());
actionForm.setMfiJoiningDate(centerDto.getMfiJoiningDate().getDayOfMonth(), centerDto.getMfiJoiningDate().getMonthOfYear(), centerDto.getMfiJoiningDate().getYear());
actionForm.setAddress(center.getAddress());
actionForm.setCustomerPositions(centerDto.getCustomerPositionViews());
actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, center, request);
SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, centerDto.getActiveLoanOfficersForBranch(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.POSITIONS, centerDto.getCustomerPositionViews(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CLIENT_LIST, centerDto.getClientList(), request);
return mapping.findForward(ActionForwards.manage_success.toString());
}
use of org.mifos.dto.domain.CenterDto in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveCenterDetailsForUpdate.
@Override
public CenterDto retrieveCenterDetailsForUpdate(Integer centerId) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
CustomerBO center = customerDao.findCustomerById(centerId);
Short officeId = center.getOffice().getOfficeId();
String searchId = center.getSearchId();
Short loanOfficerId = extractLoanOfficerId(center);
CenterCreation centerCreation = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
List<PersonnelDto> activeLoanOfficersForBranch = personnelDao.findActiveLoanOfficersForOffice(centerCreation);
List<CustomerDto> customerList = customerDao.findClientsThatAreNotCancelledOrClosed(searchId, officeId);
List<CustomerPositionDto> customerPositionDtos = generateCustomerPositionViews(center, userContext.getLocaleId());
DateTime mfiJoiningDate = new DateTime();
String mfiJoiningDateAsString = "";
if (center.getMfiJoiningDate() != null) {
mfiJoiningDate = new DateTime(center.getMfiJoiningDate());
mfiJoiningDateAsString = DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), center.getMfiJoiningDate().toString());
}
AddressDto address = null;
if (center.getAddress() != null) {
address = Address.toDto(center.getAddress());
}
return new CenterDto(loanOfficerId, center.getCustomerId(), center.getGlobalCustNum(), mfiJoiningDate, mfiJoiningDateAsString, center.getExternalId(), address, customerPositionDtos, customerList, activeLoanOfficersForBranch, true);
}
use of org.mifos.dto.domain.CenterDto in project head by mifos.
the class GroupCustAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupCustActionForm actionForm = (GroupCustActionForm) form;
actionForm.cleanForm();
// FIXME - store group identifier (id, globalCustNum) instead of entire business object
GroupBO group = (GroupBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
group = this.customerDao.findGroupBySystemId(group.getGlobalCustNum());
logger.debug("Entering GroupCustAction manage method and customer id: " + group.getGlobalCustNum());
CenterDto groupDto = this.groupServiceFacade.retrieveGroupDetailsForUpdate(group.getGlobalCustNum());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, group, request);
SessionUtils.setCollectionAttribute(CustomerConstants.LOAN_OFFICER_LIST, groupDto.getActiveLoanOfficersForBranch(), request);
SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, groupDto.isCenterHierarchyExists(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.POSITIONS, groupDto.getCustomerPositionViews(), request);
SessionUtils.setCollectionAttribute(CustomerConstants.CLIENT_LIST, groupDto.getClientList(), request);
actionForm.setLoanOfficerId(String.valueOf(group.getLoanOfficerId()));
actionForm.setDisplayName(group.getDisplayName());
actionForm.setCustomerId(group.getCustomerId().toString());
actionForm.setGlobalCustNum(group.getGlobalCustNum());
actionForm.setExternalId(group.getExternalId());
actionForm.setAddress(group.getAddress());
actionForm.setCustomerPositions(groupDto.getCustomerPositionViews());
actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
if (group.isTrained()) {
actionForm.setTrained(GroupConstants.TRAINED);
} else {
actionForm.setTrained(GroupConstants.NOT_TRAINED);
}
if (group.getTrainedDate() != null) {
actionForm.setTrainedDate(DateUtils.getUserLocaleDate(getUserContext(request).getPreferredLocale(), group.getTrainedDate().toString()));
}
logger.debug("Exiting GroupCustAction manage method ");
return mapping.findForward(ActionForwards.manage_success.toString());
}
Aggregations