Search in sources :

Example 1 with MutableInactivatable

use of org.kuali.rice.core.api.mo.common.active.MutableInactivatable in project cu-kfs by CU-CommunityApps.

the class BatchFeedHelperServiceImpl method performExistenceAndActiveValidation.

/**
 * @see com.rsmart.kuali.kfs.sys.batch.service.BatchFeedHelperService#performExistenceAndActiveValidation(org.kuali.kfs.kns.bo.PersistableBusinessObject,
 *      java.lang.String, java.lang.String, org.kuali.kfs.kns.util.ErrorMap)
 */
public void performExistenceAndActiveValidation(PersistableBusinessObject businessObject, String referenceName, String propertyName, MessageMap errorMap) {
    Object propertyValue = ObjectUtils.getPropertyValue(businessObject, propertyName);
    if (propertyValue != null) {
        businessObject.refreshReferenceObject(referenceName);
        Object referenceValue = ObjectUtils.getPropertyValue(businessObject, referenceName);
        if (ObjectUtils.isNull(referenceValue)) {
            addExistenceError(propertyName, propertyValue.toString(), errorMap);
        } else if (MutableInactivatable.class.isAssignableFrom(referenceValue.getClass())) {
            if (!((MutableInactivatable) referenceValue).isActive()) {
                addInactiveError(propertyName, propertyValue.toString(), errorMap);
            }
        }
    }
}
Also used : PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject) MutableInactivatable(org.kuali.rice.core.api.mo.common.active.MutableInactivatable)

Aggregations

PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 MutableInactivatable (org.kuali.rice.core.api.mo.common.active.MutableInactivatable)1