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