use of org.mifos.customers.checklist.business.CustomerCheckListBO in project head by mifos.
the class ChkListAction method update.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ChkListActionForm chkListActionForm = (ChkListActionForm) form;
Short stateId = getShortValue(chkListActionForm.getStateId());
String checklistName = chkListActionForm.getChecklistName();
Short checklistStatus = getShortValue(chkListActionForm.getChecklistStatus());
List<String> details = chkListActionForm.getValidCheckListDetails();
if (chkListActionForm.getIsCustomer()) {
CustomerCheckListBO customerCheckList = (CustomerCheckListBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
Short levelId = getShortValue(chkListActionForm.getMasterTypeId());
this.checkListServiceFacade.updateCustomerChecklist(customerCheckList.getChecklistId(), levelId, stateId, checklistStatus, checklistName, details);
} else {
AccountCheckListBO accountCheckList = (AccountCheckListBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
Short productId = getShortValue(chkListActionForm.getMasterTypeId());
this.checkListServiceFacade.updateAccountChecklist(accountCheckList.getChecklistId(), productId, stateId, checklistStatus, checklistName, details);
}
return mapping.findForward(ActionForwards.update_success.toString());
}
use of org.mifos.customers.checklist.business.CustomerCheckListBO in project head by mifos.
the class ChkListAction method manage.
@TransactionDemarcate(joinToken = true)
public ActionForward manage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ChkListActionForm chkListActionForm = (ChkListActionForm) form;
Short checklistId = getShortValue(chkListActionForm.getCheckListId());
CheckListBO checkList = new CheckListPersistence().getCheckList(checklistId);
if (checkList.getCheckListType().equals(CheckListType.CUSTOMER_CHECKLIST)) {
chkListActionForm.setCheckListId(getStringValue(checkList.getChecklistId()));
chkListActionForm.setChecklistName(checkList.getChecklistName());
if (checkList.getCheckListType().equals(CheckListType.CUSTOMER_CHECKLIST)) {
chkListActionForm.setMasterTypeId(getStringValue(((CustomerCheckListBO) checkList).getCustomerLevel().getId()));
if (chkListActionForm.getMasterTypeId().equals(getStringValue(CustomerLevel.CENTER.getValue()))) {
chkListActionForm.setType("0");
chkListActionForm.setMasterTypeName(ConfigurationConstants.CENTER);
} else if (chkListActionForm.getMasterTypeId().equals(getStringValue(CustomerLevel.GROUP.getValue()))) {
chkListActionForm.setType("1");
chkListActionForm.setMasterTypeName(ConfigurationConstants.GROUP);
} else if (chkListActionForm.getMasterTypeId().equals(getStringValue(CustomerLevel.CLIENT.getValue()))) {
chkListActionForm.setType("2");
chkListActionForm.setMasterTypeName(ConfigurationConstants.CLIENT);
}
chkListActionForm.setStateName(((CustomerCheckListBO) checkList).getCustomerStatus().getName());
chkListActionForm.setStateId(getStringValue(((CustomerCheckListBO) checkList).getCustomerStatus().getId()));
chkListActionForm.setIsCustomer(true);
} else {
chkListActionForm.setMasterTypeId(getStringValue(((AccountCheckListBO) checkList).getProductTypeEntity().getProductTypeID()));
if (chkListActionForm.getMasterTypeId().equals(getStringValue(ProductType.LOAN.getValue()))) {
chkListActionForm.setType("3");
} else {
chkListActionForm.setType("4");
}
chkListActionForm.setMasterTypeName(((AccountCheckListBO) checkList).getProductTypeEntity().getName());
chkListActionForm.setStateName(((AccountCheckListBO) checkList).getAccountStateEntity().getName());
chkListActionForm.setStateId(getStringValue(((AccountCheckListBO) checkList).getAccountStateEntity().getId()));
chkListActionForm.setIsCustomer(false);
}
if (checkList.getChecklistStatus().equals(CheckListConstants.STATUS_ACTIVE)) {
chkListActionForm.setChecklistStatus(getStringValue(CheckListConstants.STATUS_ACTIVE));
} else {
chkListActionForm.setChecklistStatus(getStringValue(CheckListConstants.STATUS_INACTIVE));
}
List<String> details1 = new ArrayList<String>();
for (CheckListDetailEntity checkListDetailEntity : checkList.getChecklistDetails()) {
details1.add(checkListDetailEntity.getDetailText());
}
chkListActionForm.setDetailsList(details1);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, checkList, request);
SessionUtils.setAttribute(CheckListConstants.TYPE, CheckListType.CUSTOMER_CHECKLIST.getValue(), request);
} else {
chkListActionForm.setCheckListId(getStringValue(checkList.getChecklistId()));
chkListActionForm.setChecklistName(checkList.getChecklistName());
if (checkList.getCheckListType().equals(CheckListType.CUSTOMER_CHECKLIST)) {
chkListActionForm.setMasterTypeId(getStringValue(((CustomerCheckListBO) checkList).getCustomerLevel().getId()));
if (chkListActionForm.getMasterTypeId().equals(getStringValue(CustomerLevel.CENTER.getValue()))) {
chkListActionForm.setType("0");
chkListActionForm.setMasterTypeName(ConfigurationConstants.CENTER);
} else if (chkListActionForm.getMasterTypeId().equals(getStringValue(CustomerLevel.GROUP.getValue()))) {
chkListActionForm.setType("1");
chkListActionForm.setMasterTypeName(ConfigurationConstants.GROUP);
} else if (chkListActionForm.getMasterTypeId().equals(getStringValue(CustomerLevel.CLIENT.getValue()))) {
chkListActionForm.setType("2");
chkListActionForm.setMasterTypeName(ConfigurationConstants.CLIENT);
}
chkListActionForm.setStateName(((CustomerCheckListBO) checkList).getCustomerStatus().getName());
chkListActionForm.setStateId(getStringValue(((CustomerCheckListBO) checkList).getCustomerStatus().getId()));
chkListActionForm.setIsCustomer(true);
} else {
chkListActionForm.setMasterTypeId(getStringValue(((AccountCheckListBO) checkList).getProductTypeEntity().getProductTypeID()));
if (chkListActionForm.getMasterTypeId().equals(getStringValue(ProductType.LOAN.getValue()))) {
chkListActionForm.setType("3");
} else {
chkListActionForm.setType("4");
}
chkListActionForm.setMasterTypeName(((AccountCheckListBO) checkList).getProductTypeEntity().getName());
chkListActionForm.setStateName(((AccountCheckListBO) checkList).getAccountStateEntity().getName());
chkListActionForm.setStateId(getStringValue(((AccountCheckListBO) checkList).getAccountStateEntity().getId()));
chkListActionForm.setIsCustomer(false);
}
if (checkList.getChecklistStatus().equals(CheckListConstants.STATUS_ACTIVE)) {
chkListActionForm.setChecklistStatus(getStringValue(CheckListConstants.STATUS_ACTIVE));
} else {
chkListActionForm.setChecklistStatus(getStringValue(CheckListConstants.STATUS_INACTIVE));
}
List<String> details1 = new ArrayList<String>();
for (CheckListDetailEntity checkListDetailEntity : checkList.getChecklistDetails()) {
details1.add(checkListDetailEntity.getDetailText());
}
chkListActionForm.setDetailsList(details1);
SessionUtils.setAttribute(Constants.BUSINESS_KEY, checkList, request);
SessionUtils.setAttribute(CheckListConstants.TYPE, CheckListType.ACCOUNT_CHECKLIST.getValue(), request);
}
List<CheckListMasterDto> masterData = this.checkListServiceFacade.retrieveChecklistMasterData();
SessionUtils.setCollectionAttribute(CheckListConstants.CHECKLIST_MASTERDATA, masterData, request);
List<CheckListStatesView> states = retrieveStates(chkListActionForm.getIsCustomer(), chkListActionForm.getMasterTypeId());
deleteExistingStates(states, chkListActionForm.getIsCustomer(), chkListActionForm.getMasterTypeId(), Short.parseShort(chkListActionForm.getStateId()));
SessionUtils.setCollectionAttribute(CheckListConstants.STATES, states, request);
List<String> details = chkListActionForm.getValidCheckListDetails();
SessionUtils.setCollectionAttribute(CheckListConstants.DETAILS, details, request);
SessionUtils.setAttribute(CheckListConstants.OLDCHECKLISTNAME, checkList.getChecklistName(), request);
return mapping.findForward(ActionForwards.manage_success.toString());
}
use of org.mifos.customers.checklist.business.CustomerCheckListBO in project head by mifos.
the class EditCustomerStatusAction method previewStatus.
@TransactionDemarcate(joinToken = true)
public ActionForward previewStatus(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In EditCustomerStatusAction:preview()");
CustomerBO customerBO = (CustomerBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
EditCustomerStatusActionForm statusActionForm = (EditCustomerStatusActionForm) form;
statusActionForm.setCommentDate(DateUtils.getCurrentDate(getUserContext(request).getPreferredLocale()));
if (StringUtils.isNotBlank(statusActionForm.getNewStatusId())) {
CustomerStatusDetailDto customerStatusDetail = this.centerServiceFacade.retrieveCustomerStatusDetails(statusActionForm.getNewStatusIdValue(), statusActionForm.getFlagIdValue(), customerBO.getLevel().getValue());
SessionUtils.setAttribute(SavingsConstants.NEW_STATUS_NAME, customerStatusDetail.getStatusName(), request);
SessionUtils.setAttribute(SavingsConstants.FLAG_NAME, customerStatusDetail.getFlagName(), request);
} else {
SessionUtils.setAttribute(SavingsConstants.NEW_STATUS_NAME, null, request);
SessionUtils.setAttribute(SavingsConstants.FLAG_NAME, null, request);
}
Short newStatusId = statusActionForm.getNewStatusIdValue();
Short customerLevelId = statusActionForm.getLevelIdValue();
List<CustomerCheckListBO> checklist = new CustomerPersistence().getStatusChecklist(newStatusId, customerLevelId);
SessionUtils.setCollectionAttribute(SavingsConstants.STATUS_CHECK_LIST, checklist, request);
if (statusActionForm.getNewStatusIdValue().equals(CustomerStatus.CLIENT_CLOSED.getValue())) {
return createClientQuestionnaire.fetchAppliedQuestions(mapping, statusActionForm, request, ActionForwards.previewStatus_success);
}
return mapping.findForward(ActionForwards.previewStatus_success.toString());
}
use of org.mifos.customers.checklist.business.CustomerCheckListBO in project head by mifos.
the class CustomerPersistenceIntegrationTest method testGetCustomerChecklist.
@Test
public void testGetCustomerChecklist() throws NumberFormatException, SystemException, ApplicationException, Exception {
center = createCenter("center");
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
client = TestObjectFactory.createClient("client1", CustomerStatus.CLIENT_ACTIVE, group);
CustomerCheckListBO checklistCenter = TestObjectFactory.createCustomerChecklist(center.getCustomerLevel().getId(), center.getCustomerStatus().getId(), CheckListConstants.STATUS_ACTIVE);
CustomerCheckListBO checklistClient = TestObjectFactory.createCustomerChecklist(client.getCustomerLevel().getId(), client.getCustomerStatus().getId(), CheckListConstants.STATUS_INACTIVE);
CustomerCheckListBO checklistGroup = TestObjectFactory.createCustomerChecklist(group.getCustomerLevel().getId(), group.getCustomerStatus().getId(), CheckListConstants.STATUS_ACTIVE);
Assert.assertEquals(1, customerPersistence.getStatusChecklist(center.getCustomerStatus().getId(), center.getCustomerLevel().getId()).size());
client = (ClientBO) StaticHibernateUtil.getSessionTL().get(ClientBO.class, Integer.valueOf(client.getCustomerId()));
group = (GroupBO) StaticHibernateUtil.getSessionTL().get(GroupBO.class, Integer.valueOf(group.getCustomerId()));
center = (CenterBO) StaticHibernateUtil.getSessionTL().get(CenterBO.class, Integer.valueOf(center.getCustomerId()));
checklistCenter = (CustomerCheckListBO) StaticHibernateUtil.getSessionTL().get(CheckListBO.class, new Short(checklistCenter.getChecklistId()));
checklistClient = (CustomerCheckListBO) StaticHibernateUtil.getSessionTL().get(CheckListBO.class, new Short(checklistClient.getChecklistId()));
checklistGroup = (CustomerCheckListBO) StaticHibernateUtil.getSessionTL().get(CheckListBO.class, new Short(checklistGroup.getChecklistId()));
}
use of org.mifos.customers.checklist.business.CustomerCheckListBO in project head by mifos.
the class IntegrationTestObjectMother method createCustomerChecklist.
public static CustomerCheckListBO createCustomerChecklist(Short customerLevel, Short customerStatus, Short checklistStatus, List<String> details) {
try {
StaticHibernateUtil.startTransaction();
CustomerLevelEntity customerLevelEntity = new CustomerLevelEntity(CustomerLevel.getLevel(customerLevel));
CustomerStatusEntity customerStatusEntity = new CustomerStatusEntity(CustomerStatus.fromInt(customerStatus));
CustomerCheckListBO customerChecklist = new CustomerCheckListBO(customerLevelEntity, customerStatusEntity, "productchecklist", checklistStatus, details, Short.valueOf("1"), PersonnelConstants.SYSTEM_USER);
customerDao.save(customerChecklist);
StaticHibernateUtil.commitTransaction();
return customerChecklist;
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
throw new RuntimeException(e);
} finally {
StaticHibernateUtil.closeSession();
}
}
Aggregations