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.action.ActionDefinition; 19 import org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition; 20 import org.kuali.rice.krms.api.repository.proposition.PropositionDefinition; 21 import org.kuali.rice.krms.api.repository.rule.RuleDefinition; 22 import org.springframework.cache.annotation.CacheEvict; 23 import org.springframework.cache.annotation.Cacheable; 24 25 /** 26 * This is the interface for accessing KRMS repository Rule related bos 27 * 28 * @author Kuali Rice Team (rice.collab@kuali.org) 29 * 30 */ 31 public interface RuleBoService { 32 /** 33 * This will create a {@link RuleDefinition} exactly like the parameter passed in. 34 * 35 * @param rule The Rule to create 36 * @throws IllegalArgumentException if the rule is null 37 * @throws IllegalStateException if the rule already exists in the system 38 */ 39 @CacheEvict(value={RuleDefinition.Cache.NAME, PropositionDefinition.Cache.NAME, ActionDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME}, allEntries = true) 40 public RuleDefinition createRule(RuleDefinition rule); 41 42 /** 43 * This will update an existing {@link RuleDefinition}. 44 * 45 * @param rule The Rule to update 46 * @throws IllegalArgumentException if the Rule is null 47 * @throws IllegalStateException if the Rule does not exists in the system 48 */ 49 @CacheEvict(value={RuleDefinition.Cache.NAME, PropositionDefinition.Cache.NAME, ActionDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME}, allEntries = true) 50 public RuleDefinition updateRule(RuleDefinition rule); 51 52 /** 53 * Delete the {@link RuleDefinition} with the given id. 54 * 55 * @param ruleId to delete. 56 * @throws IllegalArgumentException if the Rule is null. 57 * @throws IllegalStateException if the Rule does not exists in the system 58 * 59 */ 60 public void deleteRule(String ruleId); 61 62 /** 63 * Retrieves an Rule from the repository based on the given rule id. 64 * 65 * @param ruleId the id of the Rule to retrieve 66 * @return an {@link RuleDefinition} identified by the given actionId. 67 * A null reference is returned if an invalid or non-existent id is supplied. 68 * @throws IllegalArgumentException if the ruleId is null or blank. 69 */ 70 @Cacheable(value= RuleDefinition.Cache.NAME, key="'ruleId=' + #p0") 71 public RuleDefinition getRuleByRuleId(String ruleId); 72 73 /** 74 * Retrieves an Rule from the repository based on the provided rule name 75 * and namespace. 76 * 77 * @param name the name of the Rule to retrieve. 78 * @param namespace the namespace that the rule is under. 79 * @return an {@link RuleDefinition} identified by the given name and namespace. 80 * A null reference is returned if an invalid or non-existent name and 81 * namespace combination is supplied. 82 * @throws IllegalArgumentException if the either the name or the namespace 83 * is null or blank. 84 */ 85 @Cacheable(value= RuleDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1") 86 public RuleDefinition getRuleByNameAndNamespace(String name, String namespace); 87 88 }