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 java.util.List;
19
20 import org.kuali.rice.krms.api.repository.action.ActionDefinition;
21 import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition;
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 Action related
27 * business objects.
28 *
29 * @author Kuali Rice Team (rice.collab@kuali.org)
30 *
31 */
32 public interface ActionBoService {
33
34 /**
35 * This will create a {@link ActionDefinition} exactly like the parameter passed in.
36 *
37 * @param action The Action to create
38 * @throws IllegalArgumentException if the action is null
39 * @throws IllegalStateException if the action already exists in the system
40 */
41 @CacheEvict(value={ActionDefinition.Cache.NAME}, allEntries = true)
42 public ActionDefinition createAction(ActionDefinition action);
43
44 /**
45 * This will update an existing {@link ActionDefinition}.
46 *
47 * @param action The Action to update
48 * @throws IllegalArgumentException if the Action is null
49 * @throws IllegalStateException if the Action does not exists in the system
50 */
51 @CacheEvict(value={ActionDefinition.Cache.NAME}, allEntries = true)
52 public void updateAction(ActionDefinition action);
53
54 /**
55 * Retrieves an Action from the repository based on the given action id.
56 *
57 * @param actionId the id of the Action to retrieve
58 * @return an {@link ActionDefinition} identified by the given actionId.
59 * A null reference is returned if an invalid or non-existent id is supplied.
60 * @throws IllegalArgumentException if the actionId is null or blank.
61 */
62 @Cacheable(value= ActionDefinition.Cache.NAME, key="'actionId=' + #p0")
63 public ActionDefinition getActionByActionId(String actionId);
64
65 /**
66 * Retrieves an Action from the repository based on the provided action name
67 * and namespace.
68 *
69 * @param name the name of the Action to retrieve.
70 * @param namespace the namespace that the action is under.
71 * @return an {@link ActionDefinition} identified by the given name and namespace.
72 * A null reference is returned if an invalid or non-existent name and
73 * namespace combination is supplied.
74 * @throws IllegalArgumentException if the either the name or the namespace
75 * is null or blank.
76 */
77 @Cacheable(value= ActionDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1")
78 public ActionDefinition getActionByNameAndNamespace(String name, String namespace);
79
80 /**
81 * Retrieves an ordered List of Actions associated with a
82 * {@link org.kuali.rice.krms.api.repository.rule.RuleDefinition}.
83 * The order of the list is determined by the sequenceNumber property
84 * of the Actions.
85 *
86 * @param ruleId the id of the rule
87 * @return a list of {@link ActionDefinition} associated with the given rule.
88 * A null reference is returned if an invalid or ruleId is supplied.
89 * @throws IllegalArgumentException if the ruleId is null or blank.
90 */
91 @Cacheable(value= ActionDefinition.Cache.NAME, key="'ruleId=' + #p0")
92 public List<ActionDefinition> getActionsByRuleId(String ruleId);
93
94 /**
95 * Retrieves an specific Action associated with a Rule.
96 *
97 * @param ruleId the id of the rule
98 * @param sequenceNumber an Integer that represents the sequence number of the action.
99 * @return an {@link ActionDefinition} identified associated with the
100 * Rule and identified by the given sequenceNumber
101 * A null reference is returned if an invalid or non-existent name and
102 * namespace combination is supplied.
103 * @throws IllegalArgumentException if the ruleId is null or blank. Or
104 * if the sequenceNumber is null.
105 */
106 @Cacheable(value= ActionDefinition.Cache.NAME, key="'ruleId=' + #p0 + '|' + 'sequenceNumber=' + #p1")
107 public ActionDefinition getActionByRuleIdAndSequenceNumber(String ruleId, Integer sequenceNumber);
108
109 // public ActionAttribute createActionAttribute(ActionAttribute actionAttribute);
110 // public void updateActionAttribute(ActionAttribute actionAttribute);
111
112 }