KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.ArrayList JavaDoc;
20 import java.util.List JavaDoc;
21
22 import org.alfresco.repo.action.executer.CompositeActionExecuter;
23 import org.alfresco.service.cmr.action.Action;
24 import org.alfresco.service.cmr.action.CompositeAction;
25 import org.alfresco.service.cmr.repository.NodeRef;
26
27 /**
28  * Composite action implementation
29  *
30  * @author Roy Wetherall
31  */

32 public class CompositeActionImpl extends ActionImpl implements CompositeAction
33 {
34     /**
35      * Serial version UID
36      */

37     private static final long serialVersionUID = -5348203599304776812L;
38     
39     /**
40      * The action list
41      */

42     private List JavaDoc<Action> actions = new ArrayList JavaDoc<Action>();
43     
44     /**
45      * Constructor
46      *
47      * @param id the action id
48      */

49     public CompositeActionImpl(String JavaDoc id, NodeRef owningNodeRef)
50     {
51         super(id, CompositeActionExecuter.NAME, owningNodeRef);
52     }
53
54     /**
55      * @see org.alfresco.service.cmr.action.CompositeAction#hasActions()
56      */

57     public boolean hasActions()
58     {
59         return (this.actions.isEmpty() == false);
60     }
61
62     /**
63      * @see org.alfresco.service.cmr.action.CompositeAction#addAction(org.alfresco.service.cmr.action.Action)
64      */

65     public void addAction(Action action)
66     {
67         this.actions.add(action);
68     }
69
70     /**
71      * @see org.alfresco.service.cmr.action.CompositeAction#addAction(int, org.alfresco.service.cmr.action.Action)
72      */

73     public void addAction(int index, Action action)
74     {
75         this.actions.add(index, action);
76     }
77
78     /**
79      * @see org.alfresco.service.cmr.action.CompositeAction#setAction(int, org.alfresco.service.cmr.action.Action)
80      */

81     public void setAction(int index, Action action)
82     {
83         this.actions.set(index, action);
84     }
85
86     /**
87      * @see org.alfresco.service.cmr.action.CompositeAction#indexOfAction(org.alfresco.service.cmr.action.Action)
88      */

89     public int indexOfAction(Action action)
90     {
91         return this.actions.indexOf(action);
92     }
93
94     /**
95      * @see org.alfresco.service.cmr.action.CompositeAction#getActions()
96      */

97     public List JavaDoc<Action> getActions()
98     {
99         return this.actions;
100     }
101
102     /**
103      * @see org.alfresco.service.cmr.action.CompositeAction#getAction(int)
104      */

105     public Action getAction(int index)
106     {
107         return this.actions.get(index);
108     }
109
110     /**
111      * @see org.alfresco.service.cmr.action.CompositeAction#removeAction(org.alfresco.service.cmr.action.Action)
112      */

113     public void removeAction(Action action)
114     {
115         this.actions.remove(action);
116     }
117
118     /**
119      * @see org.alfresco.service.cmr.action.CompositeAction#removeAllActions()
120      */

121     public void removeAllActions()
122     {
123         this.actions.clear();
124     }
125
126 }
127
Popular Tags