Search in sources :

Example 6 with ConcreteKeyValue

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

the class SubDirectoryWalker method handleDirectoryStart.

/**
 * @see DirectoryWalker#handleDirectoryStart(File, int, java.util.Collection)
 */
@Override
protected void handleDirectoryStart(File directory, int depth, Collection results) throws IOException {
    super.handleDirectoryStart(directory, depth, results);
    ConcreteKeyValue entry = new ConcreteKeyValue();
    entry.setKey(BatchFileUtils.pathRelativeToRootDirectory(directory.getAbsolutePath()));
    // use the unicode literal for space....KFSMI-7392 fix
    entry.setValue(StringUtils.repeat("\u00A0", 4 * this.recursiveDepth) + directory.getName());
    keyValues.add(entry);
    this.recursiveDepth++;
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue)

Example 7 with ConcreteKeyValue

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

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

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

the class CuCurrencyTypeValuesFinder method getKeyValues.

/*
     * @see org.kuali.keyvalues.KeyValuesFinder#getKeyValues()
     */
public List getKeyValues() {
    List keyValues = new ArrayList();
    keyValues.add(new ConcreteKeyValue(CuFPConstants.CURRENCY_CODE_U, CuFPConstants.CURRENCY_US_DOLLAR));
    keyValues.add(new ConcreteKeyValue(CuFPConstants.CURRENCY_CODE_C, CuFPConstants.CURRENCY_US_DOLLAR_TO_FOREIGN));
    keyValues.add(new ConcreteKeyValue(CuFPConstants.CURRENCY_CODE_F, CuFPConstants.CURRENCY_FOREIGN));
    return keyValues;
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 10 with ConcreteKeyValue

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

the class IWantDocumentAction method setCollegeAndDepartmentBasedOnPrimaryDepartment.

/**
 * Sets the College and Department based on the initiator primary department.
 *
 * @param documentForm
 */
private void setCollegeAndDepartmentBasedOnPrimaryDepartment(IWantDocumentForm documentForm) {
    IWantDocumentService iWantDocumentService = SpringContext.getBean(IWantDocumentService.class);
    String primaryDeptOrg = null;
    IWantDocument iWantDocument = null;
    if (documentForm != null && documentForm.getDocument() != null) {
        iWantDocument = (IWantDocument) documentForm.getDocument();
    }
    if (iWantDocument != null && StringUtils.isEmpty(iWantDocument.getCollegeLevelOrganization())) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        Entity entityInfo = KimApiServiceLocator.getIdentityService().getEntityByPrincipalId(currentUser.getPrincipalId());
        if (ObjectUtils.isNotNull(entityInfo)) {
            if (ObjectUtils.isNotNull(entityInfo.getEmploymentInformation()) && entityInfo.getEmploymentInformation().size() > 0) {
                EntityEmployment employmentInformation = entityInfo.getEmploymentInformation().get(0);
                String primaryDepartment = employmentInformation.getPrimaryDepartmentCode();
                primaryDeptOrg = primaryDepartment.substring(primaryDepartment.lastIndexOf('-') + 1, primaryDepartment.length());
                String cLevelOrg = iWantDocumentService.getCLevelOrganizationForDLevelOrg(primaryDepartment);
                ((IWantDocument) documentForm.getDocument()).setCollegeLevelOrganization(cLevelOrg);
            }
        }
    }
    if (iWantDocument != null && StringUtils.isNotEmpty(iWantDocument.getCollegeLevelOrganization())) {
        String cLevelOrg = iWantDocument.getCollegeLevelOrganization();
        documentForm.getDeptOrgKeyLabels().clear();
        documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue("", "Please Select"));
        List<LevelOrganization> dLevelOrgs = iWantDocumentService.getDLevelOrganizations(cLevelOrg);
        for (LevelOrganization levelOrganization : dLevelOrgs) {
            documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue(levelOrganization.getCode(), levelOrganization.getCodeAndDescription()));
        }
        if (primaryDeptOrg != null) {
            iWantDocument.setDepartmentLevelOrganization(primaryDeptOrg);
        }
    }
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) Entity(org.kuali.rice.kim.api.identity.entity.Entity) LevelOrganization(edu.cornell.kfs.module.purap.businessobject.LevelOrganization) EntityEmployment(org.kuali.rice.kim.api.identity.employment.EntityEmployment) Person(org.kuali.rice.kim.api.identity.Person) IWantDocumentService(edu.cornell.kfs.module.purap.document.service.IWantDocumentService) IWantDocument(edu.cornell.kfs.module.purap.document.IWantDocument) PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)

Aggregations

ConcreteKeyValue (org.kuali.rice.core.api.util.ConcreteKeyValue)30 ArrayList (java.util.ArrayList)25 KeyValue (org.kuali.rice.core.api.util.KeyValue)24 KeyValuesService (org.kuali.kfs.krad.service.KeyValuesService)7 LevelOrganization (edu.cornell.kfs.module.purap.businessobject.LevelOrganization)3 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)3 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)2 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)2 List (java.util.List)2 Person (org.kuali.rice.kim.api.identity.Person)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 InvoiceFrequency (edu.cornell.kfs.module.cg.businessobject.InvoiceFrequency)1 InvoiceType (edu.cornell.kfs.module.cg.businessobject.InvoiceType)1 FavoriteAccount (edu.cornell.kfs.sys.businessobject.FavoriteAccount)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1 HashSet (java.util.HashSet)1