Search in sources :

Example 21 with ConcreteKeyValue

use of org.kuali.kfs.core.api.util.ConcreteKeyValue 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 ConcreteKeyValue

use of org.kuali.kfs.core.api.util.ConcreteKeyValue 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)

Example 23 with ConcreteKeyValue

use of org.kuali.kfs.core.api.util.ConcreteKeyValue 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 24 with ConcreteKeyValue

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

the class AttachmentDescriptionValuesFinder method getKeyValues.

/**
 * @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 */
public List<KeyValue> getKeyValues() {
    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    keyValues.add(new ConcreteKeyValue("Note", "Note"));
    keyValues.add(new ConcreteKeyValue("Quote", "Quote"));
    keyValues.add(new ConcreteKeyValue("Invoice", "Invoice"));
    keyValues.add(new ConcreteKeyValue("Contract/Agreement", "Contract/Agreement"));
    keyValues.add(new ConcreteKeyValue("Sole Source", "Sole Source"));
    keyValues.add(new ConcreteKeyValue("Specifications", "Specifications"));
    keyValues.add(new ConcreteKeyValue("Other", "Other"));
    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 25 with ConcreteKeyValue

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

the class CollegeLevelOrganizationValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    List<KeyValue> keyValues = new ArrayList<KeyValue>();
    List<LevelOrganization> cLevelOrganizations = iWantDocumentService.getCLevelOrganizations();
    keyValues.add(new ConcreteKeyValue("", ""));
    if (cLevelOrganizations != null) {
        for (LevelOrganization cLevelOrganization : cLevelOrganizations) {
            keyValues.add(new ConcreteKeyValue(cLevelOrganization.getCode(), cLevelOrganization.getCodeAndDescription()));
        }
    }
    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) LevelOrganization(edu.cornell.kfs.module.purap.businessobject.LevelOrganization) ArrayList(java.util.ArrayList)

Aggregations

ConcreteKeyValue (org.kuali.kfs.core.api.util.ConcreteKeyValue)38 KeyValue (org.kuali.kfs.core.api.util.KeyValue)34 ArrayList (java.util.ArrayList)33 LevelOrganization (edu.cornell.kfs.module.purap.businessobject.LevelOrganization)3 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)2 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)2 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)2 HashMap (java.util.HashMap)2 ActionForward (org.apache.struts.action.ActionForward)2 Person (org.kuali.kfs.kim.api.identity.Person)2 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)2 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)2 Document (org.kuali.kfs.krad.document.Document)2 CheckReconSource (com.rsmart.kuali.kfs.cr.businessobject.CheckReconSource)1 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)1 ReversionCodeValuesFinder (edu.cornell.kfs.coa.businessobject.options.ReversionCodeValuesFinder)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