Search in sources :

Example 21 with KeyValue

use of org.kuali.kfs.core.api.util.KeyValue in project cu-kfs by CU-CommunityApps.

the class CuSimpleChartValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    String defaultChartCode = "";
    String defaultChartCodeMethod = "";
    try {
        defaultChartCode = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE);
        defaultChartCodeMethod = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE_METHOD);
    } catch (Exception e) {
    // Do nothing
    }
    Collection<Chart> chartCodes = keyValuesService.findAll(Chart.class);
    List<KeyValue> chartKeyLabels = new ArrayList<>();
    // If the DEFAULT_CHART_CODE_METHOD parameter DNE or has no value assigned to it, no default
    if (defaultChartCodeMethod.equals("")) {
        chartKeyLabels.add(new ConcreteKeyValue("", ""));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive()) {
                // only show active charts
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    // populate with the default chart
    if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_CHART_METHOD)) {
        chartKeyLabels.add(new ConcreteKeyValue(defaultChartCode, defaultChartCode));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive() && !element.getChartOfAccountsCode().equals(defaultChartCode)) {
                // only show active charts
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    // populate with chart code of the user's primary department
    if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_PRIMARY_DEPT_METHOD)) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        String primaryDepartmentChartCode = financialSystemUserService.getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
        chartKeyLabels.add(new ConcreteKeyValue(primaryDepartmentChartCode, primaryDepartmentChartCode));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive() && !element.getChartOfAccountsCode().equals(primaryDepartmentChartCode)) {
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    // populate with the default chart unless user's primary department has been defined
    if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_PRIMARY_DEPT_CHART_METHOD)) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        String primaryDepartmentChartCode = financialSystemUserService.getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
        String chartUsed = null;
        if (primaryDepartmentChartCode != null && !primaryDepartmentChartCode.equals("")) {
            chartUsed = primaryDepartmentChartCode;
        } else {
            chartUsed = defaultChartCode;
        }
        chartKeyLabels.add(new ConcreteKeyValue(chartUsed, chartUsed));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive() && !element.getChartOfAccountsCode().equals(chartUsed)) {
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    return chartKeyLabels;
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.kfs.core.api.util.KeyValue) ArrayList(java.util.ArrayList) Person(org.kuali.kfs.kim.api.identity.Person) Chart(org.kuali.kfs.coa.businessobject.Chart)

Example 22 with KeyValue

use of org.kuali.kfs.core.api.util.KeyValue in project cu-kfs by CU-CommunityApps.

the class CuBankAccountTypeValuesFinder method getKeyValues.

@Override
public List<KeyValue> getKeyValues() {
    List<KeyValue> keyValues = new ArrayList<>();
    keyValues.add(new ConcreteKeyValue("C", "Checking"));
    keyValues.add(new ConcreteKeyValue("S", "Savings"));
    return keyValues;
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.kfs.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList)

Example 23 with KeyValue

use of org.kuali.kfs.core.api.util.KeyValue in project cu-kfs by CU-CommunityApps.

the class PaymentMethodValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    Collection<PaymentMethod> paymentMethods = businessObjectService.findMatchingOrderBy(PaymentMethod.class, getFilterCriteria(), "paymentMethodName", true);
    List<KeyValue> labels = new ArrayList<KeyValue>(paymentMethods.size());
    for (PaymentMethod pm : paymentMethods) {
        labels.add(new ConcreteKeyValue(pm.getPaymentMethodCode(), pm.getPaymentMethodCode() + " - " + pm.getPaymentMethodName()));
    }
    return labels;
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.kfs.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList) PaymentMethod(edu.cornell.kfs.fp.businessobject.PaymentMethod)

Example 24 with KeyValue

use of org.kuali.kfs.core.api.util.KeyValue in project cu-kfs by CU-CommunityApps.

the class ScheduleTypeKeyValuesFinder method getKeyValues.

@Override
public List<KeyValue> getKeyValues() {
    List<KeyValue> chartKeyLabels = new ArrayList<KeyValue>();
    chartKeyLabels.add(new ConcreteKeyValue("", ""));
    chartKeyLabels.add(new ConcreteKeyValue(CuFPConstants.ScheduledSourceAccountingLineConstants.ScheduleTypes.DAILY.name, "Daily"));
    chartKeyLabels.add(new ConcreteKeyValue(CuFPConstants.ScheduledSourceAccountingLineConstants.ScheduleTypes.BIWEEKLY.name, "Bi-Weekly"));
    chartKeyLabels.add(new ConcreteKeyValue(CuFPConstants.ScheduledSourceAccountingLineConstants.ScheduleTypes.MONTHLY.name, "Monthly"));
    chartKeyLabels.add(new ConcreteKeyValue(CuFPConstants.ScheduledSourceAccountingLineConstants.ScheduleTypes.YEARLY.name, "Yearly"));
    return chartKeyLabels;
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.kfs.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList)

Example 25 with KeyValue

use of org.kuali.kfs.core.api.util.KeyValue in project cu-kfs by CU-CommunityApps.

the class InvoiceFrequencyValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    Collection<InvoiceFrequency> invoiceFrequencyCodes = keyValuesService.findAll(InvoiceFrequency.class);
    List<KeyValue> invoiceFrequencyKeyLabels = new ArrayList<KeyValue>();
    for (Iterator<InvoiceFrequency> iter = invoiceFrequencyCodes.iterator(); iter.hasNext(); ) {
        InvoiceFrequency element = (InvoiceFrequency) iter.next();
        if (element.isActive()) {
            invoiceFrequencyKeyLabels.add(new ConcreteKeyValue(element.getInvoiceFrequencyCode(), element.getInvoiceFrequencyCode()));
        }
    }
    return invoiceFrequencyKeyLabels;
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.kfs.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) InvoiceFrequency(edu.cornell.kfs.module.cg.businessobject.InvoiceFrequency) ArrayList(java.util.ArrayList)

Aggregations

KeyValue (org.kuali.kfs.core.api.util.KeyValue)35 ConcreteKeyValue (org.kuali.kfs.core.api.util.ConcreteKeyValue)34 ArrayList (java.util.ArrayList)33 List (java.util.List)2 CheckReconSource (com.rsmart.kuali.kfs.cr.businessobject.CheckReconSource)1 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)1 PaymentMethod (edu.cornell.kfs.fp.businessobject.PaymentMethod)1 SecurityGroupTab (edu.cornell.kfs.ksr.businessobject.SecurityGroupTab)1 SecurityProvisioning (edu.cornell.kfs.ksr.businessobject.SecurityProvisioning)1 AgencyOrigin (edu.cornell.kfs.module.cg.businessobject.AgencyOrigin)1 InvoiceFrequency (edu.cornell.kfs.module.cg.businessobject.InvoiceFrequency)1 InvoiceType (edu.cornell.kfs.module.cg.businessobject.InvoiceType)1 LevelOrganization (edu.cornell.kfs.module.purap.businessobject.LevelOrganization)1 FavoriteAccount (edu.cornell.kfs.sys.businessobject.FavoriteAccount)1 FavoriteAccountValuesFinder (edu.cornell.kfs.sys.businessobject.options.FavoriteAccountValuesFinder)1 FormTypes1099 (edu.cornell.kfs.tax.FormTypes1099)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1