KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > node > NodeServicePolicies


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.node;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.alfresco.repo.policy.AssociationPolicy;
23 import org.alfresco.repo.policy.ClassPolicy;
24 import org.alfresco.service.cmr.repository.ChildAssociationRef;
25 import org.alfresco.service.cmr.repository.AssociationRef;
26 import org.alfresco.service.cmr.repository.NodeRef;
27 import org.alfresco.service.cmr.repository.StoreRef;
28 import org.alfresco.service.namespace.QName;
29
30 /**
31  * Node service policies
32  *
33  * @author Roy Wetherall
34  */

35 public interface NodeServicePolicies
36 {
37     public interface BeforeCreateStorePolicy extends ClassPolicy
38     {
39         /**
40          * Called before a new node store is created.
41          *
42          * @param nodeTypeQName the type of the node that will be used for the root
43          * @param storeRef the reference to the store about to be created
44          */

45         public void beforeCreateStore(QName nodeTypeQName, StoreRef storeRef);
46     }
47     
48     public interface OnCreateStorePolicy extends ClassPolicy
49     {
50         /**
51          * Called when a new node store has been created.
52          *
53          * @param rootNodeRef the reference to the newly created root node
54          */

55         public void onCreateStore(NodeRef rootNodeRef);
56     }
57
58     public interface BeforeCreateNodePolicy extends ClassPolicy
59     {
60         /**
61          * Called before a new node is created.
62          *
63          * @param parentRef the parent node reference
64          * @param assocTypeQName the association type qualified name
65          * @param assocQName the association qualified name
66          * @param nodeTypeQName the node type qualified name
67          */

68         public void beforeCreateNode(
69                         NodeRef parentRef,
70                         QName assocTypeQName,
71                         QName assocQName,
72                         QName nodeTypeQName);
73     }
74     
75     public interface OnCreateNodePolicy extends ClassPolicy
76     {
77         /**
78          * Called when a new node has been created.
79          *
80          * @param childAssocRef the created child association reference
81          */

82         public void onCreateNode(ChildAssociationRef childAssocRef);
83     }
84
85     public interface BeforeUpdateNodePolicy extends ClassPolicy
86     {
87         /**
88          * Called before a node is updated. This includes the modification of properties, child and target
89          * associations and the addition of aspects.
90          *
91          * @param nodeRef reference to the node being updated
92          */

93         public void beforeUpdateNode(NodeRef nodeRef);
94     }
95     
96     public interface OnUpdateNodePolicy extends ClassPolicy
97     {
98         /**
99          * Called after a new node has been created. This includes the modification of properties, child and target
100          * associations and the addition of aspects.
101          *
102          * @param nodeRef reference to the updated node
103          */

104         public void onUpdateNode(NodeRef nodeRef);
105     }
106     
107     public interface OnUpdatePropertiesPolicy extends ClassPolicy
108     {
109         /**
110          * Called after a node's properties have been changed.
111          *
112          * @param nodeRef reference to the updated node
113          * @param before the node's properties before the change
114          * @param after the node's properties after the change
115          */

116         public void onUpdateProperties(
117                 NodeRef nodeRef,
118                 Map JavaDoc<QName, Serializable JavaDoc> before,
119                 Map JavaDoc<QName, Serializable JavaDoc> after);
120     }
121     
122     public interface BeforeDeleteNodePolicy extends ClassPolicy
123     {
124         /**
125          * Called before a node is deleted.
126          *
127          * @param nodeRef the node reference
128          */

129         public void beforeDeleteNode(NodeRef nodeRef);
130     }
131     
132     public interface OnDeleteNodePolicy extends ClassPolicy
133     {
134         /**
135          * Called after a node is deleted. The reference given is for an association
136          * which has been deleted and cannot be used to retrieve node or associaton
137          * information from any of the services.
138          *
139          * @param childAssocRef the primary parent-child association of the deleted node
140          */

141         public void onDeleteNode(ChildAssociationRef childAssocRef);
142     }
143     
144     public interface BeforeAddAspectPolicy extends ClassPolicy
145     {
146         /**
147          * Called before an <b>aspect</b> is added to a node
148          *
149          * @param nodeRef the node to which the aspect will be added
150          * @param aspectTypeQName the type of the aspect
151          */

152         public void beforeAddAspect(NodeRef nodeRef, QName aspectTypeQName);
153     }
154
155     public interface OnAddAspectPolicy extends ClassPolicy
156     {
157         /**
158          * Called after an <b>aspect</b> has been added to a node
159          *
160          * @param nodeRef the node to which the aspect was added
161          * @param aspectTypeQName the type of the aspect
162          */

163         public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName);
164     }
165
166     public interface BeforeRemoveAspectPolicy extends ClassPolicy
167     {
168         /**
169          * Called before an <b>aspect</b> is removed from a node
170          *
171          * @param nodeRef the node from which the aspect will be removed
172          * @param aspectTypeQName the type of the aspect
173          */

174         public void beforeRemoveAspect(NodeRef nodeRef, QName aspectTypeQName);
175     }
176
177     public interface OnRemoveAspectPolicy extends ClassPolicy
178     {
179         /**
180          * Called after an <b>aspect</b> has been removed from a node
181          *
182          * @param nodeRef the node from which the aspect will be removed
183          * @param aspectTypeQName the type of the aspect
184          */

185         public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName);
186     }
187
188     public interface BeforeCreateChildAssociationPolicy extends AssociationPolicy
189     {
190         /**
191          * Called before a node child association is created.
192          *
193          * @param parentNodeRef
194          * @param childNodeRef
195          * @param assocTypeQName the type of the association
196          * @param assocQName the name of the association
197          */

198         public void beforeCreateChildAssociation(
199                 NodeRef parentNodeRef,
200                 NodeRef childNodeRef,
201                 QName assocTypeQName,
202                 QName assocQName);
203     }
204     
205     public interface OnCreateChildAssociationPolicy extends AssociationPolicy
206     {
207         /**
208          * Called after a node child association has been created.
209          *
210          * @param childAssocRef the child association that has been created
211          */

212         public void onCreateChildAssociation(ChildAssociationRef childAssocRef);
213     }
214     
215     public interface BeforeDeleteChildAssociationPolicy extends AssociationPolicy
216     {
217         /**
218          * Called before a node child association is deleted.
219          *
220          * @param childAssocRef the child association to be deleted
221          */

222         public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef);
223     }
224     
225     public interface OnDeleteChildAssociationPolicy extends AssociationPolicy
226     {
227         /**
228          * Called after a node child association has been deleted.
229          *
230          * @param childAssocRef the child association that has been deleted
231          */

232         public void onDeleteChildAssociation(ChildAssociationRef childAssocRef);
233     }
234
235     public interface OnCreateAssociationPolicy extends AssociationPolicy
236     {
237         /**
238          * Called after a regular node association is created.
239          *
240          * @param nodeAssocRef the regular node association that was created
241          */

242         public void onCreateAssociation(AssociationRef nodeAssocRef);
243     }
244     
245     public interface OnDeleteAssociationPolicy extends AssociationPolicy
246     {
247         /**
248          * Called after a regular node association is deleted.
249          *
250          * @param nodeAssocRef the regular node association that was removed
251          */

252         public void onDeleteAssociation(AssociationRef nodeAssocRef);
253     }
254 }
255
Popular Tags