KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > action > ActionImpl


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.repo.action;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.ArrayList JavaDoc;
21 import java.util.Date JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24 import java.util.Set JavaDoc;
25
26 import org.alfresco.service.cmr.action.Action;
27 import org.alfresco.service.cmr.action.ActionCondition;
28 import org.alfresco.service.cmr.repository.NodeRef;
29
30 /**
31  * Action implementation
32  *
33  * @author Roy Wetherall
34  */

35 public class ActionImpl extends ParameterizedItemImpl
36                         implements Serializable JavaDoc, Action
37 {
38     /**
39      * Serial version UID
40      */

41     private static final long serialVersionUID = 3258135760426186548L;
42     
43     /**
44      * The title
45      */

46     private String JavaDoc title;
47     
48     /**
49      * The description
50      */

51     private String JavaDoc description;
52
53     /**
54      * Inidcates whether the action should be executed asynchronously or not
55      */

56     private boolean executeAsynchronously = false;
57     
58     /**
59      * The compensating action
60      */

61     private Action compensatingAction;
62     
63     /**
64      * The created date
65      */

66     private Date JavaDoc createdDate;
67     
68     /**
69      * The creator
70      */

71     private String JavaDoc creator;
72     
73     /**
74      * The modified date
75      */

76     private Date JavaDoc modifiedDate;
77     
78     /**
79      * The modifier
80      */

81     private String JavaDoc modifier;
82     
83     /**
84      * Rule action definition name
85      */

86     private String JavaDoc actionDefinitionName;
87     
88     /**
89      * The run as user name
90      */

91     private String JavaDoc runAsUserName;
92     
93     /**
94      * The owning node reference
95      */

96     private NodeRef owningNodeRef;
97     
98     /**
99      * The chain of actions that have lead to this action
100      */

101     private Set JavaDoc<String JavaDoc> actionChain;
102     
103     /**
104      * Action conditions
105      */

106     private List JavaDoc<ActionCondition> actionConditions = new ArrayList JavaDoc<ActionCondition>();
107
108     /**
109      * Constructor
110      *
111      * @param id the action id
112      * @param actionDefinitionName the name of the action definition
113      */

114     public ActionImpl(String JavaDoc id, String JavaDoc actionDefinitionName, NodeRef owningNodeRef)
115     {
116         this(id, actionDefinitionName, owningNodeRef, null);
117     }
118
119     /**
120      * Constructor
121      *
122      * @param id the action id
123      * @param actionDefinitionName the action definition name
124      * @param parameterValues the parameter values
125      */

126     public ActionImpl(
127             String JavaDoc id,
128             String JavaDoc actionDefinitionName,
129             NodeRef owningNodeRef,
130             Map JavaDoc<String JavaDoc, Serializable JavaDoc> parameterValues)
131     {
132         super(id, parameterValues);
133         this.actionDefinitionName = actionDefinitionName;
134         this.owningNodeRef = owningNodeRef;
135     }
136     
137     /**
138      * @see org.alfresco.service.cmr.action.Action#getTitle()
139      */

140     public String JavaDoc getTitle()
141     {
142         return this.title;
143     }
144
145     /**
146      * @see org.alfresco.service.cmr.action.Action#setTitle(java.lang.String)
147      */

148     public void setTitle(String JavaDoc title)
149     {
150         this.title = title;
151     }
152
153     /**
154      * @see org.alfresco.service.cmr.action.Action#getDescription()
155      */

156     public String JavaDoc getDescription()
157     {
158         return this.description;
159     }
160
161     /**
162      * @see org.alfresco.service.cmr.action.Action#setDescription(java.lang.String)
163      */

164     public void setDescription(String JavaDoc description)
165     {
166         this.description = description;
167     }
168     
169     /**
170      * @see org.alfresco.service.cmr.action.Action#getOwningNodeRef()
171      */

172     public NodeRef getOwningNodeRef()
173     {
174         return this.owningNodeRef;
175     }
176     
177     public void setOwningNodeRef(NodeRef owningNodeRef)
178     {
179         this.owningNodeRef = owningNodeRef;
180     }
181     
182     /**
183      * @see org.alfresco.service.cmr.action.Action#getExecuteAsychronously()
184      */

185     public boolean getExecuteAsychronously()
186     {
187         return this.executeAsynchronously ;
188     }
189
190     /**
191      * @see org.alfresco.service.cmr.action.Action#setExecuteAsynchronously(boolean)
192      */

193     public void setExecuteAsynchronously(boolean executeAsynchronously)
194     {
195         this.executeAsynchronously = executeAsynchronously;
196     }
197     
198     /**
199      * @see org.alfresco.service.cmr.action.Action#getCompensatingAction()
200      */

201     public Action getCompensatingAction()
202     {
203         return this.compensatingAction;
204     }
205     
206     /**
207      * @see org.alfresco.service.cmr.action.Action#setCompensatingAction(org.alfresco.service.cmr.action.Action)
208      */

209     public void setCompensatingAction(Action action)
210     {
211         this.compensatingAction = action;
212     }
213
214     /**
215      * @see org.alfresco.service.cmr.action.Action#getCreatedDate()
216      */

217     public Date JavaDoc getCreatedDate()
218     {
219         return this.createdDate;
220     }
221     
222     /**
223      * Set the created date
224      *
225      * @param createdDate the created date
226      */

227     public void setCreatedDate(Date JavaDoc createdDate)
228     {
229         this.createdDate = createdDate;
230     }
231
232     /**
233      * @see org.alfresco.service.cmr.action.Action#getCreator()
234      */

235     public String JavaDoc getCreator()
236     {
237         return this.creator;
238     }
239     
240     /**
241      * Set the creator
242      *
243      * @param creator the creator
244      */

245     public void setCreator(String JavaDoc creator)
246     {
247         this.creator = creator;
248     }
249
250     /**
251      * @see org.alfresco.service.cmr.action.Action#getModifiedDate()
252      */

253     public Date JavaDoc getModifiedDate()
254     {
255         return this.modifiedDate;
256     }
257     
258     /**
259      * Set the modified date
260      *
261      * @param modifiedDate the modified date
262      */

263     public void setModifiedDate(Date JavaDoc modifiedDate)
264     {
265         this.modifiedDate = modifiedDate;
266     }
267
268     /**
269      * @see org.alfresco.service.cmr.action.Action#getModifier()
270      */

271     public String JavaDoc getModifier()
272     {
273         return this.modifier;
274     }
275     
276     /**
277      * Set the modifier
278      *
279      * @param modifier the modifier
280      */

281     public void setModifier(String JavaDoc modifier)
282     {
283         this.modifier = modifier;
284     }
285     
286     /**
287      * @see org.alfresco.service.cmr.action.Action#getActionDefinitionName()
288      */

289     public String JavaDoc getActionDefinitionName()
290     {
291         return this.actionDefinitionName;
292     }
293
294     /**
295      * @see org.alfresco.service.cmr.action.Action#hasActionConditions()
296      */

297     public boolean hasActionConditions()
298     {
299         return (this.actionConditions.isEmpty() == false);
300     }
301
302     /**
303      * @see org.alfresco.service.cmr.action.Action#indexOfActionCondition(org.alfresco.service.cmr.action.ActionCondition)
304      */

305     public int indexOfActionCondition(ActionCondition actionCondition)
306     {
307         return this.actionConditions.indexOf(actionCondition);
308     }
309
310     /**
311      * @see org.alfresco.service.cmr.action.Action#getActionConditions()
312      */

313     public List JavaDoc<ActionCondition> getActionConditions()
314     {
315         return this.actionConditions;
316     }
317
318     /**
319      * @see org.alfresco.service.cmr.action.Action#getActionCondition(int)
320      */

321     public ActionCondition getActionCondition(int index)
322     {
323         return this.actionConditions.get(index);
324     }
325
326     /**
327      * @see org.alfresco.service.cmr.action.Action#addActionCondition(org.alfresco.service.cmr.action.ActionCondition)
328      */

329     public void addActionCondition(ActionCondition actionCondition)
330     {
331         this.actionConditions.add(actionCondition);
332     }
333
334     /**
335      * @see org.alfresco.service.cmr.action.Action#addActionCondition(int, org.alfresco.service.cmr.action.ActionCondition)
336      */

337     public void addActionCondition(int index, ActionCondition actionCondition)
338     {
339         this.actionConditions.add(index, actionCondition);
340     }
341
342     /**
343      * @see org.alfresco.service.cmr.action.Action#setActionCondition(int, org.alfresco.service.cmr.action.ActionCondition)
344      */

345     public void setActionCondition(int index, ActionCondition actionCondition)
346     {
347         this.actionConditions.set(index, actionCondition);
348     }
349
350     /**
351      * @see org.alfresco.service.cmr.action.Action#removeActionCondition(org.alfresco.service.cmr.action.ActionCondition)
352      */

353     public void removeActionCondition(ActionCondition actionCondition)
354     {
355         this.actionConditions.remove(actionCondition);
356     }
357
358     /**
359      * @see org.alfresco.service.cmr.action.Action#removeAllActionConditions()
360      */

361     public void removeAllActionConditions()
362     {
363         this.actionConditions.clear();
364     }
365     
366     /**
367      * Set the action chain
368      *
369      * @param actionChain the list of actions that lead to this action
370      */

371     public void setActionChain(Set JavaDoc<String JavaDoc> actionChain)
372     {
373         this.actionChain = actionChain;
374     }
375     
376     /**
377      * Get the action chain
378      *
379      * @return the list of actions that lead to this action
380      */

381     public Set JavaDoc<String JavaDoc> getActionChain()
382     {
383         return actionChain;
384     }
385
386     public String JavaDoc getRunAsUser()
387     {
388         return this.runAsUserName;
389     }
390
391     public void setRunAsUser(String JavaDoc runAsUserName)
392     {
393         this.runAsUserName = runAsUserName;
394     }
395 }
396
Popular Tags