Search in sources :

Example 6 with ChangeAccountStatusDto

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

the class PentahoParamParser method updatePossibleValuesForParam.

private Map<String, String> updatePossibleValuesForParam(ListParameter paramDefEntry, ParameterContext paramContext, Map<String, AbstractPentahoParameter> selectedValues) throws ReportDataFactoryException {
    Map<String, String> result = new HashMap<String, String>();
    String id;
    if (parameterIsOffice(paramDefEntry.getName())) {
        ParameterValues paramValues = paramDefEntry.getValues(paramContext);
        for (int i = 0; i < paramValues.getRowCount(); i++) {
            String key = String.valueOf(paramValues.getKeyValue(i));
            String value = String.valueOf(paramValues.getTextValue(i));
            result.put(key, value);
        }
    } else if (parameterIsCenter(paramDefEntry.getName())) {
        String keyValue = searchKey("(.*officer$)|(.*officer_id$)", selectedValues, paramDefEntry.getName());
        if (!keyValue.equals("")) {
            id = (String) selectedValues.get(keyValue).getParamValue();
            if (!id.equals("-1")) {
                List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveCustomersUnderUser(new Short(id));
                for (CustomerDetailDto office : customerList) {
                    String key = office.getCustomerId().toString();
                    String value = office.getDisplayName();
                    result.put(key, value);
                }
            } else {
                ParameterValues paramValues = paramDefEntry.getValues(paramContext);
                for (int i = 0; i < paramValues.getRowCount(); i++) {
                    String key = String.valueOf(paramValues.getKeyValue(i));
                    String value = String.valueOf(paramValues.getTextValue(i));
                    result.put(key, value);
                }
            }
        } else {
            keyValue = searchKey("(selected_office$)|(.*BRANCH_NAME.*)", selectedValues, paramDefEntry.getName());
            if (!keyValue.equals("")) {
                id = (String) selectedValues.get(keyValue).getParamValue();
                if (!id.equals("-1")) {
                    List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveCustomersUnderBranch(new Short(id));
                    for (CustomerDetailDto office : customerList) {
                        String key = office.getCustomerId().toString();
                        String value = office.getDisplayName();
                        result.put(key, value);
                    }
                } else {
                    ParameterValues paramValues = paramDefEntry.getValues(paramContext);
                    for (int i = 0; i < paramValues.getRowCount(); i++) {
                        String key = String.valueOf(paramValues.getKeyValue(i));
                        String value = String.valueOf(paramValues.getTextValue(i));
                        result.put(key, value);
                    }
                }
            } else {
                ParameterValues paramValues = paramDefEntry.getValues(paramContext);
                for (int i = 0; i < paramValues.getRowCount(); i++) {
                    String key = String.valueOf(paramValues.getKeyValue(i));
                    String value = String.valueOf(paramValues.getTextValue(i));
                    result.put(key, value);
                }
            }
        }
        String key = "-1";
        String value = "All";
        result.put(key, value);
    } else if (parameterIsGroup(paramDefEntry.getName())) {
        String keyValue = searchKey("(.*officer*)", selectedValues, paramDefEntry.getName());
        if (!keyValue.equals("")) {
            id = (String) selectedValues.get(keyValue).getParamValue();
            if (!id.equals("-1")) {
                List<CustomerDetailDto> customerList = ApplicationContextProvider.getBean(CenterServiceFacade.class).retrieveGroupForPentahoReport(new Short(id));
                for (CustomerDetailDto office : customerList) {
                    String key = office.getCustomerId().toString();
                    String value = office.getDisplayName();
                    result.put(key, value);
                }
            } else {
                ParameterValues paramValues = paramDefEntry.getValues(paramContext);
                for (int i = 0; i < paramValues.getRowCount(); i++) {
                    String key = String.valueOf(paramValues.getKeyValue(i));
                    String value = String.valueOf(paramValues.getTextValue(i));
                    result.put(key, value);
                }
            }
        } else {
            ParameterValues paramValues = paramDefEntry.getValues(paramContext);
            for (int i = 0; i < paramValues.getRowCount(); i++) {
                String key = String.valueOf(paramValues.getKeyValue(i));
                String value = String.valueOf(paramValues.getTextValue(i));
                result.put(key, value);
            }
        }
        String key = "-1";
        String value = "All";
        result.put(key, value);
    } else if (parameterIsOfficer(paramDefEntry.getName())) {
        String keyValue = searchKey("(.*office$)|(.*office_id$)|(.*branch_id$)|(.*office$)|(.*selectedBranch.*)", selectedValues, paramDefEntry.getName());
        if (!keyValue.equals("")) {
            id = (String) selectedValues.get(keyValue).getParamValue();
            if (!id.equals("-1")) {
                ChangeAccountStatusDto changeAccountStatusDto = ApplicationContextProvider.getBean(LoanAccountServiceFacade.class).retrieveLoanOfficerDetailsForBranch(new Short(id));
                List<PersonnelDto> officers = changeAccountStatusDto.getLoanOfficers();
                for (PersonnelDto officer : officers) {
                    String key = officer.getPersonnelId().toString();
                    String value = officer.getDisplayName();
                    result.put(key, value);
                }
            }
            String key = "-1";
            String value = "All";
            result.put(key, value);
        }
    } else {
        ParameterValues paramValues = paramDefEntry.getValues(paramContext);
        for (int i = 0; i < paramValues.getRowCount(); i++) {
            String key = String.valueOf(paramValues.getKeyValue(i));
            String value = String.valueOf(paramValues.getTextValue(i));
            result.put(key, value);
        }
    }
    return result;
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) HashMap(java.util.HashMap) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) ArrayList(java.util.ArrayList) List(java.util.List) ParameterValues(org.pentaho.reporting.engine.classic.core.parameters.ParameterValues) CenterServiceFacade(org.mifos.application.servicefacade.CenterServiceFacade)

Example 7 with ChangeAccountStatusDto

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

the class AccountStatusAction method load.

@TransactionDemarcate(saveToken = true)
public ActionForward load(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse httpservletresponse) throws Exception {
    cleanUp(form, request);
    ChangeAccountStatusDto activeBranchesAndLoanOfficers = this.loanAccountServiceFacade.retrieveAllActiveBranchesAndLoanOfficerDetails();
    SessionUtils.setCollectionAttribute(OfficeConstants.OFFICESBRANCHOFFICESLIST, activeBranchesAndLoanOfficers.getActiveBranches(), request);
    SessionUtils.setCollectionAttribute(LoanConstants.LOAN_OFFICERS, activeBranchesAndLoanOfficers.getLoanOfficers(), request);
    return mapping.findForward(ActionForwards.changeAccountStatus_success.toString());
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

ChangeAccountStatusDto (org.mifos.dto.screen.ChangeAccountStatusDto)7 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)4 PersonnelDto (org.mifos.dto.domain.PersonnelDto)3 ArrayList (java.util.ArrayList)2 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)2 CenterCreation (org.mifos.dto.domain.CenterCreation)2 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)2 MifosUser (org.mifos.security.MifosUser)2 UserContext (org.mifos.security.util.UserContext)2 HashMap (java.util.HashMap)1 List (java.util.List)1 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)1 AccountStatusActionForm (org.mifos.accounts.loan.struts.actionforms.AccountStatusActionForm)1 CenterServiceFacade (org.mifos.application.servicefacade.CenterServiceFacade)1 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)1 ParameterValues (org.pentaho.reporting.engine.classic.core.parameters.ParameterValues)1