Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KualiWorkflowDocument |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2005-2007 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.kns.workflow.service; | |
17 | ||
18 | import java.sql.Timestamp; | |
19 | import java.util.Set; | |
20 | ||
21 | import org.kuali.rice.kew.dto.ReturnPointDTO; | |
22 | import org.kuali.rice.kew.dto.RouteHeaderDTO; | |
23 | import org.kuali.rice.kew.dto.UserIdDTO; | |
24 | import org.kuali.rice.kew.dto.WorkflowAttributeDefinitionDTO; | |
25 | import org.kuali.rice.kew.exception.InvalidActionTakenException; | |
26 | import org.kuali.rice.kew.exception.ResourceUnavailableException; | |
27 | import org.kuali.rice.kew.exception.WorkflowException; | |
28 | import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; | |
29 | import org.kuali.rice.kew.service.WorkflowDocumentActions; | |
30 | import org.kuali.rice.kim.bo.Person; | |
31 | ||
32 | public interface KualiWorkflowDocument { | |
33 | ||
34 | public abstract String getApplicationContent(); | |
35 | ||
36 | /** | |
37 | * Sets the application specific document content. | |
38 | */ | |
39 | public abstract void setApplicationContent(String applicationContent); | |
40 | ||
41 | /** | |
42 | * Clears all attribute document content from the document. Typically, this will be used if it is necessary to update the | |
43 | * attribute doc content on the document. This can be accomplished by clearing the content and then adding the desired attribute | |
44 | * definitions. | |
45 | * | |
46 | * In order for these changes to take effect, an action must be performed on the document (such as "save"). | |
47 | */ | |
48 | public abstract void clearAttributeContent(); | |
49 | ||
50 | /** | |
51 | * Returns the attribute-generated document content. | |
52 | */ | |
53 | public abstract String getAttributeContent(); | |
54 | ||
55 | /** | |
56 | * Adds an attribute definition which defines creation parameters for a WorkflowAttribute implementation. The created attribute | |
57 | * will be used to generate attribute document content. When the document is sent to the server, this will be appended to the | |
58 | * existing attribute doc content. If it is required to replace the attribute document content, then the clearAttributeContent() | |
59 | * method should be invoked prior to adding attribute definitions. | |
60 | */ | |
61 | public abstract void addAttributeDefinition(WorkflowAttributeDefinitionDTO attributeDefinition); | |
62 | ||
63 | public abstract void removeAttributeDefinition(WorkflowAttributeDefinitionDTO attributeDefinition); | |
64 | ||
65 | public abstract void clearAttributeDefinitions(); | |
66 | ||
67 | public abstract WorkflowAttributeDefinitionDTO[] getAttributeDefinitions(); | |
68 | ||
69 | /** | |
70 | * Adds a searchable attribute definition which defines creation parameters for a SearchableAttribute implementation. The | |
71 | * created attribute will be used to generate searchable document content. When the document is sent to the server, this will be | |
72 | * appended to the existing searchable doc content. If it is required to replace the searchable document content, then the | |
73 | * clearSearchableContent() method should be invoked prior to adding definitions. | |
74 | */ | |
75 | public abstract void addSearchableDefinition(WorkflowAttributeDefinitionDTO searchableDefinition); | |
76 | ||
77 | public abstract void removeSearchableDefinition(WorkflowAttributeDefinitionDTO searchableDefinition); | |
78 | ||
79 | public abstract void clearSearchableDefinitions(); | |
80 | ||
81 | public abstract WorkflowAttributeDefinitionDTO[] getSearchableDefinitions(); | |
82 | ||
83 | // ######################## | |
84 | public abstract RouteHeaderDTO getRouteHeader(); | |
85 | ||
86 | public abstract Long getRouteHeaderId() throws WorkflowException; | |
87 | ||
88 | public abstract void setAppDocId(String appDocId); | |
89 | ||
90 | public abstract String getAppDocId(); | |
91 | ||
92 | /** | |
93 | * @deprecated use getInitiatorPrincipalId instead, invocation of this method forces a lookup of the principal name which may be inefficient | |
94 | */ | |
95 | public abstract String getInitiatorNetworkId(); | |
96 | ||
97 | /** | |
98 | * @deprecated use getRoutedByPrincipalId instead, invocation of this method forces a lookup of the principal name which may be inefficient | |
99 | */ | |
100 | public abstract String getRoutedByUserNetworkId(); | |
101 | ||
102 | public abstract String getInitiatorPrincipalId(); | |
103 | ||
104 | public abstract String getRoutedByPrincipalId(); | |
105 | ||
106 | public abstract String getTitle(); | |
107 | ||
108 | public abstract void saveDocument(String annotation) throws WorkflowException; | |
109 | ||
110 | public abstract void routeDocument(String annotation) throws WorkflowException; | |
111 | ||
112 | public abstract void disapprove(String annotation) throws WorkflowException; | |
113 | ||
114 | public abstract void approve(String annotation) throws WorkflowException; | |
115 | ||
116 | public abstract void superUserApprove(String annotation) throws WorkflowException; | |
117 | ||
118 | public void superUserActionRequestApprove(Long actionRequestId, String annotation) throws WorkflowException; | |
119 | ||
120 | public void superUserCancel(String annotation) throws WorkflowException; | |
121 | ||
122 | public void superUserDisapprove(String annotation) throws WorkflowException; | |
123 | ||
124 | public abstract void cancel(String annotation) throws WorkflowException; | |
125 | ||
126 | public abstract void blanketApprove(String annotation) throws WorkflowException; | |
127 | ||
128 | public abstract void blanketApprove(String annotation, Integer routeLevel) throws WorkflowException; | |
129 | ||
130 | public abstract void saveRoutingData() throws WorkflowException; | |
131 | ||
132 | public abstract void acknowledge(String annotation) throws WorkflowException; | |
133 | ||
134 | public abstract void fyi() throws WorkflowException; | |
135 | ||
136 | public abstract void delete() throws WorkflowException; | |
137 | ||
138 | public abstract void refreshContent() throws WorkflowException; | |
139 | ||
140 | public abstract void adHocRouteDocumentToPrincipal(String actionRequested, String routeTypeName, String annotation, String principalId, String responsibilityDesc, boolean forceAction) throws WorkflowException; | |
141 | ||
142 | public abstract void adHocRouteDocumentToGroup(String actionRequested, String routeTypeName, String annotation, String groupId, String responsibilityDesc, boolean forceAction) throws WorkflowException; | |
143 | ||
144 | public abstract void adHocRouteDocumentToPrincipal(String actionRequested, String routeTypeName, String annotation, String principalId, String responsibilityDesc, boolean forceAction, String actionRequestLabel) throws WorkflowException; | |
145 | ||
146 | public abstract void adHocRouteDocumentToGroup(String actionRequested, String routeTypeName, String annotation, String groupId, String responsibilityDesc, boolean forceAction, String actionRequestLabel) throws WorkflowException; | |
147 | ||
148 | public abstract void setTitle(String title) throws WorkflowException; | |
149 | ||
150 | public abstract String getDocumentType(); | |
151 | ||
152 | /** | |
153 | * This method determines whether workflowDocument.getUserId() currently has an ad hoc request is his/her action list | |
154 | * | |
155 | * @return boolean indicating whether there is an active ad hoc request for this user | |
156 | */ | |
157 | public boolean isAdHocRequested(); | |
158 | ||
159 | /** | |
160 | * | |
161 | * Returns true if the user currently has this document in their Action List with an Acknowledge Request. | |
162 | * | |
163 | * The user in this case is whatever user was passed in when the document was loaded. This is typically the current webapp user. | |
164 | * | |
165 | * @return true if the user has the document in their Action List waiting for an Acknowledgement, false otherwise. | |
166 | * | |
167 | */ | |
168 | public abstract boolean isAcknowledgeRequested(); | |
169 | ||
170 | /** | |
171 | * | |
172 | * Returns true if the user currently has this document in their Action List with an Approval Request. | |
173 | * | |
174 | * The user in this case is whatever user was passed in when the document was loaded. This is typically the current webapp user. | |
175 | * | |
176 | * @return true if the user has the document in their Action List waiting for an Approval, false otherwise. | |
177 | * | |
178 | */ | |
179 | public abstract boolean isApprovalRequested(); | |
180 | ||
181 | /** | |
182 | * | |
183 | * Returns true if the user currently has this document in their Action List with an Completion Request. | |
184 | * | |
185 | * The user in this case is whatever user was passed in when the document was loaded. This is typically the current webapp user. | |
186 | * | |
187 | * @return true if the user has the document in their Action List waiting for a Completion, false otherwise. | |
188 | * | |
189 | */ | |
190 | public abstract boolean isCompletionRequested(); | |
191 | ||
192 | /** | |
193 | * | |
194 | * Returns true if the user currently has this document in their Action List with an FYI. | |
195 | * | |
196 | * The user in this case is whatever user was passed in when the document was loaded. This is typically the current webapp user. | |
197 | * | |
198 | * @return true if the user has the document in their Action List waiting for an FYI, false otherwise. | |
199 | * | |
200 | */ | |
201 | public abstract boolean isFYIRequested(); | |
202 | ||
203 | /** | |
204 | * | |
205 | * Returns true if the user is authorized to Blanket Approve this document. | |
206 | * | |
207 | * The user in this case is whatever user was passed in when the document was loaded. This is typically the current webapp user. | |
208 | * | |
209 | * @return true if the user is authorized to Blanket Approve this document, false otherwise. | |
210 | * | |
211 | */ | |
212 | public abstract boolean isBlanketApproveCapable(); | |
213 | ||
214 | /** | |
215 | * Checks to see if this document is allowed to have a standard 'save' performed | |
216 | * | |
217 | * @return true if the saveDocument() method is valid to be called.... false otherwise | |
218 | */ | |
219 | public boolean isStandardSaveAllowed(); | |
220 | ||
221 | public abstract Integer getDocRouteLevel(); | |
222 | ||
223 | /** | |
224 | * @param annotation | |
225 | * @throws InvalidActionTakenException | |
226 | * @throws ResourceUnavailableException | |
227 | * @throws WorkflowException | |
228 | */ | |
229 | public abstract void complete(String annotation) throws WorkflowException; | |
230 | ||
231 | /** | |
232 | * Performs the 'returnToPrevious' action on the document this WorkflowDocument represents. If this is a new document, | |
233 | * the document is created first. | |
234 | * @param annotation the message to log for the action | |
235 | * @param nodeName the node to return to | |
236 | * @throws WorkflowException in case an error occurs returning to previous node | |
237 | * @see WorkflowDocumentActions#returnDocumentToPreviousNode(UserIdDTO, RouteHeaderDTO, ReturnPointDTO, String) | |
238 | */ | |
239 | public void returnToPreviousNode(String annotation, String nodeName) throws WorkflowException; | |
240 | ||
241 | /** | |
242 | * Performs the 'returnToPrevious' action on the document this WorkflowDocument represents. If this is a new document, | |
243 | * the document is created first. | |
244 | * @param annotation the message to log for the action | |
245 | * @param ReturnPointDTO the node to return to | |
246 | * @throws WorkflowException in case an error occurs returning to previous node | |
247 | * @see WorkflowDocumentActions#returnDocumentToPreviousNode(UserIdDTO, RouteHeaderDTO, ReturnPointDTO, String) | |
248 | */ | |
249 | public void returnToPreviousNode(String annotation, ReturnPointDTO returnPoint) throws WorkflowException; | |
250 | ||
251 | /** | |
252 | * @param annotation | |
253 | * @param destRouteLevel | |
254 | * @throws WorkflowException | |
255 | * @throws InvalidActionTakenException | |
256 | * @throws ResourceUnavailableException | |
257 | */ | |
258 | public abstract void returnToPreviousRouteLevel(String annotation, Integer destRouteLevel) throws WorkflowException; | |
259 | ||
260 | public abstract void logDocumentAction(String annotation) throws WorkflowException; | |
261 | ||
262 | /** | |
263 | * Indicates if the document is in the initated state or not. | |
264 | * | |
265 | * @return true if in the specified state | |
266 | */ | |
267 | public abstract boolean stateIsInitiated(); | |
268 | ||
269 | /** | |
270 | * Indicates if the document is in the saved state or not. | |
271 | * | |
272 | * @return true if in the specified state | |
273 | */ | |
274 | public abstract boolean stateIsSaved(); | |
275 | ||
276 | /** | |
277 | * Indicates if the document is in the enroute state or not. | |
278 | * | |
279 | * @return true if in the specified state | |
280 | */ | |
281 | public abstract boolean stateIsEnroute(); | |
282 | ||
283 | ||
284 | /** | |
285 | * Indicates if the document is in the final state or not. | |
286 | * | |
287 | * @return true if in the specified state | |
288 | */ | |
289 | public abstract boolean stateIsFinal(); | |
290 | ||
291 | /** | |
292 | * Indicates if the document is in the exception state or not. | |
293 | * | |
294 | * @return true if in the specified state | |
295 | */ | |
296 | public abstract boolean stateIsException(); | |
297 | ||
298 | /** | |
299 | * Indicates if the document is in the canceled state or not. | |
300 | * | |
301 | * @return true if in the specified state | |
302 | */ | |
303 | public abstract boolean stateIsCanceled(); | |
304 | ||
305 | /** | |
306 | * Indicates if the document is in the disapproved state or not. | |
307 | * | |
308 | * @return true if in the specified state | |
309 | */ | |
310 | public abstract boolean stateIsDisapproved(); | |
311 | ||
312 | /** | |
313 | * Indicates if the document is in the approved state or not. Will answer true is document is in Processed or Finalized state. | |
314 | * | |
315 | * @return true if in the specified state | |
316 | */ | |
317 | public abstract boolean stateIsApproved(); | |
318 | ||
319 | /** | |
320 | * Indicates if the document is in the processed state or not. | |
321 | * | |
322 | * @return true if in the specified state | |
323 | */ | |
324 | public abstract boolean stateIsProcessed(); | |
325 | ||
326 | public abstract String getStatusDisplayValue(); | |
327 | ||
328 | public abstract Timestamp getCreateDate(); | |
329 | ||
330 | ||
331 | /** | |
332 | * Returns true if the principalName of the given KualiUser matches the initiatorNetworkId of this document | |
333 | * | |
334 | * @param user | |
335 | * @return true if the given user is the initiator of this document | |
336 | */ | |
337 | public boolean userIsInitiator(Person user); | |
338 | ||
339 | /** | |
340 | * Returns true if the principalName of the given KualiUser matches the routedByUserNetworkId of this document | |
341 | * | |
342 | * @param user | |
343 | * @return true if the given user is the user who routed this document | |
344 | */ | |
345 | public boolean userIsRoutedByUser(Person user); | |
346 | ||
347 | /** | |
348 | * Returns the names of the nodes that the document is currently at. | |
349 | */ | |
350 | public String[] getNodeNames() throws WorkflowException; | |
351 | ||
352 | /** | |
353 | * Returns the current node names of the document delimited by the constant: | |
354 | * {@link DocumentRouteHeaderValue#CURRENT_ROUTE_NODE_NAME_DELIMITER} | |
355 | */ | |
356 | public String getCurrentRouteNodeNames(); | |
357 | ||
358 | /** | |
359 | * This method returns a set of all approvers of this document. | |
360 | * | |
361 | * @return a set of all approvers | |
362 | */ | |
363 | public Set<Person> getAllPriorApprovers() throws WorkflowException; | |
364 | ||
365 | public void setReceiveFutureRequests() throws WorkflowException; | |
366 | ||
367 | public void setDoNotReceiveFutureRequests() throws WorkflowException; | |
368 | ||
369 | public void setClearFutureRequests() throws WorkflowException; | |
370 | } |