KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > action > ActionService


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.service.cmr.action;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.List JavaDoc;
21 import java.util.Map JavaDoc;
22
23 import org.alfresco.service.cmr.repository.NodeRef;
24
25 /**
26  * Action service interface
27  *
28  * @author Roy Wetherall
29  */

30 public interface ActionService
31 {
32     /**
33      * Get a named action definition
34      *
35      * @param name the name of the action definition
36      * @return the action definition
37      */

38     ActionDefinition getActionDefinition(String JavaDoc name);
39     
40     /**
41      * Get all the action definitions
42      *
43      * @return the list action definitions
44      */

45     List JavaDoc<ActionDefinition> getActionDefinitions();
46     
47     /**
48      * Get a named action condition definition
49      *
50      * @param name the name of the action condition definition
51      * @return the action condition definition
52      */

53     ActionConditionDefinition getActionConditionDefinition(String JavaDoc name);
54     
55     /**
56      * Get all the action condition definitions
57      *
58      * @return the list of aciton condition definitions
59      */

60     List JavaDoc<ActionConditionDefinition> getActionConditionDefinitions();
61     
62     /**
63      * Create a new action
64      *
65      * @param name the action definition name
66      * @return the action
67      */

68     Action createAction(String JavaDoc name);
69     
70     /**
71      * Create a new action specifying the initial set of parameter values
72      *
73      * @param name the action defintion name
74      * @param params the parameter values
75      * @return the action
76      */

77     Action createAction(String JavaDoc name, Map JavaDoc<String JavaDoc, Serializable JavaDoc> params);
78     
79     /**
80      * Create a composite action
81      *
82      * @return the composite action
83      */

84     CompositeAction createCompositeAction();
85     
86     /**
87      * Create an action condition
88      *
89      * @param name the action condition definition name
90      * @return the action condition
91      */

92     ActionCondition createActionCondition(String JavaDoc name);
93     
94     /**
95      * Create an action condition specifying the initial set of parameter values
96      *
97      * @param name the aciton condition definition name
98      * @param params the parameter valeus
99      * @return the action condition
100      */

101     ActionCondition createActionCondition(String JavaDoc name, Map JavaDoc<String JavaDoc, Serializable JavaDoc> params);
102     
103     /**
104      * The actions conditions are always checked.
105      *
106      * @see ActionService#executeAction(Action, NodeRef, boolean)
107      *
108      * @param action the action
109      * @param actionedUponNodeRef the actioned upon node reference
110      */

111     void executeAction(Action action, NodeRef actionedUponNodeRef);
112     
113     /**
114      * The action is sexecuted based on the asynchronous attribute of the action.
115      *
116      * @see ActionService#executeAction(Action, NodeRef, boolean, boolean)
117      *
118      * @param action the action
119      * @param actionedUponNodeRef the actioned upon node reference
120      * @param checkConditions indicates whether the conditions should be checked
121      */

122     void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions);
123     
124     /**
125      * Executes the specified action upon the node reference provided.
126      * <p>
127      * If specified that the conditions should be checked then any conditions
128      * set on the action are evaluated.
129      * <p>
130      * If the conditions fail then the action is not executed.
131      * <p>
132      * If an action has no conditions then the action will always be executed.
133      * <p>
134      * If the conditions are not checked then the action will always be executed.
135      *
136      * @param action the action
137      * @param actionedUponNodeRef the actioned upon node reference
138      * @param checkConditions indicates whether the conditions should be checked before
139      * executing the action
140      * @param executeAsynchronously indicates whether the action should be executed asychronously or not, this value overrides
141      * the value set on the action its self
142      */

143     void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsynchronously);
144     
145     /**
146      * Evaluted the conditions set on an action.
147      * <p>
148      * Returns true if the action has no conditions.
149      * <p>
150      * If the action has more than one condition their results are combined using the 'AND'
151      * logical operator.
152      *
153      * @param action the action
154      * @param actionedUponNodeRef the actioned upon node reference
155      * @return true if the condition succeeds, false otherwise
156      */

157     boolean evaluateAction(Action action, NodeRef actionedUponNodeRef);
158     
159     /**
160      * Evaluate an action condition.
161      *
162      * @param condition the action condition
163      * @param actionedUponNodeRef the actioned upon node reference
164      * @return true if the condition succeeds, false otherwise
165      */

166     boolean evaluateActionCondition(ActionCondition condition, NodeRef actionedUponNodeRef);
167     
168     /**
169      * Save an action against a node reference.
170      * <p>
171      * The node will be made configurable if it is not already.
172      * <p>
173      * If the action already exists then its details will be updated.
174      *
175      * @param nodeRef the node reference
176      * @param action the action
177      */

178     void saveAction(NodeRef nodeRef, Action action);
179     
180     /**
181      * Gets all the actions currently saved on the given node reference.
182      *
183      * @param nodeRef the ndoe reference
184      * @return the list of actions
185      */

186     List JavaDoc<Action> getActions(NodeRef nodeRef);
187     
188     /**
189      * Gets an action stored against a given node reference.
190      * <p>
191      * Returns null if the action can not be found.
192      *
193      * @param nodeRef the node reference
194      * @param actionId the action id
195      * @return the action
196      */

197     Action getAction(NodeRef nodeRef, String JavaDoc actionId);
198     
199     /**
200      * Removes an action associatied with a node reference.
201      *
202      * @param nodeRef the node reference
203      * @param action the action
204      */

205     void removeAction(NodeRef nodeRef, Action action);
206     
207     /**
208      * Removes all actions associated with a node reference
209      *
210      * @param nodeRef the node reference
211      */

212     void removeAllActions(NodeRef nodeRef);
213     
214 }
215
Popular Tags