View Javadoc

1   /**
2    * Copyright 2005-2011 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.kew.api;
17  
18  import java.util.List;
19  import java.util.Set;
20  
21  import org.joda.time.DateTime;
22  import org.kuali.rice.kew.api.action.ActionRequest;
23  import org.kuali.rice.kew.api.action.ActionRequestType;
24  import org.kuali.rice.kew.api.action.ActionTaken;
25  import org.kuali.rice.kew.api.action.ActionType;
26  import org.kuali.rice.kew.api.action.AdHocRevoke;
27  import org.kuali.rice.kew.api.action.AdHocToGroup;
28  import org.kuali.rice.kew.api.action.AdHocToPrincipal;
29  import org.kuali.rice.kew.api.action.MovePoint;
30  import org.kuali.rice.kew.api.action.RequestedActions;
31  import org.kuali.rice.kew.api.action.ReturnPoint;
32  import org.kuali.rice.kew.api.action.ValidActions;
33  import org.kuali.rice.kew.api.document.Document;
34  import org.kuali.rice.kew.api.document.DocumentContent;
35  import org.kuali.rice.kew.api.document.DocumentContentUpdate;
36  import org.kuali.rice.kew.api.document.DocumentContract;
37  import org.kuali.rice.kew.api.document.DocumentDetail;
38  import org.kuali.rice.kew.api.document.DocumentStatus;
39  import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
40  import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeValidationError;
41  import org.kuali.rice.kew.api.document.node.RouteNodeInstance;
42  
43  /**
44   * TODO ..
45   * 
46   * TODO - it is intended that operations against document data on this are only "flushed" when an action is performed...
47   * 
48   * <p>This class is *not* thread safe.
49   *
50   */
51  public interface WorkflowDocument extends DocumentContract {
52  
53  	String getDocumentId();
54  
55  	Document getDocument();
56  
57  	DocumentContent getDocumentContent();
58  
59  	String getApplicationContent();
60  
61  	void setApplicationContent(String applicationContent);
62  
63      public void setAttributeContent(String attributeContent);
64  	
65  	void clearAttributeContent();
66  
67  	String getAttributeContent();
68  
69  	void addAttributeDefinition(WorkflowAttributeDefinition attributeDefinition);
70  
71  	void removeAttributeDefinition(
72  			WorkflowAttributeDefinition attributeDefinition);
73  
74  	void clearAttributeDefinitions();
75  
76  	List<WorkflowAttributeDefinition> getAttributeDefinitions();
77  
78  	public void setSearchableContent(String searchableContent);
79  	
80  	void addSearchableDefinition(
81  			WorkflowAttributeDefinition searchableDefinition);
82  
83  	void removeSearchableDefinition(
84  			WorkflowAttributeDefinition searchableDefinition);
85  
86  	void clearSearchableDefinitions();
87  
88  	void clearSearchableContent();
89  
90  	List<WorkflowAttributeDefinition> getSearchableDefinitions();
91  
92  	List<WorkflowAttributeValidationError> validateAttributeDefinition(
93  			WorkflowAttributeDefinition attributeDefinition);
94  
95  	List<ActionRequest> getRootActionRequests();
96  
97  	List<ActionTaken> getActionsTaken();
98  
99  	void setApplicationDocumentId(String applicationDocumentId);
100 
101 	String getApplicationDocumentId();
102 
103 	DateTime getDateCreated();
104 
105 	String getTitle();
106 
107 	ValidActions getValidActions();
108 
109 	RequestedActions getRequestedActions();
110 
111 	void saveDocument(String annotation);
112 
113 	void route(String annotation);
114 
115 	void disapprove(String annotation);
116 
117 	void approve(String annotation);
118 
119 	void cancel(String annotation);
120 
121 	void blanketApprove(String annotation);
122 
123 	void blanketApprove(String annotation, String... nodeNames);
124 
125 	void saveDocumentData();
126 
127 	void setApplicationDocumentStatus(String applicationDocumentStatus);
128 
129 	void acknowledge(String annotation);
130 
131 	void fyi(String annotation);
132 
133 	void fyi();
134 
135 	/**
136 	 * TODO - be sure to mention that once this document is deleted, this api effectively becomes "dead" when you try to
137 	 * execute any document operation
138 	 */
139 	void delete();
140 
141 	void refresh();
142 
143 	void adHocToPrincipal(ActionRequestType actionRequested, String annotation,
144 			String targetPrincipalId, String responsibilityDescription,
145 			boolean forceAction);
146 
147 	void adHocToPrincipal(ActionRequestType actionRequested, String nodeName,
148 			String annotation, String targetPrincipalId,
149 			String responsibilityDescription, boolean forceAction);
150 
151 	void adHocToPrincipal(ActionRequestType actionRequested, String nodeName,
152 			String annotation, String targetPrincipalId,
153 			String responsibilityDescription, boolean forceAction,
154 			String requestLabel);
155 
156     void adHocToPrincipal(AdHocToPrincipal adHocToPrincipal, String annotation);
157 
158 	void adHocToGroup(ActionRequestType actionRequested, String annotation,
159 			String targetGroupId, String responsibilityDescription,
160 			boolean forceAction);
161 
162 	void adHocToGroup(ActionRequestType actionRequested, String nodeName,
163 			String annotation, String targetGroupId,
164 			String responsibilityDescription, boolean forceAction);
165 
166 	void adHocToGroup(ActionRequestType actionRequested, String nodeName,
167 			String annotation, String targetGroupId,
168 			String responsibilityDescription, boolean forceAction,
169 			String requestLabel);
170 
171     void adHocToGroup(AdHocToGroup adHocToGroup, String annotation);
172 
173 	void revokeAdHocRequestById(String actionRequestId, String annotation);
174 
175 	void revokeAdHocRequests(AdHocRevoke revoke, String annotation);
176 
177 	void revokeAllAdHocRequests(String annotation);
178 
179 	void setTitle(String title);
180 
181 	String getDocumentTypeName();
182 
183 	boolean isCompletionRequested();
184 
185 	boolean isApprovalRequested();
186 
187 	boolean isAcknowledgeRequested();
188 
189 	boolean isFYIRequested();
190 
191 	boolean isBlanketApproveCapable();
192 
193 	boolean isRouteCapable();
194 
195 	boolean isValidAction(ActionType actionType);
196 
197 	void superUserBlanketApprove(String annotation);
198 
199 	void superUserNodeApprove(String nodeName, String annotation);
200 
201 	void superUserTakeRequestedAction(String actionRequestId, String annotation);
202 
203 	void superUserDisapprove(String annotation);
204 
205 	void superUserCancel(String annotation);
206 
207 	void superUserReturnToPreviousNode(ReturnPoint returnPoint,
208 			String annotation);
209 
210 	void complete(String annotation);
211 
212 	void logAnnotation(String annotation);
213 
214 	DocumentStatus getStatus();
215 
216 	boolean checkStatus(DocumentStatus status);
217 
218 	/**
219 	 * Indicates if the document is in the initiated state or not.
220 	 *
221 	 * @return true if in the specified state
222 	 */
223 	boolean isInitiated();
224 
225 	/**
226 	 * Indicates if the document is in the saved state or not.
227 	 *
228 	 * @return true if in the specified state
229 	 */
230 	boolean isSaved();
231 
232 	/**
233 	 * Indicates if the document is in the enroute state or not.
234 	 *
235 	 * @return true if in the specified state
236 	 */
237 	boolean isEnroute();
238 
239 	/**
240 	 * Indicates if the document is in the exception state or not.
241 	 *
242 	 * @return true if in the specified state
243 	 */
244 	boolean isException();
245 
246 	/**
247 	 * Indicates if the document is in the canceled state or not.
248 	 *
249 	 * @return true if in the specified state
250 	 */
251 	boolean isCanceled();
252 
253 	/**
254 	 * Indicates if the document is in the disapproved state or not.
255 	 *
256 	 * @return true if in the specified state
257 	 */
258 	boolean isDisapproved();
259 
260 	/**
261 	 * Indicates if the document is in the Processed or Finalized state.
262 	 *
263 	 * @return true if in the specified state
264 	 */
265 	boolean isApproved();
266 
267 	/**
268 	 * Indicates if the document is in the processed state or not.
269 	 *
270 	 * @return true if in the specified state
271 	 */
272 	boolean isProcessed();
273 
274 	/**
275 	 * Indicates if the document is in the final state or not.
276 	 *
277 	 * @return true if in the specified state
278 	 */
279 	boolean isFinal();
280 
281 	/**
282 	 * Returns the principalId with which this WorkflowDocument was constructed
283 	 * 
284 	 * @return the principalId with which this WorkflowDocument was constructed
285 	 */
286 	String getPrincipalId();
287 
288 	void switchPrincipal(String principalId);
289 
290 	void takeGroupAuthority(String annotation, String groupId);
291 
292 	void releaseGroupAuthority(String annotation, String groupId);
293 
294     /**
295      * Returns the names of the route nodes on the document which are currently active.
296      *
297      * <p>If the document has completed it's routing (i.e. it is in processed or final status) then this method may
298      * return an empty set since no nodes are active at that time.  In order to get either the active *or* terminal
299      * nodes, use the {@link #getCurrentNodeNames()} method.</p>
300      *
301      * @return an unmodifiable set containing the names of the active nodes for this document
302      */
303 	Set<String> getNodeNames();
304 
305     /**
306      * Returns the names of the nodes at which the document is currently at in it's route path.
307      *
308      * <p>This method differs from {@link #getNodeNames()} in the fact that if there are no active nodes, it will
309      * return the last nodes on the document instead (a.k.a. the document's terminal nodes).</p>
310      *
311      * @return an unmodifiable set containing the names of the nodes at which this document is currently located within it's route path
312      */
313     Set<String> getCurrentNodeNames();
314 
315 	void returnToPreviousNode(String nodeName, String annotation);
316 
317 	void returnToPreviousNode(ReturnPoint returnPoint, String annotation);
318 
319 	void move(MovePoint movePoint, String annotation);
320 
321 	List<RouteNodeInstance> getActiveRouteNodeInstances();
322 
323     List<RouteNodeInstance> getCurrentRouteNodeInstances();
324 
325 	List<RouteNodeInstance> getRouteNodeInstances();
326 
327 	List<String> getPreviousNodeNames();
328 
329 	DocumentDetail getDocumentDetail();
330 
331 	void updateDocumentContent(DocumentContentUpdate documentContentUpdate);
332 
333 	void placeInExceptionRouting(String annotation);
334 
335 	void setVariable(String name, String value);
336 
337 	String getVariableValue(String name);
338 
339 	void setReceiveFutureRequests();
340 
341 	void setDoNotReceiveFutureRequests();
342 
343 	void setClearFutureRequests();
344 
345 	String getReceiveFutureRequestsValue();
346 
347 	String getDoNotReceiveFutureRequestsValue();
348 
349 	String getClearFutureRequestsValue();
350 
351 }