1 /** 2 * Copyright 2005-2014 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krms.impl.repository; 17 18 import org.kuali.rice.krms.api.repository.rule.RuleDefinition; 19 import org.springframework.cache.annotation.CacheEvict; 20 import org.springframework.cache.annotation.Cacheable; 21 22 /** 23 * This is the interface for accessing KRMS repository Rule related bos 24 * 25 * @author Kuali Rice Team (rice.collab@kuali.org) 26 * 27 */ 28 public interface RuleBoService { 29 /** 30 * This will create a {@link RuleDefinition} exactly like the parameter passed in. 31 * 32 * @param rule The Rule to create 33 * @throws IllegalArgumentException if the rule is null 34 * @throws IllegalStateException if the rule already exists in the system 35 */ 36 @CacheEvict(value={RuleDefinition.Cache.NAME}, allEntries = true) 37 public RuleDefinition createRule(RuleDefinition rule); 38 39 /** 40 * This will update an existing {@link RuleDefinition}. 41 * 42 * @param rule The Rule to update 43 * @throws IllegalArgumentException if the Rule is null 44 * @throws IllegalStateException if the Rule does not exists in the system 45 */ 46 @CacheEvict(value={RuleDefinition.Cache.NAME}, allEntries = true) 47 public void updateRule(RuleDefinition rule); 48 49 /** 50 * Delete the {@link RuleDefinition} with the given id. 51 * 52 * @param ruleId to delete. 53 * @throws IllegalArgumentException if the Rule is null. 54 * @throws IllegalStateException if the Rule does not exists in the system 55 * 56 */ 57 public void deleteRule(String ruleId); 58 59 /** 60 * Retrieves an Rule from the repository based on the given rule id. 61 * 62 * @param ruleId the id of the Rule to retrieve 63 * @return an {@link RuleDefinition} identified by the given actionId. 64 * A null reference is returned if an invalid or non-existent id is supplied. 65 * @throws IllegalArgumentException if the ruleId is null or blank. 66 */ 67 @Cacheable(value= RuleDefinition.Cache.NAME, key="'ruleId=' + #p0") 68 public RuleDefinition getRuleByRuleId(String ruleId); 69 70 /** 71 * Retrieves an Rule from the repository based on the provided rule name 72 * and namespace. 73 * 74 * @param name the name of the Rule to retrieve. 75 * @param namespace the namespace that the rule is under. 76 * @return an {@link RuleDefinition} identified by the given name and namespace. 77 * A null reference is returned if an invalid or non-existent name and 78 * namespace combination is supplied. 79 * @throws IllegalArgumentException if the either the name or the namespace 80 * is null or blank. 81 */ 82 @Cacheable(value= RuleDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1") 83 public RuleDefinition getRuleByNameAndNamespace(String name, String namespace); 84 85 // public void createRuleAttribute(RuleAttribute ruleAttribute); 86 // public void updateRuleAttribute(RuleAttribute ruleAttribute); 87 // 88 // public RuleAttribute getRuleAttributeById(String attrId); 89 90 // public void setBusinessObjectService(final BusinessObjectService businessObjectService); 91 // public List<RuleDefinition> convertListOfBosToImmutables(final Collection<RuleBo> ruleBos); 92 }