Search in sources :

Example 6 with KeyValue

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

the class FavoriteAccountValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    List<FavoriteAccount> favoriteAccounts = getUserFavoriteAccounts();
    keyValues.add(new ConcreteKeyValue("", ""));
    if (CollectionUtils.isNotEmpty(favoriteAccounts)) {
        Collections.sort(favoriteAccounts, new Comparator() {

            public int compare(Object o1, Object o2) {
                FavoriteAccount accountFirst = (FavoriteAccount) o1;
                FavoriteAccount accountSecond = (FavoriteAccount) o2;
                if (accountFirst.getPrimaryInd() && !accountSecond.getPrimaryInd()) {
                    return -1;
                } else if (!accountFirst.getPrimaryInd() && accountSecond.getPrimaryInd()) {
                    return 1;
                }
                if (StringUtils.equals(accountFirst.getDescription(), accountSecond.getDescription())) {
                    return accountFirst.getAccountNumber().compareTo(accountSecond.getAccountNumber());
                } else if (StringUtils.isBlank(accountFirst.getDescription())) {
                    // Be aware case comparison.
                    return -1;
                } else if (StringUtils.isBlank(accountSecond.getDescription())) {
                    return 1;
                } else {
                    return accountFirst.getDescription().compareTo(accountSecond.getDescription());
                }
            }
        });
        for (FavoriteAccount account : favoriteAccounts) {
            keyValues.add(new ConcreteKeyValue(account.getAccountLineIdentifier().toString(), getAccountingLineDescription(account)));
        }
    }
    return keyValues;
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) FavoriteAccount(edu.cornell.kfs.sys.businessobject.FavoriteAccount) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList) Comparator(java.util.Comparator)

Example 7 with KeyValue

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

the class AutoDisEncumberType 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() {
    List<KeyValue> chartKeyLabels = new ArrayList<KeyValue>();
    chartKeyLabels.add(new ConcreteKeyValue("", ""));
    chartKeyLabels.add(new ConcreteKeyValue(CUKFSConstants.PreEncumbranceDocumentConstants.BIWEEKLY, "Bi-Weekly"));
    chartKeyLabels.add(new ConcreteKeyValue(CUKFSConstants.PreEncumbranceDocumentConstants.MONTHLY, "Monthly"));
    chartKeyLabels.add(new ConcreteKeyValue(CUKFSConstants.PreEncumbranceDocumentConstants.SEMIMONTHLY, "Semi-Monthly"));
    chartKeyLabels.add(new ConcreteKeyValue(CUKFSConstants.PreEncumbranceDocumentConstants.CUSTOM, "One Time"));
    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) ArrayList(java.util.ArrayList)

Example 8 with KeyValue

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

the class BankAccountNumberValuesFinder method getKeyValues.

/**
 * Get Key Values
 *
 * @return List of KeyLabelPair
 *
 * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List<KeyValue> getKeyValues() {
    Collection<Bank> banks = SpringContext.getBean(KeyValuesService.class).findAll(Bank.class);
    List<KeyValue> bankKeyLabels = new ArrayList<KeyValue>();
    bankKeyLabels.add(new ConcreteKeyValue("", ""));
    for (Bank bank : banks) {
        if (bank.isActive()) {
            bankKeyLabels.add(new ConcreteKeyValue(bank.getBankAccountNumber(), bank.getBankName()));
        }
    }
    return bankKeyLabels;
}
Also used : KeyValuesService(org.kuali.kfs.krad.service.KeyValuesService) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) Bank(org.kuali.kfs.sys.businessobject.Bank) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList)

Example 9 with KeyValue

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

the class CheckReconSrcValuesFinder method getKeyValues.

/**
 * Get Key Values
 *
 * @return List of KeyLabelPair
 *
 * @see org.kuali.core.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List<KeyValue> getKeyValues() {
    Collection<CheckReconSource> sources = SpringContext.getBean(KeyValuesService.class).findAll(CheckReconSource.class);
    List<KeyValue> srcKeyLabels = new ArrayList<KeyValue>();
    srcKeyLabels.add(new ConcreteKeyValue("", ""));
    for (CheckReconSource src : sources) {
        srcKeyLabels.add(new ConcreteKeyValue(src.getSourceCode(), src.getSourceName()));
    }
    return srcKeyLabels;
}
Also used : KeyValuesService(org.kuali.kfs.krad.service.KeyValuesService) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) CheckReconSource(com.rsmart.kuali.kfs.cr.businessobject.CheckReconSource) KeyValue(org.kuali.rice.core.api.util.KeyValue) ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList)

Example 10 with KeyValue

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

the class ReversionCodeValuesFinder method getKeyValues.

/**
 * This is a static list of {@link OrganizationReversionCode}s
 * <ul>
 * <li>"A", "A - CF +/- bal in same account"</li>
 * <li>"C1", "C1 - CF budget then CF + and R -"</li>
 * <li>"C2", "C2 - Don't CF budget then CF + and R -"</li>
 * <li>"N1", "N1 - CF budget then R + and CF -"</li>
 * <li>"N2", "N2 - Don't CF budget then R + and CF -"</li>
 * <li>"R1", "R1 - CF budget then R Remaining"</li>
 * <li>"R2", "R2 - Don't CF budget then R Remaining"</li>
 * </ul>
 *
 * @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List getKeyValues() {
    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    keyValues.add(new ConcreteKeyValue("", ""));
    keyValues.add(new ConcreteKeyValue("A", "A - CF +/- bal in same account"));
    keyValues.add(new ConcreteKeyValue("CA", "CA - Revert cash balance"));
    keyValues.add(new ConcreteKeyValue("C1", "C1 - CF budget then CF + and R -"));
    keyValues.add(new ConcreteKeyValue("C2", "C2 - Don't CF budget then CF + and R -"));
    keyValues.add(new ConcreteKeyValue("N1", "N1 - CF budget then R + and CF -"));
    keyValues.add(new ConcreteKeyValue("N2", "N2 - Don't CF budget then R + and CF -"));
    keyValues.add(new ConcreteKeyValue("R1", "R1 - CF budget then R Remaining"));
    keyValues.add(new ConcreteKeyValue("R2", "R2 - Don't CF budget then R Remaining"));
    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)

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