Search in sources :

Example 1 with CheckListStatesView

use of org.mifos.dto.screen.CheckListStatesView 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());
}
Also used : CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) CheckListStatesView(org.mifos.dto.screen.CheckListStatesView) ChkListActionForm(org.mifos.customers.checklist.struts.actionforms.ChkListActionForm) ArrayList(java.util.ArrayList) CheckListDetailEntity(org.mifos.customers.checklist.business.CheckListDetailEntity) CheckListMasterDto(org.mifos.dto.domain.CheckListMasterDto) CheckListPersistence(org.mifos.customers.checklist.persistence.CheckListPersistence) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) CheckListBO(org.mifos.customers.checklist.business.CheckListBO) CustomerCheckListBO(org.mifos.customers.checklist.business.CustomerCheckListBO) AccountCheckListBO(org.mifos.customers.checklist.business.AccountCheckListBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with CheckListStatesView

use of org.mifos.dto.screen.CheckListStatesView in project head by mifos.

the class ChkListAction method getEditStates.

@TransactionDemarcate(joinToken = true)
public ActionForward getEditStates(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ChkListActionForm chkListActionForm = (ChkListActionForm) form;
    List<String> details = chkListActionForm.getValidCheckListDetails();
    List<CheckListStatesView> states = retrieveStates(chkListActionForm.getIsCustomer(), chkListActionForm.getMasterTypeId());
    SessionUtils.setCollectionAttribute(CheckListConstants.STATES, states, request);
    SessionUtils.setCollectionAttribute(CheckListConstants.DETAILS, details, request);
    return mapping.findForward(ActionForwards.manage_success.toString());
}
Also used : CheckListStatesView(org.mifos.dto.screen.CheckListStatesView) ChkListActionForm(org.mifos.customers.checklist.struts.actionforms.ChkListActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with CheckListStatesView

use of org.mifos.dto.screen.CheckListStatesView in project head by mifos.

the class CheckListPersistence method retrieveAllAccountStateList.

@SuppressWarnings("unchecked")
public List<CheckListStatesView> retrieveAllAccountStateList(Short prdTypeId, Short localeId) throws PersistenceException {
    List<CheckListStatesView> checkListStatesView = new ArrayList<CheckListStatesView>();
    HashMap<String, Object> queryParameters = new HashMap<String, Object>();
    queryParameters.put("prdTypeId", prdTypeId);
    List<AccountStateEntity> queryResult = executeNamedQuery(NamedQueryConstants.CHECKLIST_GET_VALID_ACCOUNT_STATES, queryParameters);
    for (AccountStateEntity accountStatus : queryResult) {
        checkListStatesView.add(new CheckListStatesView(accountStatus.getId(), accountStatus.getName(), accountStatus.getPrdType().getProductTypeID()));
    }
    return checkListStatesView;
}
Also used : CheckListStatesView(org.mifos.dto.screen.CheckListStatesView) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity)

Example 4 with CheckListStatesView

use of org.mifos.dto.screen.CheckListStatesView in project head by mifos.

the class CheckListPersistence method retrieveAllCustomerStatusList.

@SuppressWarnings("unchecked")
public List<CheckListStatesView> retrieveAllCustomerStatusList(Short levelId, Short localeId) throws PersistenceException {
    List<CheckListStatesView> checkListStatesView = new ArrayList<CheckListStatesView>();
    Map<String, Object> queryParameters = new HashMap<String, Object>();
    queryParameters.put("LEVEL_ID", levelId);
    List<CustomerStatusEntity> queryResult = executeNamedQuery(NamedQueryConstants.CHECKLIST_GET_VALID_CUSTOMER_STATES, queryParameters);
    for (CustomerStatusEntity customerStatus : queryResult) {
        checkListStatesView.add(new CheckListStatesView(customerStatus.getId(), customerStatus.getName(), customerStatus.getCustomerLevel().getId()));
    }
    return checkListStatesView;
}
Also used : CheckListStatesView(org.mifos.dto.screen.CheckListStatesView) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) CustomerStatusEntity(org.mifos.customers.business.CustomerStatusEntity)

Example 5 with CheckListStatesView

use of org.mifos.dto.screen.CheckListStatesView in project head by mifos.

the class ChkListAction method getStates.

@TransactionDemarcate(joinToken = true)
public ActionForward getStates(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ChkListActionForm chkListActionForm = (ChkListActionForm) form;
    List<String> details = chkListActionForm.getValidCheckListDetails();
    List<CheckListStatesView> states = retrieveStates(chkListActionForm.getIsCustomer(), chkListActionForm.getMasterTypeId());
    deleteExistingStates(states, chkListActionForm.getIsCustomer(), chkListActionForm.getMasterTypeId(), (short) -1);
    SessionUtils.setCollectionAttribute(CheckListConstants.STATES, states, request);
    SessionUtils.setCollectionAttribute(CheckListConstants.DETAILS, details, request);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : CheckListStatesView(org.mifos.dto.screen.CheckListStatesView) ChkListActionForm(org.mifos.customers.checklist.struts.actionforms.ChkListActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

CheckListStatesView (org.mifos.dto.screen.CheckListStatesView)8 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 ChkListActionForm (org.mifos.customers.checklist.struts.actionforms.ChkListActionForm)3 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)3 HashMap (java.util.HashMap)2 List (java.util.List)2 AccountCheckListBO (org.mifos.customers.checklist.business.AccountCheckListBO)2 CustomerCheckListBO (org.mifos.customers.checklist.business.CustomerCheckListBO)2 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)1 CustomerStatusEntity (org.mifos.customers.business.CustomerStatusEntity)1 CheckListBO (org.mifos.customers.checklist.business.CheckListBO)1 CheckListDetailEntity (org.mifos.customers.checklist.business.CheckListDetailEntity)1 CheckListPersistence (org.mifos.customers.checklist.persistence.CheckListPersistence)1 CheckListMasterDto (org.mifos.dto.domain.CheckListMasterDto)1