1 /**
2 * Copyright 2005-2013 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 * Retrieves an Rule from the repository based on the given rule id.
51 *
52 * @param ruleId the id of the Rule to retrieve
53 * @return an {@link RuleDefinition} identified by the given actionId.
54 * A null reference is returned if an invalid or non-existent id is supplied.
55 * @throws IllegalArgumentException if the ruleId is null or blank.
56 */
57 @Cacheable(value= RuleDefinition.Cache.NAME, key="'ruleId=' + #p0")
58 public RuleDefinition getRuleByRuleId(String ruleId);
59
60 /**
61 * Retrieves an Rule from the repository based on the provided rule name
62 * and namespace.
63 *
64 * @param name the name of the Rule to retrieve.
65 * @param namespace the namespace that the rule is under.
66 * @return an {@link RuleDefinition} identified by the given name and namespace.
67 * A null reference is returned if an invalid or non-existent name and
68 * namespace combination is supplied.
69 * @throws IllegalArgumentException if the either the name or the namespace
70 * is null or blank.
71 */
72 @Cacheable(value= RuleDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1")
73 public RuleDefinition getRuleByNameAndNamespace(String name, String namespace);
74
75 // public void createRuleAttribute(RuleAttribute ruleAttribute);
76 // public void updateRuleAttribute(RuleAttribute ruleAttribute);
77 //
78 // public RuleAttribute getRuleAttributeById(String attrId);
79
80 // public void setBusinessObjectService(final BusinessObjectService businessObjectService);
81 // public List<RuleDefinition> convertListOfBosToImmutables(final Collection<RuleBo> ruleBos);
82 }