Search in sources :

Example 1 with ParameterKey

use of org.kuali.kfs.coreservice.api.parameter.ParameterKey in project cu-kfs by CU-CommunityApps.

the class ParameterRepositoryServiceImpl method createParameter.

@CacheEvict(value = Parameter.CACHE_NAME, allEntries = true)
@Override
public Parameter createParameter(Parameter parameter) {
    if (parameter == null) {
        throw new IllegalArgumentException("parameter is null");
    }
    final ParameterKey key = ParameterKey.create(parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName());
    final Parameter existing = getParameter(key);
    if (existing != null) {
        throw new IllegalStateException("the parameter to create already exists: " + parameter);
    }
    return businessObjectService.save(parameter);
}
Also used : ParameterKey(org.kuali.kfs.coreservice.api.parameter.ParameterKey) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 2 with ParameterKey

use of org.kuali.kfs.coreservice.api.parameter.ParameterKey in project cu-kfs by CU-CommunityApps.

the class ParameterRepositoryServiceImpl method updateParameter.

@CacheEvict(value = Parameter.CACHE_NAME, allEntries = true)
@Override
public Parameter updateParameter(Parameter parameter) {
    if (parameter == null) {
        throw new IllegalArgumentException("parameter is null");
    }
    final ParameterKey key = ParameterKey.create(parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName());
    final Parameter existing = getParameter(key);
    if (existing == null) {
        throw new IllegalStateException("the parameter does not exist: " + parameter);
    }
    return businessObjectService.save(parameter);
}
Also used : ParameterKey(org.kuali.kfs.coreservice.api.parameter.ParameterKey) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Aggregations

ParameterKey (org.kuali.kfs.coreservice.api.parameter.ParameterKey)2 CacheEvict (org.springframework.cache.annotation.CacheEvict)2