use of org.mifos.dto.domain.CheckListMasterDto in project head by mifos.
the class CheckListServiceFacadeWebTier method retrieveChecklistMasterData.
@Override
public List<CheckListMasterDto> retrieveChecklistMasterData() {
try {
Short localeIdNotUsed = null;
List<CheckListMasterDto> masterData = new CheckListPersistence().getCheckListMasterData(localeIdNotUsed);
for (CheckListMasterDto checkListMasterDto : masterData) {
if (checkListMasterDto.isCustomer()) {
checkListMasterDto.setMasterTypeName(ApplicationContextProvider.getBean(MessageLookup.class).lookupLabel(checkListMasterDto.getLookupKey()));
} else {
checkListMasterDto.setMasterTypeName(ApplicationContextProvider.getBean(MessageLookup.class).lookup(checkListMasterDto.getLookupKey()));
}
}
return masterData;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.domain.CheckListMasterDto 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.dto.domain.CheckListMasterDto in project head by mifos.
the class CheckListPersistence method getCheckListMasterData.
@SuppressWarnings("unchecked")
public List<CheckListMasterDto> getCheckListMasterData(Short localeId) throws PersistenceException {
List<CheckListMasterDto> checkListMaster = new ArrayList<CheckListMasterDto>();
List<CheckListMasterDto> masterData = new ArrayList<CheckListMasterDto>();
HashMap<String, Object> queryParameters = new HashMap<String, Object>();
masterData = executeNamedQuery(NamedQueryConstants.MASTERDATA_CUSTOMER_CHECKLIST, queryParameters);
for (CheckListMasterDto checkListMasterDataView : masterData) {
checkListMasterDataView.setCustomer(true);
}
checkListMaster.addAll(masterData);
masterData = executeNamedQuery(NamedQueryConstants.MASTERDATA_PRODUCT_CHECKLIST, queryParameters);
for (CheckListMasterDto checkListMasterDataView : masterData) {
checkListMasterDataView.setCustomer(false);
}
checkListMaster.addAll(masterData);
masterData = null;
return checkListMaster;
}
use of org.mifos.dto.domain.CheckListMasterDto in project head by mifos.
the class CheckListPersistenceIntegrationTest method testCheckListMasterView.
@Test
public void testCheckListMasterView() {
CheckListMasterDto checkListMasterDto = new CheckListMasterDto(Short.valueOf("1"), "Loan");
checkListMasterDto.setCustomer(true);
Assert.assertEquals(Short.valueOf("1"), checkListMasterDto.getMasterTypeId());
// Assert.assertEquals("Loan", checkListMasterDto.getMasterTypeName());
Assert.assertEquals(true, checkListMasterDto.isCustomer());
}
Aggregations