Search in sources :

Example 21 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate 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 22 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate 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 23 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class ClientTransferAction method loadParents.

@TransactionDemarcate(joinToken = true)
public ActionForward loadParents(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    CustomerSearchInputDto clientSearchInput = new CustomerSearchInputDto();
    clientSearchInput.setOfficeId(getUserContext(request).getBranchId());
    clientSearchInput.setCustomerInputPage(ClientConstants.INPUT_GROUP_TRANSFER);
    SessionUtils.setAttribute(CustomerConstants.CUSTOMER_SEARCH_INPUT, clientSearchInput, request.getSession());
    return mapping.findForward(ActionForwards.loadParents_success.toString());
}
Also used : CustomerSearchInputDto(org.mifos.customers.util.helpers.CustomerSearchInputDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 24 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class ClientTransferAction method updateParent.

@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward updateParent(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ClientTransferActionForm actionForm = (ClientTransferActionForm) form;
    ClientBO clientInSession = (ClientBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    String globalCustNum = this.clientServiceFacade.transferClientToGroup(actionForm.getParentGroupIdValue(), clientInSession.getGlobalCustNum(), clientInSession.getVersionNo());
    ClientBO client = this.customerDao.findClientBySystemId(globalCustNum);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
    return mapping.findForward(ActionForwards.update_success.toString());
}
Also used : ClientTransferActionForm(org.mifos.customers.client.struts.actionforms.ClientTransferActionForm) ClientBO(org.mifos.customers.client.business.ClientBO) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 25 with TransactionDemarcate

use of org.mifos.framework.util.helpers.TransactionDemarcate in project head by mifos.

the class LookupOptionsAction method load.

@TransactionDemarcate(saveToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("Inside load method");
    LookupOptionsActionForm lookupOptionsActionForm = (LookupOptionsActionForm) form;
    lookupOptionsActionForm.clear();
    setHiddenFields(request);
    Short localeId = getUserContext(request).getLocaleId();
    setSpecialLables(getUserContext(request), lookupOptionsActionForm);
    populateConfigurationListBox(MasterConstants.SALUTATION, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_SALUTATION);
    populateConfigurationListBox(MasterConstants.PERSONNEL_TITLE, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_PERSONNEL_TITLE);
    populateConfigurationListBox(MasterConstants.MARITAL_STATUS, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_MARITAL_STATUS);
    populateConfigurationListBox(MasterConstants.ETHNICITY, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_ETHNICITY);
    populateConfigurationListBox(MasterConstants.EDUCATION_LEVEL, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_EDUCATION_LEVEL);
    populateConfigurationListBox(MasterConstants.CITIZENSHIP, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_CITIZENSHIP);
    populateConfigurationListBox(MasterConstants.BUSINESS_ACTIVITIES, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_BUSINESS_ACTIVITY);
    populateConfigurationListBox(MasterConstants.LOAN_PURPOSES, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_LOAN_PURPOSE);
    populateConfigurationListBox(MasterConstants.COLLATERAL_TYPES, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_COLLATERAL_TYPE);
    populateConfigurationListBox(MasterConstants.HANDICAPPED, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_HANDICAPPED);
    populateConfigurationListBox(MasterConstants.OFFICER_TITLES, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_OFFICER_TITLE);
    populateConfigurationListBox(MasterConstants.PAYMENT_TYPE, legacyMasterDao, localeId, request, lookupOptionsActionForm, ConfigurationConstants.CONFIG_PAYMENT_TYPE);
    logger.debug("Outside load method");
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : LookupOptionsActionForm(org.mifos.config.struts.actionform.LookupOptionsActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)259 UserContext (org.mifos.security.util.UserContext)72 ArrayList (java.util.ArrayList)41 CloseSession (org.mifos.framework.util.helpers.CloseSession)35 LoanBO (org.mifos.accounts.loan.business.LoanBO)26 ClientCustActionForm (org.mifos.customers.client.struts.actionforms.ClientCustActionForm)21 CustomerBO (org.mifos.customers.business.CustomerBO)20 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)19 AccountBO (org.mifos.accounts.business.AccountBO)18 ApplicationException (org.mifos.framework.exceptions.ApplicationException)17 ActionErrors (org.apache.struts.action.ActionErrors)14 LocalDate (org.joda.time.LocalDate)14 AccountApplyPaymentActionForm (org.mifos.accounts.struts.actionforms.AccountApplyPaymentActionForm)14 ClientBO (org.mifos.customers.client.business.ClientBO)14 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)13 List (java.util.List)12 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)12 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)12 MeetingBO (org.mifos.application.meeting.business.MeetingBO)12 ActionForward (org.apache.struts.action.ActionForward)11