001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.server;
018:
019: import java.rmi.RemoteException;
020: import java.util.Set;
021:
022: import org.apache.commons.lang.ArrayUtils;
023:
024: import edu.iu.uis.eden.KEWServiceLocator;
025: import edu.iu.uis.eden.clientapp.vo.AdHocRevokeVO;
026: import edu.iu.uis.eden.clientapp.vo.DocumentContentVO;
027: import edu.iu.uis.eden.clientapp.vo.MovePointVO;
028: import edu.iu.uis.eden.clientapp.vo.ResponsiblePartyVO;
029: import edu.iu.uis.eden.clientapp.vo.ReturnPointVO;
030: import edu.iu.uis.eden.clientapp.vo.RouteHeaderVO;
031: import edu.iu.uis.eden.clientapp.vo.UserIdVO;
032: import edu.iu.uis.eden.clientapp.vo.WorkgroupIdVO;
033: import edu.iu.uis.eden.exception.DocumentTypeNotFoundException;
034: import edu.iu.uis.eden.exception.EdenUserNotFoundException;
035: import edu.iu.uis.eden.exception.InvalidActionTakenException;
036: import edu.iu.uis.eden.exception.WorkflowException;
037: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
038: import edu.iu.uis.eden.user.Recipient;
039: import edu.iu.uis.eden.user.WorkflowUser;
040: import edu.iu.uis.eden.util.Utilities;
041: import edu.iu.uis.eden.workgroup.Workgroup;
042:
043: public class WorkflowDocumentActionsWebServiceImpl implements
044: WorkflowDocumentActions {
045:
046: private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
047: .getLogger(WorkflowDocumentActionsWebServiceImpl.class);
048:
049: private DocumentRouteHeaderValue init(RouteHeaderVO routeHeaderVO)
050: throws WorkflowException {
051: incomingParamCheck(routeHeaderVO, "routeHeaderVO");
052: Long documentId = routeHeaderVO.getRouteHeaderId();
053: LOG
054: .debug("Initializing Document from incoming RouteHeaderVO [docId="
055: + documentId + "]");
056: KEWServiceLocator.getRouteHeaderService().lockRouteHeader(
057: documentId, true);
058:
059: // update notes database based on notes and notesToDelete arrays in routeHeaderVO
060: BeanConverter.updateNotes(routeHeaderVO, routeHeaderVO
061: .getRouteHeaderId());
062:
063: DocumentRouteHeaderValue document = KEWServiceLocator
064: .getRouteHeaderService().getRouteHeader(documentId);
065: document.setRouteHeaderData(routeHeaderVO);
066: KEWServiceLocator.getRouteHeaderService().saveRouteHeader(
067: document);
068: return document;
069: }
070:
071: private void incomingParamCheck(Object object, String name) {
072: if (object == null) {
073: LOG.error("null " + name + " passed in.");
074: throw new RuntimeException("null " + name + " passed in.");
075: }
076: }
077:
078: public RouteHeaderVO releaseWorkgroupAuthority(UserIdVO userId,
079: RouteHeaderVO routeHeaderVO, WorkgroupIdVO workgroupId,
080: String annotation) throws RemoteException,
081: WorkflowException {
082: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
083: incomingParamCheck(userId, "userId");
084: LOG.debug("Releasing workgroup authority [userId=" + userId
085: + ", docId=" + routeHeaderVO.getRouteHeaderId()
086: + ", workgroupId=" + workgroupId + ", annotation="
087: + annotation + "]");
088: WorkflowUser user = KEWServiceLocator.getUserService()
089: .getWorkflowUser(userId);
090: Workgroup workgroup = KEWServiceLocator.getWorkgroupService()
091: .getWorkgroup(workgroupId);
092: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
093: .releaseWorkgroupAuthority(user, routeHeader,
094: workgroup, annotation);
095: return BeanConverter.convertRouteHeader(routeHeader, user);
096: }
097:
098: public RouteHeaderVO takeWorkgroupAuthority(UserIdVO userId,
099: RouteHeaderVO routeHeaderVO, WorkgroupIdVO workgroupId,
100: String annotation) throws RemoteException,
101: WorkflowException {
102: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
103: incomingParamCheck(userId, "userId");
104: LOG.debug("Taking workgroup authority [userId=" + userId
105: + ", docId=" + routeHeaderVO.getRouteHeaderId()
106: + ", workgroupId=" + workgroupId + ", annotation="
107: + annotation + "]");
108: WorkflowUser user = KEWServiceLocator.getUserService()
109: .getWorkflowUser(userId);
110: Workgroup workgroup = KEWServiceLocator.getWorkgroupService()
111: .getWorkgroup(workgroupId);
112: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
113: .takeWorkgroupAuthority(user, routeHeader, workgroup,
114: annotation);
115: return BeanConverter.convertRouteHeader(routeHeader, user);
116: }
117:
118: public RouteHeaderVO acknowledgeDocument(UserIdVO userId,
119: RouteHeaderVO routeHeaderVO, String annotation)
120: throws WorkflowException, InvalidActionTakenException,
121: EdenUserNotFoundException {
122: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
123: incomingParamCheck(userId, "userId");
124: LOG.debug("Acknowledge [userId=" + userId + ", docId="
125: + routeHeaderVO.getRouteHeaderId() + ", annotation="
126: + annotation + "]");
127: WorkflowUser user = KEWServiceLocator.getUserService()
128: .getWorkflowUser(userId);
129: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
130: .acknowledgeDocument(user, routeHeader, annotation);
131: return BeanConverter.convertRouteHeader(routeHeader, user);
132: }
133:
134: public RouteHeaderVO approveDocument(UserIdVO userId,
135: RouteHeaderVO routeHeaderVO, String annotation)
136: throws WorkflowException, InvalidActionTakenException,
137: EdenUserNotFoundException {
138: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
139: incomingParamCheck(userId, "userId");
140: LOG.debug("Approve [userId=" + userId + ", docId="
141: + routeHeaderVO.getRouteHeaderId() + ", annotation="
142: + annotation + "]");
143: WorkflowUser user = KEWServiceLocator.getUserService()
144: .getWorkflowUser(userId);
145: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
146: .approveDocument(user, routeHeader, annotation);
147: return BeanConverter.convertRouteHeader(routeHeader, user);
148: }
149:
150: public RouteHeaderVO appSpecificRouteDocument(UserIdVO userId,
151: RouteHeaderVO routeHeaderVO, String actionRequested,
152: String nodeName, String annotation,
153: ResponsiblePartyVO responsiblePartyVO,
154: String responsibilityDesc, boolean ignorePrevActions)
155: throws InvalidActionTakenException, WorkflowException {
156: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
157: incomingParamCheck(userId, "userId");
158: incomingParamCheck(actionRequested, "actionRequested");
159: //incomingParamCheck(routeMethodName, "routeMethodName");
160: incomingParamCheck(responsiblePartyVO, "responsiblePartyVO");
161: LOG.debug("AdHoc Route [userId=" + userId + ", docId="
162: + routeHeaderVO.getRouteHeaderId() + ", actionRequest="
163: + actionRequested + ", nodeName=" + nodeName
164: + ", responsibleParty=" + responsiblePartyVO
165: + ", ignorePrevious=" + ignorePrevActions
166: + ", annotation=" + annotation + "]");
167: WorkflowUser user = KEWServiceLocator.getUserService()
168: .getWorkflowUser(userId);
169:
170: Recipient recipient = BeanConverter
171: .convertResponsiblePartyVOtoRecipient(responsiblePartyVO);
172: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
173: .appSpecificRouteDocument(user, routeHeader,
174: actionRequested, nodeName, annotation,
175: recipient, responsibilityDesc,
176: new Boolean(ignorePrevActions));
177: return BeanConverter.convertRouteHeader(routeHeader, user);
178: }
179:
180: public RouteHeaderVO blanketApproval(UserIdVO userId,
181: RouteHeaderVO routeHeaderVO, String annotation,
182: Integer routeLevel) throws WorkflowException,
183: InvalidActionTakenException, EdenUserNotFoundException {
184: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
185: incomingParamCheck(userId, "userId");
186: LOG.debug("Blanket Approve [userId=" + userId + ", docId="
187: + routeHeaderVO.getRouteHeaderId() + ", annotation="
188: + annotation + ", routeLevel=" + routeLevel + "]");
189: WorkflowUser user = KEWServiceLocator.getUserService()
190: .getWorkflowUser(userId);
191: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
192: .blanketApproval(user, routeHeader, annotation,
193: routeLevel);
194: return BeanConverter.convertRouteHeader(routeHeader, user);
195: }
196:
197: public RouteHeaderVO blanketApprovalToNodes(UserIdVO userId,
198: RouteHeaderVO routeHeaderVO, String annotation,
199: String[] nodeNames) throws WorkflowException,
200: InvalidActionTakenException, EdenUserNotFoundException {
201: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
202: incomingParamCheck(userId, "userId");
203: LOG.debug("Blanket Approve [userId=" + userId + ", docId="
204: + routeHeaderVO.getRouteHeaderId() + ", annotation="
205: + annotation + ", nodeNames="
206: + ArrayUtils.toString(nodeNames) + "]");
207: WorkflowUser user = KEWServiceLocator.getUserService()
208: .getWorkflowUser(userId);
209: Set nodeNameSet = Utilities.asSet(nodeNames);
210: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
211: .blanketApproval(user, routeHeader, annotation,
212: nodeNameSet);
213: return BeanConverter.convertRouteHeader(routeHeader, user);
214: }
215:
216: public RouteHeaderVO cancelDocument(UserIdVO userId,
217: RouteHeaderVO routeHeaderVO, String annotation)
218: throws WorkflowException, InvalidActionTakenException,
219: EdenUserNotFoundException {
220: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
221: incomingParamCheck(userId, "userId");
222: LOG.debug("Cancel [userId=" + userId + ", docId="
223: + routeHeaderVO.getRouteHeaderId() + ", annotation="
224: + annotation + "]");
225: WorkflowUser user = KEWServiceLocator.getUserService()
226: .getWorkflowUser(userId);
227: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
228: .cancelDocument(user, routeHeader, annotation);
229: return BeanConverter.convertRouteHeader(routeHeader, user);
230: }
231:
232: public RouteHeaderVO clearFYIDocument(UserIdVO userId,
233: RouteHeaderVO routeHeaderVO) throws WorkflowException,
234: InvalidActionTakenException, EdenUserNotFoundException {
235: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
236: incomingParamCheck(userId, "userId");
237: LOG.debug("Clear FYI [userId=" + userId + ", docId="
238: + routeHeaderVO.getRouteHeaderId() + "]");
239: WorkflowUser user = KEWServiceLocator.getUserService()
240: .getWorkflowUser(userId);
241: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
242: .clearFYIDocument(user, routeHeader);
243: return BeanConverter.convertRouteHeader(routeHeader, user);
244: }
245:
246: public RouteHeaderVO completeDocument(UserIdVO userId,
247: RouteHeaderVO routeHeaderVO, String annotation)
248: throws WorkflowException, InvalidActionTakenException,
249: EdenUserNotFoundException {
250: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
251: incomingParamCheck(userId, "userId");
252: LOG.debug("Complete [userId=" + userId + ", docId="
253: + routeHeaderVO.getRouteHeaderId() + ", annotation="
254: + annotation + "]");
255: WorkflowUser user = KEWServiceLocator.getUserService()
256: .getWorkflowUser(userId);
257: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
258: .completeDocument(user, routeHeader, annotation);
259: return BeanConverter.convertRouteHeader(routeHeader, user);
260: }
261:
262: public RouteHeaderVO createDocument(UserIdVO userId,
263: RouteHeaderVO routeHeaderVO) throws WorkflowException,
264: DocumentTypeNotFoundException, WorkflowException {
265: incomingParamCheck(userId, "userId");
266: incomingParamCheck(routeHeaderVO, "routeHeaderVO");
267: LOG.debug("Create Document [userId=" + userId
268: + ", docTypeName=" + routeHeaderVO.getDocTypeName()
269: + "]");
270: WorkflowUser user = KEWServiceLocator.getUserService()
271: .getWorkflowUser(userId);
272: DocumentRouteHeaderValue routeHeader = BeanConverter
273: .convertRouteHeaderVO(routeHeaderVO);
274: routeHeader.setInitiatorWorkflowId(user.getWorkflowUserId()
275: .getWorkflowId());
276: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
277: .createDocument(user, routeHeader);
278:
279: // update notes database based on notes and notesToDelete arrays in routeHeaderVO
280: BeanConverter.updateNotes(routeHeaderVO, routeHeader
281: .getRouteHeaderId());
282:
283: return BeanConverter.convertRouteHeader(routeHeader, user);
284: }
285:
286: public RouteHeaderVO disapproveDocument(UserIdVO userId,
287: RouteHeaderVO routeHeaderVO, String annotation)
288: throws WorkflowException, InvalidActionTakenException,
289: EdenUserNotFoundException {
290: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
291: incomingParamCheck(userId, "userId");
292: LOG.debug("Disapprove [userId=" + userId + ", docId="
293: + routeHeaderVO.getRouteHeaderId() + ", annotation="
294: + annotation + "]");
295: WorkflowUser user = KEWServiceLocator.getUserService()
296: .getWorkflowUser(userId);
297: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
298: .disapproveDocument(user, routeHeader, annotation);
299: return BeanConverter.convertRouteHeader(routeHeader, user);
300: }
301:
302: public RouteHeaderVO returnDocumentToPreviousRouteLevel(
303: UserIdVO userId, RouteHeaderVO routeHeaderVO,
304: Integer destRouteLevel, String annotation)
305: throws WorkflowException, InvalidActionTakenException,
306: EdenUserNotFoundException {
307: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
308: incomingParamCheck(userId, "userId");
309: incomingParamCheck(destRouteLevel, "destRouteLevel");
310: LOG.debug("Return to Previous [userId=" + userId + ", docId="
311: + routeHeaderVO.getRouteHeaderId() + ", annotation="
312: + annotation + ", destRouteLevel=" + destRouteLevel
313: + "]");
314: WorkflowUser user = KEWServiceLocator.getUserService()
315: .getWorkflowUser(userId);
316: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
317: .returnDocumentToPreviousRouteLevel(user, routeHeader,
318: destRouteLevel, annotation);
319: return BeanConverter.convertRouteHeader(routeHeader, user);
320: }
321:
322: public RouteHeaderVO returnDocumentToPreviousNode(UserIdVO userId,
323: RouteHeaderVO routeHeaderVO, ReturnPointVO returnPoint,
324: String annotation) throws WorkflowException,
325: InvalidActionTakenException, EdenUserNotFoundException {
326: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
327: incomingParamCheck(userId, "userId");
328: incomingParamCheck(returnPoint, "returnPoint");
329: LOG.debug("Return to Previous [userId=" + userId + ", docId="
330: + routeHeaderVO.getRouteHeaderId() + ", annotation="
331: + annotation + ", destNodeName="
332: + returnPoint.getNodeName() + "]");
333: WorkflowUser user = KEWServiceLocator.getUserService()
334: .getWorkflowUser(userId);
335: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
336: .returnDocumentToPreviousNode(user, routeHeader,
337: returnPoint.getNodeName(), annotation);
338: return BeanConverter.convertRouteHeader(routeHeader, user);
339: }
340:
341: public RouteHeaderVO routeDocument(UserIdVO userId,
342: RouteHeaderVO routeHeaderVO, String annotation)
343: throws WorkflowException, InvalidActionTakenException,
344: EdenUserNotFoundException {
345: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
346: incomingParamCheck(userId, "userId");
347: LOG.debug("Route Document [userId=" + userId + ", docId="
348: + routeHeaderVO.getRouteHeaderId() + ", annotation="
349: + annotation + "]");
350: WorkflowUser user = KEWServiceLocator.getUserService()
351: .getWorkflowUser(userId);
352: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
353: .routeDocument(user, routeHeader, annotation);
354: return BeanConverter.convertRouteHeader(routeHeader, user);
355: }
356:
357: public RouteHeaderVO saveRoutingData(UserIdVO userId,
358: RouteHeaderVO routeHeaderVO) throws WorkflowException,
359: EdenUserNotFoundException {
360: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
361: incomingParamCheck(userId, "userId");
362: LOG.debug("Saving Routing Data [userId=" + userId + ", docId="
363: + routeHeaderVO.getRouteHeaderId() + "]");
364: WorkflowUser user = KEWServiceLocator.getUserService()
365: .getWorkflowUser(userId);
366: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
367: .saveRoutingData(user, routeHeader);
368: return BeanConverter.convertRouteHeader(routeHeader, user);
369: }
370:
371: public RouteHeaderVO saveDocument(UserIdVO userId,
372: RouteHeaderVO routeHeaderVO, String annotation)
373: throws WorkflowException, InvalidActionTakenException,
374: EdenUserNotFoundException {
375: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
376: incomingParamCheck(userId, "userId");
377: LOG.debug("Save Document [userId=" + userId + ", docId="
378: + routeHeaderVO.getRouteHeaderId() + ", annotation="
379: + annotation + "]");
380: WorkflowUser user = KEWServiceLocator.getUserService()
381: .getWorkflowUser(userId);
382: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
383: .saveDocument(user, routeHeader, annotation);
384: return BeanConverter.convertRouteHeader(routeHeader, user);
385: }
386:
387: public void deleteDocument(UserIdVO userId,
388: RouteHeaderVO routeHeaderVO) throws WorkflowException,
389: InvalidActionTakenException, EdenUserNotFoundException {
390: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
391: incomingParamCheck(userId, "userId");
392: LOG.debug("Delete [userId=" + userId + ", docId="
393: + routeHeaderVO.getRouteHeaderId() + "]");
394: WorkflowUser user = KEWServiceLocator.getUserService()
395: .getWorkflowUser(userId);
396: KEWServiceLocator.getWorkflowDocumentService().deleteDocument(
397: user, routeHeader);
398: }
399:
400: public void logDocumentAction(UserIdVO userId,
401: RouteHeaderVO routeHeaderVO, String annotation)
402: throws WorkflowException, EdenUserNotFoundException {
403: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
404: incomingParamCheck(userId, "userId");
405: LOG.debug("Log [userId=" + userId + ", docId="
406: + routeHeaderVO.getRouteHeaderId() + ", annotation="
407: + annotation + "]");
408: WorkflowUser user = KEWServiceLocator.getUserService()
409: .getWorkflowUser(userId);
410: KEWServiceLocator.getWorkflowDocumentService()
411: .logDocumentAction(user, routeHeader, annotation);
412: }
413:
414: public RouteHeaderVO moveDocument(UserIdVO userId,
415: RouteHeaderVO routeHeaderVO, MovePointVO movePoint,
416: String annotation) throws WorkflowException {
417: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
418: incomingParamCheck(userId, "userId");
419: LOG.debug("Move [userId=" + userId + ", docId="
420: + routeHeaderVO.getRouteHeaderId() + ", annotation="
421: + annotation + ", startNode="
422: + movePoint.getStartNodeName() + "steps="
423: + movePoint.getStepsToMove() + "]");
424: WorkflowUser user = KEWServiceLocator.getUserService()
425: .getWorkflowUser(userId);
426: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
427: .moveDocument(user, routeHeader,
428: BeanConverter.convertMovePointVO(movePoint),
429: annotation);
430: return BeanConverter.convertRouteHeader(routeHeader, user);
431: }
432:
433: public RouteHeaderVO revokeAdHocRequests(UserIdVO userId,
434: RouteHeaderVO routeHeaderVO, AdHocRevokeVO revoke,
435: String annotation) throws RemoteException,
436: WorkflowException {
437: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
438: incomingParamCheck(userId, "userId");
439: LOG.debug("Revoke AdHoc [userId=" + userId + ", docId="
440: + routeHeaderVO.getRouteHeaderId() + ", annotation="
441: + annotation + "]");
442: WorkflowUser user = KEWServiceLocator.getUserService()
443: .getWorkflowUser(userId);
444: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
445: .revokeAdHocRequests(user, routeHeader,
446: BeanConverter.convertAdHocRevokeVO(revoke),
447: annotation);
448: return BeanConverter.convertRouteHeader(routeHeader, user);
449: }
450:
451: public RouteHeaderVO super UserApprove(UserIdVO userId,
452: RouteHeaderVO routeHeaderVO, String annotation)
453: throws WorkflowException {
454: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
455: incomingParamCheck(userId, "userId");
456: LOG.debug("SU Approve [userId=" + userId + ", docId="
457: + routeHeaderVO.getRouteHeaderId() + ", annotation="
458: + annotation + "]");
459: WorkflowUser user = KEWServiceLocator.getUserService()
460: .getWorkflowUser(userId);
461: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
462: .super UserApprove(user, routeHeader, annotation);
463: return BeanConverter.convertRouteHeader(routeHeader, user);
464: }
465:
466: public RouteHeaderVO super UserActionRequestApprove(UserIdVO userId,
467: RouteHeaderVO routeHeaderVO, Long actionRequestId,
468: String annotation) throws WorkflowException {
469: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
470: incomingParamCheck(userId, "userId");
471: LOG.debug("SU Cancel [userId=" + userId + ", docId="
472: + routeHeaderVO.getRouteHeaderId() + ", annotation="
473: + annotation + "]");
474: WorkflowUser user = KEWServiceLocator.getUserService()
475: .getWorkflowUser(userId);
476: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
477: .super UserActionRequestApproveAction(user, routeHeader,
478: actionRequestId, annotation);
479: return BeanConverter.convertRouteHeader(routeHeader, user);
480: }
481:
482: public RouteHeaderVO super UserDisapprove(UserIdVO userId,
483: RouteHeaderVO routeHeaderVO, String annotation)
484: throws WorkflowException {
485: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
486: incomingParamCheck(userId, "userId");
487: LOG.debug("SU Disapprove [userId=" + userId + ", docId="
488: + routeHeaderVO.getRouteHeaderId() + ", annotation="
489: + annotation + "]");
490: WorkflowUser user = KEWServiceLocator.getUserService()
491: .getWorkflowUser(userId);
492: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
493: .super UserDisapproveAction(user, routeHeader,
494: annotation);
495: return BeanConverter.convertRouteHeader(routeHeader, user);
496: }
497:
498: public RouteHeaderVO super UserCancel(UserIdVO userId,
499: RouteHeaderVO routeHeaderVO, String annotation)
500: throws WorkflowException {
501: DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
502: incomingParamCheck(userId, "userId");
503: LOG.debug("SU Cancel [userId=" + userId + ", docId="
504: + routeHeaderVO.getRouteHeaderId() + ", annotation="
505: + annotation + "]");
506: WorkflowUser user = KEWServiceLocator.getUserService()
507: .getWorkflowUser(userId);
508: routeHeader = KEWServiceLocator.getWorkflowDocumentService()
509: .super UserCancelAction(user, routeHeader, annotation);
510: return BeanConverter.convertRouteHeader(routeHeader, user);
511: }
512:
513: public DocumentContentVO saveDocumentContent(
514: DocumentContentVO documentContent) throws RemoteException,
515: WorkflowException {
516: incomingParamCheck(documentContent, "documentContent");
517: Long documentId = documentContent.getRouteHeaderId();
518: incomingParamCheck(documentId, "documentContent document ID");
519: KEWServiceLocator.getRouteHeaderService().lockRouteHeader(
520: documentId, true);
521: DocumentRouteHeaderValue document = KEWServiceLocator
522: .getRouteHeaderService().getRouteHeader(documentId);
523: LOG.debug("Saving Document Content [documentId=" + documentId
524: + "]");
525: String updatedDocumentContent = BeanConverter
526: .buildUpdatedDocumentContent(documentContent);
527: // updatedDocumentContent will be null if the content has not changed, only update if its changed
528: if (updatedDocumentContent != null) {
529: document.setDocContent(updatedDocumentContent);
530: KEWServiceLocator.getRouteHeaderService().saveRouteHeader(
531: document);
532: }
533: return BeanConverter.convertDocumentContent(document
534: .getDocContent(), documentId);
535: }
536:
537: }
|