1 /**
2 * Copyright 2005-2012 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.kuali.rice.core.api.uif.RemotableAttributeErrorContract;
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.node.RouteNodeInstance;
41
42 /**
43 * WorkflowDocument is the core client API for interaction with the Kuali Enterprise Workflow system.
44 * WorkflowDocument is an object-oriented facade/bridge to stateless KEW APIs, which maintains document
45 * state, and flushes updates as actions are taken.
46 *
47 * WorkflowDocuments cannot be constructed directly, create them via the {@link WorkflowDocumentFactory}
48 *
49 * <p><b>This class is *not* thread safe.</b> If you are operating on the same document, be sure to synchronize
50 * access to the {@link WorkflowDocument} instance. If you are operating on different documents, obtain a distinct
51 * instance from the {@link WorkflowDocumentFactory}.</p>
52 */
53 public interface WorkflowDocument extends DocumentContract {
54 /**
55 * Returns the principalId with which this WorkflowDocument was constructed
56 * @return the principalId with which this WorkflowDocument was constructed
57 */
58 String getPrincipalId();
59 /**
60 * Switches the principalId under which WorkflowDocument API are performed.
61 * This method necessitates clearing of any state associated with the principalId
62 * such as requested and valid actions.
63 * @param principalId the new principalId
64 */
65 void switchPrincipal(String principalId);
66
67 /**
68 * Returns a read-only view of the underlying document meta-data
69 * @return a read-only view of the underlying document meta-data
70 */
71 Document getDocument();
72
73 /**
74 * Returns a read-only view of the underlying mutable document content
75 * @return a read-only view of the underlying mutable document content
76 */
77 DocumentContent getDocumentContent();
78
79 /**
80 * Returns the currently set application content.
81 * @return the currently set application content.
82 * @see #getDocumentContent()
83 */
84 String getApplicationContent();
85
86 /**
87 * Sets the document title. The update will be committed with the next document operation.
88 * @param title the document title to set
89 */
90 void setTitle(String title);
91
92 /**
93 * Sets the application document id. The update will be committed with the next document operation.
94 * @param applicationDocumentId the application document id to set.
95 */
96 void setApplicationDocumentId(String applicationDocumentId);
97
98 /**
99 * Sets the application document status. The update will be committed with the next document operation.
100 * @param applicationDocumentStatus the application document status to set
101 */
102 void setApplicationDocumentStatus(String applicationDocumentStatus);
103
104 /**
105 * Sets the document's application content. The update will be committed with the next document operation.
106 * @param applicationContent the document application content to set
107 */
108 void setApplicationContent(String applicationContent);
109
110 /**
111 * Sets the document's attribute content. The update will be committed with the next document operation.
112 * @param attributeContent the document attribute content to set
113 */
114 void setAttributeContent(String attributeContent);
115 /**
116 * Clears the document's attribute content. The update will be committed with the next document operation.
117 */
118 void clearAttributeContent();
119 /**
120 * Returns the currently set document attribute content.
121 */
122 String getAttributeContent();
123
124 /**
125 * Adds a workflow attribute definition. The update will be committed with the next document operation.
126 * @param attributeDefinition the WorkflowAttributeDefinition to add
127 */
128 void addAttributeDefinition(WorkflowAttributeDefinition attributeDefinition);
129 /**
130 * Removes a workflow attribute definition. The update will be committed with the next document operation.
131 * Equality is determined on the basis of WorkflowAttributeDefinition fields.
132 * @see org.kuali.rice.core.api.mo.AbstractDataTransferObject#equals(Object)
133 * @param attributeDefinition the WorkflowAttributeDefinition to remove
134 */
135 void removeAttributeDefinition(WorkflowAttributeDefinition attributeDefinition);
136 /**
137 * Clears workflow attribute definitions. The update will be committed with the next document operation.
138 */
139 void clearAttributeDefinitions();
140 /**
141 * Returns the currently set workflow attribute definitions
142 * @return the currently set workflow attribute definitions
143 */
144 List<WorkflowAttributeDefinition> getAttributeDefinitions();
145
146 /**
147 * Sets the document's searchable content. The update will be committed with the next document operation.
148 * @param searchableContent the searchable content to set
149 */
150 public void setSearchableContent(String searchableContent);
151 /**
152 * Adds a searchable workflow attribute definition. The update will be committed with the next document operation.
153 * @param searchableDefinition the WorkflowAttributeDefinition to add
154 */
155 void addSearchableDefinition(WorkflowAttributeDefinition searchableDefinition);
156 /**
157 * Removes a searchable workflow attribute definition. The update will be committed with the next document operation.
158 * Equality is determined on the basis of WorkflowAttributeDefinition fields.
159 * @see org.kuali.rice.core.api.mo.AbstractDataTransferObject#equals(Object)
160 * @param searchableDefinition the WorkflowAttributeDefinition to remove
161 */
162 void removeSearchableDefinition(WorkflowAttributeDefinition searchableDefinition);
163 /**
164 * Clears searchable workflow attribute definitions. The update will be committed with the next document operation.
165 */
166 void clearSearchableDefinitions();
167 /**
168 * Clears the searchable content. The update will be committed with the next document operation.
169 */
170 void clearSearchableContent();
171 /**
172 * Returns the currently set searchable workflow attribute definitions
173 * @return the currently set searchable workflow attribute definitions
174 */
175 List<WorkflowAttributeDefinition> getSearchableDefinitions();
176
177 /**
178 * Sets a workflow variable. The update will be committed with the next document operation.
179 * @see #getVariables()
180 * @param name variable name
181 * @param value variable value
182 */
183 void setVariable(String name, String value);
184 /**
185 * Gets a workflow variable value.
186 * @see #getVariables()
187 * @param name variable name
188 */
189 String getVariableValue(String name);
190 /**
191 * Sets the workflow variable that specifies that this principal should receive future requests
192 * @see KewApiConstants#RECEIVE_FUTURE_REQUESTS_BRANCH_STATE_KEY
193 * @see KewApiConstants#RECEIVE_FUTURE_REQUESTS_BRANCH_STATE_VALUE
194 */
195 void setReceiveFutureRequests();
196 /**
197 * Sets the workflow variable that specifies that this principal should NOT receive future requests
198 * @see KewApiConstants#RECEIVE_FUTURE_REQUESTS_BRANCH_STATE_KEY
199 * @see KewApiConstants#DONT_RECEIVE_FUTURE_REQUESTS_BRANCH_STATE_VALUE
200 */
201 void setDoNotReceiveFutureRequests();
202 /**
203 * Sets the workflow variable that specifies that ...
204 * TODO: what does this do? (org.kuali.rice.kew.util.FutureRequestDocumentStateManager#clearStateFromDocument)
205 * @see KewApiConstants#RECEIVE_FUTURE_REQUESTS_BRANCH_STATE_KEY
206 * @see KewApiConstants#CLEAR_FUTURE_REQUESTS_BRANCH_STATE_VALUE
207 */
208 void setClearFutureRequests();
209 /**
210 * Returns whether the workflow variable that specifies that this principal should receive future requests has been set
211 * @see #setReceiveFutureRequests()
212 * @return whether the workflow variable that specifies that this principal should receive future requests has been set
213 */
214 String getReceiveFutureRequestsValue();
215 /**
216 * Returns whether the workflow variable that specifies that this principal should NOT receive future requests has been set
217 * @see #setDoNotReceiveFutureRequests()
218 * @return whether the workflow variable that specifies that this principal should NOT receive future requests has been set
219 */
220 String getDoNotReceiveFutureRequestsValue();
221 /**
222 * Returns whether the workflow variable that specifies that ... has been set
223 * @return whether the workflow variable that specifies that ... has been set
224 */
225 String getClearFutureRequestsValue();
226
227 /**
228 * Validates a workflow attribute definition and returns a list of validation errors.
229 * This action is stateless and does not cause a commit of document updates.
230 *
231 * Implementation note: this is currently only used by EDL.
232 *
233 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#validateWorkflowAttributeDefinition(org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition)
234 * @param attributeDefinition the workflow attribute definition to validate
235 * @return list of attribute validation errors
236 */
237 List<? extends RemotableAttributeErrorContract> validateAttributeDefinition(WorkflowAttributeDefinition attributeDefinition);
238
239 /**
240 * Return the list of root action requests on the document.
241 * @return the list of root action requests on the document.
242 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getRootActionRequests(String)
243 */
244 List<ActionRequest> getRootActionRequests();
245
246 /**
247 * Return the list of past actions taken on the document
248 * @return the list of past actions taken on the document
249 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getActionsTaken(String)
250 */
251 List<ActionTaken> getActionsTaken();
252
253 /**
254 * Returns the list of valid actions on this document for the current user
255 * @return the list of valid actions on this document for the current user
256 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#determineValidActions(String, String)
257 */
258 ValidActions getValidActions();
259
260 /**
261 * Returns the list of requested actions on this document for the current user
262 * @return the list of requested actions on this document for the current user
263 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#determineRequestedActions(String, String)
264 */
265 RequestedActions getRequestedActions();
266
267 /**
268 * Saves the document, commits updates.
269 * @param annotation the document action annotation
270 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#save(org.kuali.rice.kew.api.action.DocumentActionParameters)
271 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
272 */
273 void saveDocument(String annotation);
274 /**
275 * Routes the document, commits updates.
276 * @param annotation the document action annotation
277 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#route(org.kuali.rice.kew.api.action.DocumentActionParameters)
278 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
279 */
280 void route(String annotation);
281 /**
282 * Completes the document, commits updates.
283 * @param annotation the document action annotation
284 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#complete(org.kuali.rice.kew.api.action.DocumentActionParameters)
285 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
286 */
287 void complete(String annotation);
288 /**
289 * Disapproves the document, commits updates.
290 * @param annotation the document action annotation
291 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#route(org.kuali.rice.kew.api.action.DocumentActionParameters)
292 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
293 */
294 void disapprove(String annotation);
295 /**
296 * Approves the document, commits updates.
297 * @param annotation the document action annotation
298 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#approve(org.kuali.rice.kew.api.action.DocumentActionParameters)
299 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
300 */
301 void approve(String annotation);
302 /**
303 * Approves the document, commits updates.
304 * @param annotation the document action annotation
305 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#approve(org.kuali.rice.kew.api.action.DocumentActionParameters)
306 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
307 */
308 void cancel(String annotation);
309 /**
310 * Cancels the document, commits updates.
311 * @param annotation the document action annotation
312 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#cancel(org.kuali.rice.kew.api.action.DocumentActionParameters)
313 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
314 */
315 void blanketApprove(String annotation);
316 /**
317 * Blanket-approves the document, commits updates.
318 * @param annotation the document action annotation
319 * @param nodeNames a set of node names to which to blanket approve the given document
320 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#blanketApproveToNodes(org.kuali.rice.kew.api.action.DocumentActionParameters, java.util.Set)
321 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
322 */
323 void blanketApprove(String annotation, String... nodeNames);
324 /**
325 * Save the document data without affecting routing, commits updates.
326 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#saveDocumentData(org.kuali.rice.kew.api.action.DocumentActionParameters)
327 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
328 */
329 void saveDocumentData();
330 /**
331 * Acknowledges the document, commits updates.
332 * @param annotation the document action annotation
333 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#acknowledge(org.kuali.rice.kew.api.action.DocumentActionParameters)
334 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
335 */
336 void acknowledge(String annotation);
337 /**
338 * Clears an outstanding FYI on the document, commits updates.
339 * @param annotation the document action annotation
340 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#clearFyi(org.kuali.rice.kew.api.action.DocumentActionParameters)
341 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
342 */
343 void fyi(String annotation);
344 /**
345 * Clears an outstanding FYI on the document without an annotation, commits updates.
346 * @see #fyi(String)
347 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
348 */
349 void fyi();
350 /**
351 * Deletes the document. Any pending updates are <b>NOT</b> committed, they are discarded.
352 * After deletion this WorkflowDocument object will no longer be valid, and any operations
353 * that interact with the workflow system will throws an {@link IllegalStateException}
354 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#delete(String, String)
355 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidActionTakenException
356 */
357 void delete();
358 /**
359 * Reloads the document state, any pending changes will be <i><b>discarded</b></i>
360 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException
361 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getDocument(String)
362 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException
363 */
364 void refresh();
365 /**
366 * Sends an "ad-hoc" action request to the specified principal; commits updates.
367 * @param actionRequested the request action type
368 * @param annotation the route annotation
369 * @param targetPrincipalId the target principal id
370 * @param responsibilityDescription description of the responsibility
371 * @param forceAction whether the adhoc requests forces action by the recipient
372 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToPrincipal(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToPrincipal)
373 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
374 */
375 void adHocToPrincipal(ActionRequestType actionRequested, String annotation,
376 String targetPrincipalId, String responsibilityDescription,
377 boolean forceAction);
378 /**
379 * Sends an "ad-hoc" action request to the specified principal; commits updates.
380 * @param actionRequested the request action type
381 * @param nodeName the node on which to generate the adhoc request
382 * @param annotation the route annotation
383 * @param targetPrincipalId the target principal id
384 * @param responsibilityDescription description of the responsibility
385 * @param forceAction whether the adhoc requests forces action by the recipient
386 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToPrincipal(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToPrincipal)
387 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
388 */
389 void adHocToPrincipal(ActionRequestType actionRequested, String nodeName,
390 String annotation, String targetPrincipalId,
391 String responsibilityDescription, boolean forceAction);
392 /**
393 * Sends an "ad-hoc" action request to the specified principal; commits updates.
394 * @param actionRequested the request action type
395 * @param nodeName the node on which to generate the adhoc request
396 * @param annotation the route annotation
397 * @param targetPrincipalId the target principal id
398 * @param responsibilityDescription description of the responsibility
399 * @param forceAction whether the adhoc requests forces action by the recipient
400 * @param requestLabel the request label
401 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToPrincipal(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToPrincipal)
402 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
403 */
404 void adHocToPrincipal(ActionRequestType actionRequested, String nodeName,
405 String annotation, String targetPrincipalId,
406 String responsibilityDescription, boolean forceAction,
407 String requestLabel);
408 /**
409 * Sends an "ad-hoc" action request to the specified principal; commits updates.
410 * @param adHocToPrincipal a pre-constructed AdHocToPrincipal object
411 * @param annotation the route annotation
412 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToPrincipal(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToPrincipal)
413 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
414 */
415 void adHocToPrincipal(AdHocToPrincipal adHocToPrincipal, String annotation);
416 /**
417 * Sends an "ad-hoc" action request to the specified group; commits updates.
418 * @param actionRequested the request action type
419 * @param annotation the route annotation
420 * @param targetGroupId the target group id
421 * @param responsibilityDescription description of the responsibility
422 * @param forceAction whether the adhoc requests forces action by the recipient
423 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToGroup(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToGroup)
424 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
425 */
426 void adHocToGroup(ActionRequestType actionRequested, String annotation,
427 String targetGroupId, String responsibilityDescription,
428 boolean forceAction);
429 /**
430 * Sends an "ad-hoc" action request to the specified group; commits updates.
431 * @param actionRequested the request action type
432 * @param nodeName the node on which to generate the adhoc request
433 * @param annotation the route annotation
434 * @param targetGroupId the target group id
435 * @param responsibilityDescription description of the responsibility
436 * @param forceAction whether the adhoc requests forces action by the recipient
437 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToGroup(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToGroup)
438 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
439 */
440 void adHocToGroup(ActionRequestType actionRequested, String nodeName,
441 String annotation, String targetGroupId,
442 String responsibilityDescription, boolean forceAction);
443 /**
444 * Sends an "ad-hoc" action request to the specified principal; commits updates.
445 * @param actionRequested the request action type
446 * @param nodeName the node on which to generate the adhoc request
447 * @param annotation the route annotation
448 * @param targetGroupId the target group id
449 * @param responsibilityDescription description of the responsibility
450 * @param forceAction whether the adhoc requests forces action by the recipient
451 * @param requestLabel the request label
452 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToGroup(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToGroup)
453 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
454 */
455 void adHocToGroup(ActionRequestType actionRequested, String nodeName,
456 String annotation, String targetGroupId,
457 String responsibilityDescription, boolean forceAction,
458 String requestLabel);
459 /**
460 * Sends an "ad-hoc" action request to the specified principal; commits updates.
461 * @param adHocToGroup a pre-constructed AdHocToGroup object
462 * @param annotation the route annotation
463 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#adHocToPrincipal(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocToPrincipal)
464 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
465 */
466 void adHocToGroup(AdHocToGroup adHocToGroup, String annotation);
467 /**
468 * Revokes an Ad-Hoc request by id; commits updates.
469 * @param actionRequestId the action request id to revoke
470 * @param annotation the routing annotation
471 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#revokeAdHocRequestById(org.kuali.rice.kew.api.action.DocumentActionParameters, String)
472 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
473 */
474 void revokeAdHocRequestById(String actionRequestId, String annotation);
475 /**
476 * Revokes an Ad-Hoc request by the specified criteria; commits updates.
477 * @param revoke the criteria for matching ad hoc action requests on the specified document that
478 * should be revoked
479 * @param annotation the routing annotation
480 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#revokeAdHocRequests(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.AdHocRevoke)
481 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
482 */
483 void revokeAdHocRequests(AdHocRevoke revoke, String annotation);
484 /**
485 * Revokes all Ad-Hoc requests; commits updates; commits updates.
486 * @param annotation the routing annotation
487 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#revokeAllAdHocRequests(org.kuali.rice.kew.api.action.DocumentActionParameters)
488 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
489 */
490 void revokeAllAdHocRequests(String annotation);
491 /**
492 * Returns the document to a previous node; commits updates.
493 * @param nodeName the node to return to
494 * @param annotation the routing annotation
495 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#returnToPreviousNode(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.ReturnPoint)
496 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
497 */
498 void returnToPreviousNode(String nodeName, String annotation);
499 /**
500 * Returns the document to a previous node; commits updates.
501 * @param returnPoint the node to return to
502 * @param annotation the routing annotation
503 * @see #returnToPreviousNode(String, String)
504 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#returnToPreviousNode(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.ReturnPoint)
505 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
506 */
507 void returnToPreviousNode(ReturnPoint returnPoint, String annotation);
508 /**
509 * Moves the document to a different node; commits updates.
510 * @param movePoint the node to move to
511 * @param annotation the routing annotation
512 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#move(org.kuali.rice.kew.api.action.DocumentActionParameters, org.kuali.rice.kew.api.action.MovePoint)
513 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
514 */
515 void move(MovePoint movePoint, String annotation);
516 /**
517 * Takes authority of a group by a member of that group; commits updates.
518 * @param annotation the routing annotation
519 * @param groupId the group for which to take authority
520 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#takeGroupAuthority(org.kuali.rice.kew.api.action.DocumentActionParameters, String)
521 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
522 */
523 void takeGroupAuthority(String annotation, String groupId);
524 /**
525 * Releases authority of a group by a member of that group; commits updates.
526 * @param annotation the routing annotation
527 * @param groupId the group for which to take authority
528 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#releaseGroupAuthority(org.kuali.rice.kew.api.action.DocumentActionParameters, String)
529 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
530 */
531 void releaseGroupAuthority(String annotation, String groupId);
532
533 /**
534 * Places the document in exception routing; commits updates.
535 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#placeInExceptionRouting(org.kuali.rice.kew.api.action.DocumentActionParameters)
536 * @param annotation the routing annotation
537 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
538 */
539 void placeInExceptionRouting(String annotation);
540
541 /**
542 * Performs a super-user blanket-approve action; commits updates.
543 * The current user must be a super-user for this document.
544 * @param annotation the routing annotation
545 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#superUserBlanketApprove(org.kuali.rice.kew.api.action.DocumentActionParameters, boolean)
546 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
547 */
548 void superUserBlanketApprove(String annotation);
549 /**
550 * Performs a super-user approve action for the specified node; commits updates.
551 * The current user must be a super-user for this document.
552 * @param nodeName the node to super-user approve
553 * @param annotation the routing annotation
554 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#superUserNodeApprove(org.kuali.rice.kew.api.action.DocumentActionParameters, boolean, String)
555 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
556 */
557 void superUserNodeApprove(String nodeName, String annotation);
558 /**
559 * Performs a super-user approve action for the specified node; commits updates.
560 * The current user must be a super-user for this document.
561 * @param actionRequestId the action request to satisfy/approve
562 * @param annotation the routing annotation
563 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#superUserTakeRequestedAction(org.kuali.rice.kew.api.action.DocumentActionParameters, boolean, String)
564 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
565 */
566 void superUserTakeRequestedAction(String actionRequestId, String annotation);
567 /**
568 * Performs a super-user disapprove action; commits updates.
569 * The current user must be a super-user for this document.
570 * @param annotation the routing annotation
571 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#superUserDisapprove(org.kuali.rice.kew.api.action.DocumentActionParameters, boolean)
572 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
573 */
574 void superUserDisapprove(String annotation);
575 /**
576 * Performs a super-user cancel action; commits updates.
577 * The current user must be a super-user for this document.
578 * @param annotation the routing annotation
579 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#superUserCancel(org.kuali.rice.kew.api.action.DocumentActionParameters, boolean)
580 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
581 */
582 void superUserCancel(String annotation);
583 /**
584 * Performs a super-user "return to previous node" action; commits updates.
585 * The current user must be a super-user for this document.
586 * @param returnPoint the node to return to
587 * @param annotation the routing annotation
588 * @see org.kuali.rice.kew.api.action.WorkflowDocumentActionsService#superUserReturnToPreviousNode(org.kuali.rice.kew.api.action.DocumentActionParameters, boolean, org.kuali.rice.kew.api.action.ReturnPoint)
589 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidDocumentContentException, InvalidActionTakenException
590 */
591 void superUserReturnToPreviousNode(ReturnPoint returnPoint, String annotation);
592 /**
593 * Records a log action which adds an annotation on the document but does not affect routing.
594 * This action is stateless and does not cause a commit of document updates.
595 * @param annotation the annotation to log
596 * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException, InvalidActionTakenException
597 */
598 void logAnnotation(String annotation);
599
600 /**
601 * Returns whether a completion request is one of the requested actions.
602 * @see #getRequestedActions()
603 * @return whether a completion request is one of the requested actions.
604 */
605 boolean isCompletionRequested();
606 /**
607 * Returns whether an approval request is one of the requested actions.
608 * @see #getRequestedActions()
609 * @return whether an approval request is one of the requested actions.
610 */
611 boolean isApprovalRequested();
612 /**
613 * Returns whether an acknowledge request is one of the requested actions.
614 * @see #getRequestedActions()
615 * @return whether an acknowledge request is one of the requested actions.
616 */
617 boolean isAcknowledgeRequested();
618 /**
619 * Returns whether an FYI is one of the requested actions.
620 * @see #getRequestedActions()
621 * @return whether an FYI is one of the requested actions.
622 */
623 boolean isFYIRequested();
624
625 /**
626 * Returns whether a blank-approve action is a valid action.
627 * @see #getValidActions()
628 * @return whether a blank-approve action is a valid action.
629 */
630 boolean isBlanketApproveCapable();
631 /**
632 * Returns whether a route action is a valid action.
633 * @see #getValidActions()
634 * @return whether a route action is a valid action.
635 */
636 boolean isRouteCapable();
637 /**
638 * Returns whether the specified action type is valid
639 * @param actionType the non-null ActionType to check
640 * @see #getValidActions()
641 * @return whether the specified action type is valid
642 */
643 boolean isValidAction(ActionType actionType);
644
645 /**
646 * Helper that checks whether the document has the given status
647 * NOTE: does this really need to be in the public API? it only appears to be used internally
648 * @see #getStatus()
649 * @param status the status to check
650 * @return whether the document status is the specified status
651 */
652 boolean checkStatus(DocumentStatus status);
653 /**
654 * Indicates if the document is in the initiated state or not.
655 * @see #getStatus()
656 * @return true if in the specified state
657 */
658 boolean isInitiated();
659 /**
660 * Indicates if the document is in the saved state or not.
661 * @see #getStatus()
662 * @return true if in the specified state
663 */
664 boolean isSaved();
665 /**
666 * Indicates if the document is in the enroute state or not.
667 * @see #getStatus()
668 * @return true if in the specified state
669 */
670 boolean isEnroute();
671 /**
672 * Indicates if the document is in the exception state or not.
673 * @see #getStatus()
674 * @return true if in the specified state
675 */
676 boolean isException();
677 /**
678 * Indicates if the document is in the canceled state or not.
679 * @see #getStatus()
680 * @return true if in the specified state
681 */
682 boolean isCanceled();
683 /**
684 * Indicates if the document is in the disapproved state or not.
685 * @see #getStatus()
686 * @return true if in the specified state
687 */
688 boolean isDisapproved();
689 /**
690 * Indicates if the document is in the Processed or Finalized state.
691 * @see #getStatus()
692 * @return true if in the specified state
693 */
694 boolean isApproved();
695 /**
696 * Indicates if the document is in the processed state or not.
697 * @see #getStatus()
698 * @return true if in the specified state
699 */
700 boolean isProcessed();
701 /**
702 * Indicates if the document is in the final state or not.
703 * @see #getStatus()
704 * @return true if in the specified state
705 */
706 boolean isFinal();
707
708 /**
709 * Returns the names of the route nodes on the document which are currently active.
710 *
711 * <p>If the document has completed its routing (i.e. it is in processed or final status) then this method may
712 * return an empty set since no nodes are active at that time. In order to get either the active *or* terminal
713 * nodes, use the {@link #getCurrentNodeNames()} method.</p>
714 *
715 * @see #getActiveRouteNodeInstances()
716 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getActiveRouteNodeInstances(String)
717 * @return an unmodifiable set containing the names of the active nodes for this document
718 */
719 Set<String> getNodeNames();
720 /**
721 * Returns the names of the nodes at which the document is currently at in it's route path.
722 *
723 * <p>This method differs from {@link #getNodeNames()} in the fact that if there are no active nodes, it will
724 * return the last nodes on the document instead (a.k.a. the document's terminal nodes).</p>
725 *
726 * @see #getCurrentRouteNodeInstances()
727 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getCurrentRouteNodeInstances(String)
728 * @return an unmodifiable set containing the names of the nodes at which this document is currently located within it's route path
729 */
730 Set<String> getCurrentNodeNames();
731 /**
732 * Returns the list of active route node instances
733 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getActiveRouteNodeInstances(String)
734 * @return the list of active route node instances
735 */
736 List<RouteNodeInstance> getActiveRouteNodeInstances();
737 /**
738 * Returns the list of active route node instances
739 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getCurrentRouteNodeInstances(String)
740 * @return the list of active route node instances
741 */
742 List<RouteNodeInstance> getCurrentRouteNodeInstances();
743 /**
744 * Returns the flattened list of route node instances
745 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getRouteNodeInstances(String)
746 * @return the flattened list of route node instances
747 */
748 List<RouteNodeInstance> getRouteNodeInstances();
749 /**
750 * Returns the list of previous route node names
751 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getPreviousRouteNodeNames(String)
752 * @return the list of previous route node names
753 */
754 List<String> getPreviousNodeNames();
755
756
757 /**
758 * Returns detailed document information
759 * TODO: consolidate with Document/ModifiableDocument or eliminate? currently bypasses
760 * locally cached Document data
761 * @see org.kuali.rice.kew.api.document.WorkflowDocumentService#getDocumentDetail(String)
762 * @return detailed document information
763 */
764 DocumentDetail getDocumentDetail();
765 /**
766 * Sets internal DocumentContentUpdate object
767 * TODO: exposes internal API and used only by tests, candidate for elimination?
768 * @param documentContentUpdate the DocumentContentUpdate to set
769 */
770 void updateDocumentContent(DocumentContentUpdate documentContentUpdate);
771 }