1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.routeheader.service.impl;
17
18 import org.kuali.rice.core.api.exception.RiceRuntimeException;
19 import org.kuali.rice.kew.actionitem.ActionItem;
20 import org.kuali.rice.kew.actionrequest.KimGroupRecipient;
21 import org.kuali.rice.kew.actionrequest.Recipient;
22 import org.kuali.rice.kew.actions.AcknowledgeAction;
23 import org.kuali.rice.kew.actions.ActionTakenEvent;
24 import org.kuali.rice.kew.actions.AdHocAction;
25 import org.kuali.rice.kew.actions.ApproveAction;
26 import org.kuali.rice.kew.actions.BlanketApproveAction;
27 import org.kuali.rice.kew.actions.CancelAction;
28 import org.kuali.rice.kew.actions.ClearFYIAction;
29 import org.kuali.rice.kew.actions.CompleteAction;
30 import org.kuali.rice.kew.actions.DisapproveAction;
31 import org.kuali.rice.kew.actions.LogDocumentActionAction;
32 import org.kuali.rice.kew.actions.MoveDocumentAction;
33 import org.kuali.rice.kew.actions.ReleaseWorkgroupAuthority;
34 import org.kuali.rice.kew.actions.ReturnToPreviousNodeAction;
35 import org.kuali.rice.kew.actions.RevokeAdHocAction;
36 import org.kuali.rice.kew.actions.RouteDocumentAction;
37 import org.kuali.rice.kew.actions.SaveActionEvent;
38 import org.kuali.rice.kew.actions.SuperUserActionRequestApproveEvent;
39 import org.kuali.rice.kew.actions.SuperUserApproveEvent;
40 import org.kuali.rice.kew.actions.SuperUserCancelEvent;
41 import org.kuali.rice.kew.actions.SuperUserDisapproveEvent;
42 import org.kuali.rice.kew.actions.SuperUserNodeApproveEvent;
43 import org.kuali.rice.kew.actions.SuperUserReturnToPreviousNodeAction;
44 import org.kuali.rice.kew.actions.TakeWorkgroupAuthority;
45 import org.kuali.rice.kew.api.action.ActionInvocation;
46 import org.kuali.rice.kew.api.action.ActionInvocationQueue;
47 import org.kuali.rice.kew.actiontaken.ActionTakenValue;
48 import org.kuali.rice.kew.api.KewApiConstants;
49 import org.kuali.rice.kew.api.KewApiServiceLocator;
50 import org.kuali.rice.kew.api.WorkflowRuntimeException;
51 import org.kuali.rice.kew.api.action.AdHocRevoke;
52 import org.kuali.rice.kew.api.action.MovePoint;
53 import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException;
54 import org.kuali.rice.kew.api.document.attribute.DocumentAttributeIndexingQueue;
55 import org.kuali.rice.kew.api.exception.InvalidActionTakenException;
56 import org.kuali.rice.kew.api.exception.WorkflowException;
57 import org.kuali.rice.kew.engine.CompatUtils;
58 import org.kuali.rice.kew.engine.OrchestrationConfig;
59 import org.kuali.rice.kew.engine.RouteContext;
60 import org.kuali.rice.kew.engine.OrchestrationConfig.EngineCapability;
61 import org.kuali.rice.kew.engine.node.RouteNode;
62 import org.kuali.rice.kew.framework.postprocessor.PostProcessor;
63 import org.kuali.rice.kew.messaging.MessageServiceNames;
64 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
65 import org.kuali.rice.kew.routeheader.service.WorkflowDocumentService;
66 import org.kuali.rice.kew.service.KEWServiceLocator;
67 import org.kuali.rice.kim.api.identity.principal.Principal;
68 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
69
70 import java.sql.Timestamp;
71 import java.util.Collections;
72 import java.util.Date;
73 import java.util.HashSet;
74 import java.util.List;
75 import java.util.Set;
76
77
78
79
80
81
82
83
84 public class WorkflowDocumentServiceImpl implements WorkflowDocumentService {
85
86 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(WorkflowDocumentServiceImpl.class);
87
88 private void init(DocumentRouteHeaderValue routeHeader) {
89 KEWServiceLocator.getRouteHeaderService().lockRouteHeader(routeHeader.getDocumentId(), true);
90 KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
91 }
92
93 private DocumentRouteHeaderValue finish(DocumentRouteHeaderValue routeHeader) {
94
95
96 if (RouteContext.getCurrentRouteContext().getDocument() == null) {
97 return KEWServiceLocator.getRouteHeaderService().getRouteHeader(routeHeader.getDocumentId(), true);
98 } else {
99
100
101
102
103 return routeHeader;
104 }
105 }
106
107 public DocumentRouteHeaderValue acknowledgeDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
108 Principal principal = loadPrincipal(principalId);
109 AcknowledgeAction action = new AcknowledgeAction(routeHeader, principal, annotation);
110 action.performAction();
111 return finish(routeHeader);
112 }
113
114 public DocumentRouteHeaderValue releaseGroupAuthority(String principalId, DocumentRouteHeaderValue routeHeader, String groupId, String annotation) throws InvalidActionTakenException {
115 Principal principal = loadPrincipal(principalId);
116 ReleaseWorkgroupAuthority action = new ReleaseWorkgroupAuthority(routeHeader, principal, annotation, groupId);
117 action.performAction();
118 return finish(routeHeader);
119 }
120
121 public DocumentRouteHeaderValue takeGroupAuthority(String principalId, DocumentRouteHeaderValue routeHeader, String groupId, String annotation) throws InvalidActionTakenException {
122 Principal principal = loadPrincipal(principalId);
123 TakeWorkgroupAuthority action = new TakeWorkgroupAuthority(routeHeader, principal, annotation, groupId);
124 action.performAction();
125 return finish(routeHeader);
126 }
127
128 public DocumentRouteHeaderValue approveDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
129 Principal principal = loadPrincipal(principalId);
130 ApproveAction action = new ApproveAction(routeHeader, principal, annotation);
131 action.performAction();
132 return finish(routeHeader);
133 }
134
135 public DocumentRouteHeaderValue placeInExceptionRouting(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
136 try {
137 KEWServiceLocator.getExceptionRoutingService().placeInExceptionRouting(annotation, null, routeHeader.getDocumentId());
138 } catch (Exception e) {
139 throw new RiceRuntimeException("Failed to place the document into exception routing!", e);
140 }
141 return finish(routeHeader);
142 }
143
144 public DocumentRouteHeaderValue adHocRouteDocumentToPrincipal(String principalId, DocumentRouteHeaderValue document, String actionRequested, String nodeName, Integer priority, String annotation, String targetPrincipalId,
145 String responsibilityDesc, Boolean forceAction, String requestLabel) throws WorkflowException {
146 Principal principal = loadPrincipal(principalId);
147 Recipient recipient = KEWServiceLocator.getIdentityHelperService().getPrincipalRecipient(targetPrincipalId);
148 AdHocAction action = new AdHocAction(document, principal, annotation, actionRequested, nodeName, priority, recipient, responsibilityDesc, forceAction, requestLabel);
149 action.performAction();
150 return finish(document);
151 }
152
153 public DocumentRouteHeaderValue adHocRouteDocumentToGroup(String principalId, DocumentRouteHeaderValue document, String actionRequested, String nodeName, Integer priority, String annotation, String groupId,
154 String responsibilityDesc, Boolean forceAction, String requestLabel) throws WorkflowException {
155 Principal principal = loadPrincipal(principalId);
156 final Recipient recipient = new KimGroupRecipient(KimApiServiceLocator.getGroupService().getGroup(groupId));
157 AdHocAction action = new AdHocAction(document, principal, annotation, actionRequested, nodeName, priority, recipient, responsibilityDesc, forceAction, requestLabel);
158 action.performAction();
159 return finish(document);
160 }
161
162 public DocumentRouteHeaderValue blanketApproval(String principalId, DocumentRouteHeaderValue routeHeader, String annotation, Integer routeLevel) throws InvalidActionTakenException {
163 RouteNode node = (routeLevel == null ? null : CompatUtils.getNodeForLevel(routeHeader.getDocumentType(), routeLevel));
164 if (node == null && routeLevel != null) {
165 throw new InvalidActionTakenException("Could not locate node for route level " + routeLevel);
166 }
167 Set<String> nodeNames = new HashSet<String>();
168 if (node != null) {
169 nodeNames = Collections.singleton(node.getRouteNodeName());
170 }
171 Principal principal = loadPrincipal(principalId);
172 ActionTakenEvent action = new BlanketApproveAction(routeHeader, principal, annotation, nodeNames);
173 action.performAction();
174 return finish(routeHeader);
175 }
176
177 public DocumentRouteHeaderValue blanketApproval(String principalId, DocumentRouteHeaderValue routeHeader, String annotation, Set nodeNames) throws InvalidActionTakenException {
178 Principal principal = loadPrincipal(principalId);
179 BlanketApproveAction action = new BlanketApproveAction(routeHeader, principal, annotation, nodeNames);
180 action.recordAction();
181
182 return finish(routeHeader);
183 }
184
185 public DocumentRouteHeaderValue cancelDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
186
187 Principal principal = loadPrincipal(principalId);
188 CancelAction action = new CancelAction(routeHeader, principal, annotation);
189 action.recordAction();
190 indexForSearchAfterActionIfNecessary(routeHeader);
191 return finish(routeHeader);
192 }
193
194
195
196
197
198 protected void indexForSearchAfterActionIfNecessary(DocumentRouteHeaderValue routeHeader) {
199 RouteContext routeContext = RouteContext.getCurrentRouteContext();
200 if (routeHeader.getDocumentType().hasSearchableAttributes() && routeContext.isSearchIndexingRequestedForContext()) {
201 DocumentAttributeIndexingQueue queue = KewApiServiceLocator.getDocumentAttributeIndexingQueue(routeHeader.getDocumentType().getApplicationId());
202 queue.indexDocument(routeHeader.getDocumentId());
203 }
204 }
205
206 public DocumentRouteHeaderValue clearFYIDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
207
208 Principal principal = loadPrincipal(principalId);
209 ClearFYIAction action = new ClearFYIAction(routeHeader, principal, annotation);
210 action.recordAction();
211 return finish(routeHeader);
212 }
213
214 public DocumentRouteHeaderValue completeDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
215 Principal principal = loadPrincipal(principalId);
216 CompleteAction action = new CompleteAction(routeHeader, principal, annotation);
217 action.performAction();
218 return finish(routeHeader);
219 }
220
221 public DocumentRouteHeaderValue createDocument(String principalId, DocumentRouteHeaderValue routeHeader) throws WorkflowException {
222
223 if (routeHeader.getDocumentId() != null) {
224
225
226 throw new InvalidActionTakenException("Document already has a Document id");
227 }
228 Principal principal = loadPrincipal(principalId);
229 boolean canInitiate = KEWServiceLocator.getDocumentTypePermissionService().canInitiate(principalId, routeHeader.getDocumentType());
230
231 if (!canInitiate) {
232 throw new InvalidActionTakenException("Principal with name '" + principal.getPrincipalName() + "' is not authorized to initiate documents of type '" + routeHeader.getDocumentType().getName());
233 }
234
235 if (!routeHeader.getDocumentType().isDocTypeActive()) {
236
237 throw new IllegalDocumentTypeException("Document type '" + routeHeader.getDocumentType().getName() + "' is inactive");
238 }
239
240 routeHeader.setInitiatorWorkflowId(principalId);
241 if (routeHeader.getDocRouteStatus() == null) {
242 routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_INITIATED_CD);
243 }
244 if (routeHeader.getDocRouteLevel() == null) {
245 routeHeader.setDocRouteLevel(Integer.valueOf(KewApiConstants.ADHOC_ROUTE_LEVEL));
246 }
247 if (routeHeader.getCreateDate() == null) {
248 routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
249 }
250 if (routeHeader.getDocVersion() == null) {
251 routeHeader.setDocVersion(Integer.valueOf(KewApiConstants.DocumentContentVersions.CURRENT));
252 }
253 if (routeHeader.getDocContent() == null) {
254 routeHeader.setDocContent(KewApiConstants.DEFAULT_DOCUMENT_CONTENT);
255 }
256 routeHeader.setStatusModDate(new Timestamp(new Date().getTime()));
257 KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
258 OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
259 KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).initializeDocument(routeHeader);
260 KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
261 return routeHeader;
262 }
263
264 public DocumentRouteHeaderValue disapproveDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
265 Principal principal = loadPrincipal(principalId);
266 DisapproveAction action = new DisapproveAction(routeHeader, principal, annotation);
267 action.recordAction();
268 indexForSearchAfterActionIfNecessary(routeHeader);
269 return finish(routeHeader);
270 }
271
272 public DocumentRouteHeaderValue returnDocumentToPreviousRouteLevel(String principalId, DocumentRouteHeaderValue routeHeader, Integer destRouteLevel, String annotation)
273 throws InvalidActionTakenException {
274 DocumentRouteHeaderValue result = null;
275
276 if (destRouteLevel != null) {
277 RouteNode node = CompatUtils.getNodeForLevel(routeHeader.getDocumentType(), destRouteLevel);
278 if (node == null) {
279 throw new InvalidActionTakenException("Could not locate node for route level " + destRouteLevel);
280 }
281
282 Principal principal = loadPrincipal(principalId);
283 ReturnToPreviousNodeAction action = new ReturnToPreviousNodeAction(routeHeader, principal, annotation, node.getRouteNodeName(), true);
284 action.performAction();
285 result = finish(routeHeader);
286 }
287 return result;
288 }
289
290 public DocumentRouteHeaderValue returnDocumentToPreviousNode(String principalId, DocumentRouteHeaderValue routeHeader, String destinationNodeName, String annotation)
291 throws InvalidActionTakenException {
292 Principal principal = loadPrincipal(principalId);
293 ReturnToPreviousNodeAction action = new ReturnToPreviousNodeAction(routeHeader, principal, annotation, destinationNodeName, true);
294 action.performAction();
295 return finish(routeHeader);
296 }
297
298 public DocumentRouteHeaderValue routeDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws WorkflowException,
299 InvalidActionTakenException {
300 Principal principal = loadPrincipal(principalId);
301 RouteDocumentAction actionEvent = new RouteDocumentAction(routeHeader, principal, annotation);
302 actionEvent.performAction();
303 LOG.info("routeDocument: " + routeHeader);
304 return finish(routeHeader);
305 }
306
307 public DocumentRouteHeaderValue saveRoutingData(String principalId, DocumentRouteHeaderValue routeHeader) {
308 KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
309
310
311 ActionTakenValue val = new ActionTakenValue();
312 val.setActionTaken(KewApiConstants.ACTION_TAKEN_SAVED_CD);
313 val.setDocumentId(routeHeader.getDocumentId());
314 val.setPrincipalId(principalId);
315 PostProcessor postProcessor = routeHeader.getDocumentType().getPostProcessor();
316 try {
317 postProcessor.doActionTaken(new org.kuali.rice.kew.framework.postprocessor.ActionTakenEvent(routeHeader.getDocumentId(), routeHeader.getAppDocId(), ActionTakenValue.to(val)));
318 } catch (Exception e) {
319 if (e instanceof RuntimeException) {
320 throw (RuntimeException)e;
321 }
322 throw new WorkflowRuntimeException(e);
323 }
324
325 RouteContext routeContext = RouteContext.getCurrentRouteContext();
326 if (routeHeader.getDocumentType().hasSearchableAttributes() && !routeContext.isSearchIndexingRequestedForContext()) {
327 routeContext.requestSearchIndexingForContext();
328 DocumentAttributeIndexingQueue queue = KewApiServiceLocator.getDocumentAttributeIndexingQueue(routeHeader.getDocumentType().getApplicationId());
329 queue.indexDocument(routeHeader.getDocumentId());
330 }
331 return finish(routeHeader);
332 }
333
334 public DocumentRouteHeaderValue saveDocument(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
335 Principal principal = loadPrincipal(principalId);
336 SaveActionEvent action = new SaveActionEvent(routeHeader, principal, annotation);
337 action.performAction();
338 return finish(routeHeader);
339 }
340
341 public void deleteDocument(String principalId, DocumentRouteHeaderValue routeHeader) throws WorkflowException {
342 if (routeHeader.getDocumentId() == null) {
343 LOG.debug("Null Document id passed.");
344 throw new WorkflowException("Document id must not be null.");
345 }
346 KEWServiceLocator.getRouteHeaderService().deleteRouteHeader(routeHeader);
347 }
348
349 public void logDocumentAction(String principalId, DocumentRouteHeaderValue routeHeader, String annotation) throws InvalidActionTakenException {
350 Principal principal = loadPrincipal(principalId);
351 LogDocumentActionAction action = new LogDocumentActionAction(routeHeader, principal, annotation);
352 action.recordAction();
353 }
354
355 public DocumentRouteHeaderValue moveDocument(String principalId, DocumentRouteHeaderValue routeHeader, MovePoint movePoint, String annotation) throws InvalidActionTakenException {
356 Principal principal = loadPrincipal(principalId);
357 MoveDocumentAction action = new MoveDocumentAction(routeHeader, principal, annotation, movePoint);
358 action.performAction();
359 return finish(routeHeader);
360 }
361
362 public DocumentRouteHeaderValue superUserActionRequestApproveAction(String principalId, DocumentRouteHeaderValue routeHeader, String actionRequestId, String annotation, boolean runPostProcessor)
363 throws InvalidActionTakenException {
364 init(routeHeader);
365 Principal principal = loadPrincipal(principalId);
366 SuperUserActionRequestApproveEvent suActionRequestApprove = new SuperUserActionRequestApproveEvent(routeHeader, principal, actionRequestId, annotation, runPostProcessor);
367 suActionRequestApprove.recordAction();
368
369 RouteContext.getCurrentRouteContext().requestSearchIndexingForContext();
370 indexForSearchAfterActionIfNecessary(routeHeader);
371 return finish(routeHeader);
372 }
373
374
375
376
377
378
379 public DocumentRouteHeaderValue superUserActionRequestApproveAction(String principalId, String documentId, String actionRequestId, String annotation, boolean runPostProcessor)
380 throws InvalidActionTakenException {
381 return superUserActionRequestApproveAction(principalId, KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId), actionRequestId, annotation, runPostProcessor);
382 }
383
384 public DocumentRouteHeaderValue superUserApprove(String principalId, DocumentRouteHeaderValue routeHeader, String annotation, boolean runPostProcessor) throws InvalidActionTakenException {
385 init(routeHeader);
386 Principal principal = loadPrincipal(principalId);
387 new SuperUserApproveEvent(routeHeader, principal, annotation, runPostProcessor).recordAction();
388 RouteContext.getCurrentRouteContext().requestSearchIndexingForContext();
389 indexForSearchAfterActionIfNecessary(routeHeader);
390 return finish(routeHeader);
391 }
392
393 public DocumentRouteHeaderValue superUserCancelAction(String principalId, DocumentRouteHeaderValue routeHeader, String annotation, boolean runPostProcessor) throws InvalidActionTakenException {
394 init(routeHeader);
395 Principal principal = loadPrincipal(principalId);
396 new SuperUserCancelEvent(routeHeader, principal, annotation, runPostProcessor).recordAction();
397 RouteContext.getCurrentRouteContext().requestSearchIndexingForContext();
398 indexForSearchAfterActionIfNecessary(routeHeader);
399 return finish(routeHeader);
400 }
401
402 public DocumentRouteHeaderValue superUserDisapproveAction(String principalId, DocumentRouteHeaderValue routeHeader, String annotation, boolean runPostProcessor) throws InvalidActionTakenException {
403 init(routeHeader);
404 Principal principal = loadPrincipal(principalId);
405 new SuperUserDisapproveEvent(routeHeader, principal, annotation, runPostProcessor).recordAction();
406 RouteContext.getCurrentRouteContext().requestSearchIndexingForContext();
407 indexForSearchAfterActionIfNecessary(routeHeader);
408 return finish(routeHeader);
409 }
410
411 public DocumentRouteHeaderValue superUserNodeApproveAction(String principalId, DocumentRouteHeaderValue routeHeader, String nodeName, String annotation, boolean runPostProcessor) throws InvalidActionTakenException {
412 init(routeHeader);
413 Principal principal = loadPrincipal(principalId);
414 new SuperUserNodeApproveEvent(routeHeader, principal, annotation, runPostProcessor, nodeName).recordAction();
415 indexForSearchAfterActionIfNecessary(routeHeader);
416 return finish(routeHeader);
417 }
418
419
420
421
422
423
424 public DocumentRouteHeaderValue superUserNodeApproveAction(String principalId, String documentId, String nodeName, String annotation, boolean runPostProcessor) throws InvalidActionTakenException {
425 return superUserNodeApproveAction(principalId, KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId), nodeName, annotation, runPostProcessor);
426 }
427
428
429
430
431
432
433
434 public DocumentRouteHeaderValue superUserReturnDocumentToPreviousNode(String principalId, String documentId, String nodeName, String annotation, boolean runPostProcessor)
435 throws InvalidActionTakenException {
436 return superUserReturnDocumentToPreviousNode(principalId, KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId), nodeName, annotation, runPostProcessor);
437 }
438
439 public DocumentRouteHeaderValue superUserReturnDocumentToPreviousNode(String principalId, DocumentRouteHeaderValue routeHeader, String nodeName, String annotation, boolean runPostProcessor)
440 throws InvalidActionTakenException {
441 init(routeHeader);
442 Principal principal = loadPrincipal(principalId);
443 SuperUserReturnToPreviousNodeAction action = new SuperUserReturnToPreviousNodeAction(routeHeader, principal, annotation, runPostProcessor, nodeName);
444 action.recordAction();
445 RouteContext.getCurrentRouteContext().requestSearchIndexingForContext();
446 indexForSearchAfterActionIfNecessary(routeHeader);
447 return finish(routeHeader);
448 }
449
450 public void takeMassActions(String principalId, List<ActionInvocation> actionInvocations) {
451 Principal principal = loadPrincipal(principalId);
452 for (ActionInvocation invocation : actionInvocations) {
453 ActionItem actionItem = KEWServiceLocator.getActionListService().findByActionItemId(invocation.getActionItemId());
454 if (actionItem == null) {
455 LOG.warn("Could not locate action item for the given action item id [" + invocation.getActionItemId() + "], not taking mass action on it.");
456 continue;
457 }
458 KEWServiceLocator.getActionListService().deleteActionItem(actionItem, true);
459 ActionInvocationQueue actionInvocQueue = MessageServiceNames.getActionInvocationProcessorService(
460 KEWServiceLocator.getRouteHeaderService().getRouteHeader(actionItem.getDocumentId()));
461 actionInvocQueue.invokeAction(principalId, actionItem.getDocumentId(), invocation);
462
463 }
464 }
465
466 public DocumentRouteHeaderValue revokeAdHocRequests(String principalId, DocumentRouteHeaderValue document, AdHocRevoke revoke, String annotation) throws InvalidActionTakenException {
467 Principal principal = loadPrincipal(principalId);
468 RevokeAdHocAction action = new RevokeAdHocAction(document, principal, revoke, annotation);
469 action.performAction();
470 return finish(document);
471 }
472
473 public DocumentRouteHeaderValue revokeAdHocRequests(String principalId, DocumentRouteHeaderValue document, String actionRequestId, String annotation) throws InvalidActionTakenException {
474 Principal principal = loadPrincipal(principalId);
475 RevokeAdHocAction action = new RevokeAdHocAction(document, principal, actionRequestId, annotation);
476 action.performAction();
477 return finish(document);
478 }
479
480 protected Principal loadPrincipal(String principalId) {
481 return KEWServiceLocator.getIdentityHelperService().getPrincipal(principalId);
482 }
483
484 }