Search in sources :

Example 16 with KeyValue

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

the class TaxReportingTypeValuesFinder method getKeyValues.

@Override
public List<KeyValue> getKeyValues() {
    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    keyValues.add(new ConcreteKeyValue(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING));
    keyValues.add(new ConcreteKeyValue(CUTaxConstants.TAX_TYPE_1099, CUTaxConstants.TAX_TYPE_1099));
    keyValues.add(new ConcreteKeyValue(CUTaxConstants.TAX_TYPE_1042S, CUTaxConstants.TAX_TYPE_1042S));
    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 17 with KeyValue

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

the class PurchaseOrderTransmissionMethodValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    Collection<PurchaseOrderTransmissionMethod> methods = keyValuesService.findAll(PurchaseOrderTransmissionMethod.class);
    List<KeyValue> labels = new ArrayList<>();
    labels.add(new ConcreteKeyValue("", ""));
    for (PurchaseOrderTransmissionMethod method : methods) {
        labels.add(new ConcreteKeyValue(method.getPurchaseOrderTransmissionMethodCode(), method.getPurchaseOrderTransmissionMethodDescription()));
    }
    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) PurchaseOrderTransmissionMethod(org.kuali.kfs.module.purap.businessobject.PurchaseOrderTransmissionMethod)

Example 18 with KeyValue

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

the class LookupResource method buildLookupControlValuesMap.

private Map<String, Object> buildLookupControlValuesMap(BusinessObjectEntry businessObjectEntry) {
    Class classForType = businessObjectEntry.getBusinessObjectClass();
    if (!isAuthorizedForLookup(classForType)) {
        throw new ForbiddenException();
    }
    Map<String, Object> valuesMap = new LinkedHashMap<>();
    List<FormAttribute> attributes = getLookupAttributeForClass(classForType);
    for (FormAttribute attribute : attributes) {
        Control control = attribute.getControl();
        if (control == null) {
            continue;
        }
        String singleAttributeName = attribute.getName();
        if (control.getType() == Control.Type.TREE) {
            // we have to do this bean resolution here b/c batch file (the only tree) is still a snowflake
            // and the DDD doesn't do the bean lookup for us (mainly b/c of the typing); hope to get rid of the
            // need for special VF type eventually
            String valuesFinderName = control.getValuesFinderName();
            if (StringUtils.isBlank(valuesFinderName)) {
                LOG.warn("A tree control without ValuesFinder name is most likely a mistake. BOE: " + businessObjectEntry.getName() + " attribute: " + singleAttributeName);
                continue;
            }
            HierarchicalControlValuesFinder valuesFinder = getDataDictionaryService().getDDBean(HierarchicalControlValuesFinder.class, valuesFinderName);
            if (valuesFinder == null) {
                LOG.warn("A tree control without a valid HierarchicalControlValuesFinder is most likely a " + "mistake. BOE:" + businessObjectEntry.getName() + " attribute: " + singleAttributeName);
                continue;
            }
            List<HierarchicalData> values = valuesFinder.getHierarchicalControlValues();
            valuesMap.put(singleAttributeName, values);
        } else {
            KeyValuesFinder valuesFinder = control.getValuesFinder();
            if (valuesFinder == null) {
                continue;
            }
            // CU Customization: keyValues list now comes from the helper method below.
            List<KeyValue> keyValues = getKeyValuesForLookup(valuesFinder);
            valuesMap.put(singleAttributeName, keyValues);
        }
    }
    return valuesMap;
}
Also used : HierarchicalControlValuesFinder(org.kuali.kfs.krad.keyvalues.HierarchicalControlValuesFinder) ForbiddenException(javax.ws.rs.ForbiddenException) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.kfs.core.api.util.KeyValue) HierarchicalData(org.kuali.kfs.krad.keyvalues.HierarchicalData) KeyValuesFinder(org.kuali.kfs.krad.keyvalues.KeyValuesFinder) FormAttribute(org.kuali.kfs.datadictionary.FormAttribute) LinkedHashMap(java.util.LinkedHashMap) Control(org.kuali.kfs.datadictionary.Control)

Example 19 with KeyValue

use of org.kuali.kfs.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.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 20 with KeyValue

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

the class ReversionCategoryValuesFinder method getKeyValues.

public List getKeyValues() {
    Collection<ReversionCategory> codes = keyValuesService.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 : 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) ReversionCategory(edu.cornell.kfs.coa.businessobject.ReversionCategory)

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