Search in sources :

Example 1 with ReversionCodeValuesFinder

use of edu.cornell.kfs.coa.businessobject.options.ReversionCodeValuesFinder in project cu-kfs by CU-CommunityApps.

the class AccountReversionGlobalRule method checkDetailObjectReversionCodeValidity.

/**
 * Tests if the object reversion code is a valid code.
 *
 * @param detail the AccountReversionGlobalDetail to check
 * @return true if it the detail is valid, false if otherwise
 */
public boolean checkDetailObjectReversionCodeValidity(AccountReversionGlobalDetail detail) {
    boolean success = true;
    if (!StringUtils.isBlank(detail.getAccountReversionCode())) {
        boolean foundInList = false;
        // search through the values. Is that right good & healthy?
        for (Object kvPairObj : new ReversionCodeValuesFinder().getKeyValues()) {
            ConcreteKeyValue kvPair = (ConcreteKeyValue) kvPairObj;
            if (kvPair.getKey().toString().equals(detail.getAccountReversionCode())) {
                foundInList = true;
                break;
            }
        }
        if (!foundInList) {
            // we've failed to find the code in the list...FAILED!
            success = false;
            GlobalVariables.getMessageMap().putError("accountReversionCode", CUKFSKeyConstants.ERROR_DOCUMENT_GLOBAL_ACCT_REVERSION_INVALID_ACCT_REVERSION_CODE, new String[] { detail.getAccountReversionCode() });
        }
    }
    return success;
}
Also used : ConcreteKeyValue(org.kuali.rice.core.api.util.ConcreteKeyValue) PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject) ReversionCodeValuesFinder(edu.cornell.kfs.coa.businessobject.options.ReversionCodeValuesFinder)

Aggregations

ReversionCodeValuesFinder (edu.cornell.kfs.coa.businessobject.options.ReversionCodeValuesFinder)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 ConcreteKeyValue (org.kuali.rice.core.api.util.ConcreteKeyValue)1