Search in sources :

Example 11 with KeyValue

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

the class InvoiceTypeValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
    Collection<InvoiceType> invoiceTypeCodes = boService.findAll(InvoiceType.class);
    List<KeyValue> invoiceTypeKeyLabels = new ArrayList<KeyValue>();
    for (Iterator<InvoiceType> iter = invoiceTypeCodes.iterator(); iter.hasNext(); ) {
        InvoiceType element = (InvoiceType) iter.next();
        if (element.isActive()) {
            // only show active invoice types
            invoiceTypeKeyLabels.add(new ConcreteKeyValue(element.getInvoiceTypeCode(), element.getInvoiceTypeCode()));
        }
    }
    return invoiceTypeKeyLabels;
}
Also used : KeyValuesService(org.kuali.kfs.krad.service.KeyValuesService) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList) InvoiceType(edu.cornell.kfs.module.cg.businessobject.InvoiceType)

Example 12 with KeyValue

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

the class CUCheckingSavingsValuesFinder method getKeyValues.

/**
 * Creates a simple list of static values for either checking or savings
 *
 * @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List<KeyValue> getKeyValues() {
    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    keyValues.add(new ConcreteKeyValue(BankAccountTypes.PERSONAL_CHECKING, "Personal Checking (" + BankAccountTypes.PERSONAL_CHECKING + ")"));
    keyValues.add(new ConcreteKeyValue(BankAccountTypes.PERSONAL_SAVINGS, "Personal Savings (" + BankAccountTypes.PERSONAL_SAVINGS + ")"));
    keyValues.add(new ConcreteKeyValue(BankAccountTypes.CORPORATE_CHECKING, "Corporate Checking (" + BankAccountTypes.CORPORATE_CHECKING + ")"));
    keyValues.add(new ConcreteKeyValue(BankAccountTypes.CORPORATE_SAVINGS, "Corporate Savings (" + BankAccountTypes.CORPORATE_SAVINGS + ")"));
    return keyValues;
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList)

Example 13 with KeyValue

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

the class CUSimpleChartValuesFinder method getKeyValues.

/**
 * Creates a list of {@link Chart}s using their code as their key, and their code as the display value
 *
 * @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List<KeyValue> getKeyValues() {
    parameterService = SpringContext.getBean(ParameterService.class);
    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
    }
    KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
    Collection<Chart> chartCodes = boService.findAll(Chart.class);
    List<KeyValue> chartKeyLabels = new ArrayList<KeyValue>();
    // 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 (defaultChartCodeMethod.equals("1")) {
        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 (defaultChartCodeMethod.equals("2")) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        String primaryDepartmentChartCode = SpringContext.getBean(FinancialSystemUserService.class).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)) {
                // only show active charts
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    // populate with the default chart unless user's primary department has been defined
    if (defaultChartCodeMethod.equals("3")) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        String primaryDepartmentChartCode = SpringContext.getBean(FinancialSystemUserService.class).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)) {
                // only show active charts
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    return chartKeyLabels;
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) ArrayList(java.util.ArrayList) KeyValuesService(org.kuali.kfs.krad.service.KeyValuesService) Person(org.kuali.rice.kim.api.identity.Person) Chart(org.kuali.kfs.coa.businessobject.Chart)

Example 14 with KeyValue

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

the class ReversionCategoryValuesFinder method getKeyValues.

/**
 * Creates a list of {@link MandatoryTransferEliminationCode}s using their code as their key, and their name as the display
 * value
 *
 * @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List getKeyValues() {
    Collection<ReversionCategory> codes = SpringContext.getBean(KeyValuesService.class).findAll(ReversionCategory.class);
    List<KeyValue> labels = new ArrayList<KeyValue>();
    labels.add(new ConcreteKeyValue("", ""));
    for (ReversionCategory reversionCategory : codes) {
        if (reversionCategory.isActive()) {
            labels.add(new ConcreteKeyValue(reversionCategory.getReversionCategoryCode(), reversionCategory.getReversionCategoryName()));
        }
    }
    return labels;
}
Also used : KeyValuesService(org.kuali.kfs.krad.service.KeyValuesService) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory)

Example 15 with KeyValue

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

the class StatusValuesFinder method getKeyValues.

/**
 * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List<KeyValue> getKeyValues() {
    List<KeyValue> keyValuesList = new ArrayList<KeyValue>();
    keyValuesList.add(new ConcreteKeyValue(CRConstants.CANCELLED, "Cancelled"));
    keyValuesList.add(new ConcreteKeyValue(CRConstants.CLEARED, "Cleared"));
    keyValuesList.add(new ConcreteKeyValue(CRConstants.EXCP, "Exception"));
    keyValuesList.add(new ConcreteKeyValue(CRConstants.ISSUED, "Issued"));
    keyValuesList.add(new ConcreteKeyValue(CRConstants.STALE, "Stale"));
    keyValuesList.add(new ConcreteKeyValue(CRConstants.STOP, "Stopped"));
    keyValuesList.add(new ConcreteKeyValue(CRConstants.VOIDED, "Voided"));
    return keyValuesList;
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList)

Aggregations

KeyValue (org.kuali.rice.core.api.util.KeyValue)25 ArrayList (java.util.ArrayList)24 ConcreteKeyValue (org.kuali.rice.core.api.util.ConcreteKeyValue)24 KeyValuesService (org.kuali.kfs.krad.service.KeyValuesService)6 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 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 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)1 FavoriteAccount (edu.cornell.kfs.sys.businessobject.FavoriteAccount)1 FavoriteAccountValuesFinder (edu.cornell.kfs.sys.businessobject.options.FavoriteAccountValuesFinder)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Map (java.util.Map)1 Chart (org.kuali.kfs.coa.businessobject.Chart)1 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)1 PurchasingDocumentBase (org.kuali.kfs.module.purap.document.PurchasingDocumentBase)1 Bank (org.kuali.kfs.sys.businessobject.Bank)1