Coverage Report - org.kuali.rice.kew.service.impl.WorkflowDocumentActionsWebServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkflowDocumentActionsWebServiceImpl
0%
0/210
0%
0/10
1.143
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  *
 4  
  *
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.kew.service.impl;
 18  
 
 19  
 import org.apache.commons.collections.CollectionUtils;
 20  
 import org.apache.commons.lang.ArrayUtils;
 21  
 import org.kuali.rice.kew.docsearch.service.SearchableAttributeProcessingService;
 22  
 import org.kuali.rice.kew.dto.*;
 23  
 import org.kuali.rice.kew.engine.node.RouteNodeInstance;
 24  
 import org.kuali.rice.kew.exception.WorkflowException;
 25  
 import org.kuali.rice.kew.messaging.MessageServiceNames;
 26  
 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
 27  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 28  
 import org.kuali.rice.kew.service.WorkflowDocumentActions;
 29  
 
 30  
 import java.util.HashSet;
 31  
 import java.util.List;
 32  
 import java.util.Set;
 33  
 
 34  
 
 35  0
 public class WorkflowDocumentActionsWebServiceImpl implements WorkflowDocumentActions {
 36  
 
 37  0
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(WorkflowDocumentActionsWebServiceImpl.class);
 38  
 
 39  
     private DocumentRouteHeaderValue init(RouteHeaderDTO routeHeaderVO) throws WorkflowException {
 40  0
         incomingParamCheck(routeHeaderVO, "routeHeaderVO");
 41  0
         String documentId = routeHeaderVO.getDocumentId();
 42  0
         LOG.debug("Initializing Document from incoming RouteHeaderVO [docId=" + documentId + "]");
 43  0
         KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true);
 44  
 
 45  
 //      update notes database based on notes and notesToDelete arrays in routeHeaderVO
 46  0
         DTOConverter.updateNotes(routeHeaderVO, routeHeaderVO.getDocumentId());
 47  
 
 48  0
         DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 49  0
         document.setRouteHeaderData(routeHeaderVO);
 50  
                                 
 51  0
         KEWServiceLocator.getRouteHeaderService().saveRouteHeader(document);
 52  
         
 53  
         /* 
 54  
          * Branch data is not persisted when we call saveRouteHeader so we must Explicitly
 55  
          * save the branch.  Noticed issue in: KULRICE-4074 when the future action request info,
 56  
          * which is stored in the branch, was not being persisted.
 57  
          * 
 58  
          * The call to setRouteHeaderData will ensure that the variable data is in the branch, but we have
 59  
          * to persist the route header before we can save the branch info.
 60  
          * 
 61  
          * Placing here to minimize system impact.  We should investigate placing this logic into 
 62  
          * saveRouteHeader... but at that point we should just turn auto-update = true on the branch relationship
 63  
          * 
 64  
          */
 65  0
         this.saveRouteNodeInstances(document);
 66  
         
 67  0
         return document;
 68  
     }
 69  
 
 70  
     /**
 71  
      * 
 72  
      * This method explicitly saves the branch data if it exists in the routeHeaderValue
 73  
      * 
 74  
      * @param routeHeader
 75  
      */
 76  
     private void saveRouteNodeInstances(DocumentRouteHeaderValue routeHeader){
 77  
     
 78  0
             List<RouteNodeInstance> routeNodes = routeHeader.getInitialRouteNodeInstances();               
 79  0
         if(routeNodes != null && !routeNodes.isEmpty()){                                
 80  0
                 for(RouteNodeInstance rni: routeNodes){
 81  0
                         KEWServiceLocator.getRouteNodeService().save(rni);                        
 82  
                 }
 83  
         }
 84  
             
 85  0
     }
 86  
     
 87  
     private void init(String documentId) throws WorkflowException {
 88  0
         incomingParamCheck(documentId, "documentId");
 89  0
         LOG.debug("Initializing Document from incoming Document ID [docId=" + documentId + "]");
 90  0
         KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true);
 91  0
     }
 92  
 
 93  
     private void incomingParamCheck(Object object, String name) {
 94  0
         if (object == null) {
 95  0
             LOG.error("null " + name + " passed in.");
 96  0
             throw new RuntimeException("null " + name + " passed in.");
 97  
         }
 98  0
     }
 99  
 
 100  
     public RouteHeaderDTO releaseGroupAuthority(String principalId, RouteHeaderDTO routeHeaderVO, String groupId, String annotation) throws WorkflowException {
 101  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 102  0
         incomingParamCheck(principalId, "principalId");
 103  0
         LOG.debug("Releasing group authority [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", groupId=" + groupId + ", annotation=" + annotation + "]");
 104  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().releaseGroupAuthority(principalId, routeHeader, groupId, annotation);
 105  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 106  
     }
 107  
 
 108  
     public RouteHeaderDTO takeGroupAuthority(String principalId, RouteHeaderDTO routeHeaderVO, String groupId, String annotation) throws WorkflowException {
 109  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 110  0
         incomingParamCheck(principalId, "principalId");
 111  0
         LOG.debug("Taking workgroup authority [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", groupInfo=" + groupId + ", annotation=" + annotation + "]");
 112  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().takeGroupAuthority(principalId, routeHeader, groupId, annotation);
 113  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 114  
     }
 115  
 
 116  
     public RouteHeaderDTO acknowledgeDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 117  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 118  0
         incomingParamCheck(principalId, "principalId");
 119  0
         LOG.debug("Acknowledge [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 120  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().acknowledgeDocument(principalId, routeHeader, annotation);
 121  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 122  
     }
 123  
 
 124  
     public RouteHeaderDTO approveDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 125  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 126  0
         incomingParamCheck(principalId, "principalId");
 127  0
         LOG.debug("Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 128  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().approveDocument(principalId, routeHeader, annotation);
 129  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 130  
     }
 131  
 
 132  
     public RouteHeaderDTO adHocRouteDocumentToPrincipal(String principalId, RouteHeaderDTO routeHeaderVO, String actionRequested, String nodeName, String annotation, String recipientPrincipalId, String responsibilityDesc, boolean forceAction, String requestLabel) throws WorkflowException {
 133  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 134  0
         incomingParamCheck(principalId, "principalId");
 135  0
         incomingParamCheck(actionRequested, "actionRequested");
 136  
         //incomingParamCheck(routeMethodName, "routeMethodName");
 137  0
         incomingParamCheck(recipientPrincipalId, "recipientPrincipalId");
 138  0
         LOG.debug("AdHoc Route [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", actionRequest=" + actionRequested + ", nodeName=" + nodeName + ", recipientPrincipalId=" + recipientPrincipalId + ", forceAction=" + forceAction + ", annotation="+annotation + ", requestLabel="+requestLabel+"]");
 139  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToPrincipal(principalId, routeHeader, actionRequested, nodeName, annotation, recipientPrincipalId, responsibilityDesc, new Boolean(forceAction), requestLabel);
 140  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 141  
     }
 142  
 
 143  
     public RouteHeaderDTO adHocRouteDocumentToGroup(String principalId, RouteHeaderDTO routeHeaderVO, String actionRequested, String nodeName, String annotation, String recipientGroupId, String responsibilityDesc, boolean forceAction, String requestLabel) throws WorkflowException {
 144  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 145  0
         incomingParamCheck(principalId, "principalId");
 146  0
         incomingParamCheck(actionRequested, "actionRequested");
 147  
         //incomingParamCheck(routeMethodName, "routeMethodName");
 148  0
         incomingParamCheck(recipientGroupId, "recipientGroupId");
 149  0
         LOG.debug("AdHoc Route [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", actionRequest=" + actionRequested + ", nodeName=" + nodeName + ", recipientGroupId=" + recipientGroupId + ", forceAction=" + forceAction + ", annotation="+annotation+"]");
 150  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToGroup(principalId, routeHeader, actionRequested, nodeName, annotation, recipientGroupId, responsibilityDesc, new Boolean(forceAction), requestLabel);
 151  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 152  
     }
 153  
 
 154  
     public RouteHeaderDTO blanketApproval(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, Integer routeLevel) throws WorkflowException {
 155  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 156  0
         incomingParamCheck(principalId, "principalId");
 157  0
         LOG.debug("Blanket Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + ", routeLevel=" + routeLevel + "]");
 158  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().blanketApproval(principalId, routeHeader, annotation, routeLevel);
 159  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 160  
     }
 161  
 
 162  
     public RouteHeaderDTO blanketApprovalToNodes(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, String[] nodeNames) throws WorkflowException {
 163  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 164  0
         incomingParamCheck(principalId, "principalId");
 165  0
         LOG.debug("Blanket Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + ", nodeNames=" + ArrayUtils.toString(nodeNames) + "]");
 166  0
         Set<String> nodeNameSet = new HashSet<String>();
 167  0
         CollectionUtils.addAll(nodeNameSet, nodeNames);
 168  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().blanketApproval(principalId, routeHeader, annotation, nodeNameSet);
 169  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 170  
     }
 171  
 
 172  
 
 173  
     public RouteHeaderDTO cancelDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 174  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 175  0
         incomingParamCheck(principalId, "principalId");
 176  0
         LOG.debug("Cancel [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 177  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().cancelDocument(principalId, routeHeader, annotation);
 178  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 179  
     }
 180  
 
 181  
     public RouteHeaderDTO clearFYIDocument(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException {
 182  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 183  0
         incomingParamCheck(principalId, "principalId");
 184  0
         LOG.debug("Clear FYI [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + "]");
 185  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().clearFYIDocument(principalId, routeHeader);
 186  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 187  
     }
 188  
 
 189  
     public RouteHeaderDTO completeDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 190  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 191  0
         incomingParamCheck(principalId, "principalId");
 192  0
         LOG.debug("Complete [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 193  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().completeDocument(principalId, routeHeader, annotation);
 194  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 195  
     }
 196  
 
 197  
     public RouteHeaderDTO createDocument(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException {
 198  0
         incomingParamCheck(principalId, "principalId");
 199  0
         incomingParamCheck(routeHeaderVO, "routeHeaderVO");
 200  0
         LOG.debug("Create Document [principalId=" + principalId + ", docTypeName=" + routeHeaderVO.getDocTypeName() + "]");
 201  0
         DocumentRouteHeaderValue routeHeader = DTOConverter.convertRouteHeaderVO(routeHeaderVO);
 202  0
         routeHeader.setInitiatorWorkflowId(principalId);
 203  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().createDocument(principalId, routeHeader);
 204  
 
 205  
 //      update notes database based on notes and notesToDelete arrays in routeHeaderVO
 206  0
         DTOConverter.updateNotes(routeHeaderVO, routeHeader.getDocumentId());
 207  
 
 208  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 209  
     }
 210  
 
 211  
     public RouteHeaderDTO disapproveDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 212  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 213  0
         incomingParamCheck(principalId, "principalId");
 214  0
         LOG.debug("Disapprove [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 215  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().disapproveDocument(principalId, routeHeader, annotation);
 216  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 217  
     }
 218  
 
 219  
     public RouteHeaderDTO returnDocumentToPreviousRouteLevel(String principalId, RouteHeaderDTO routeHeaderVO, Integer destRouteLevel, String annotation) throws WorkflowException {
 220  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 221  0
         incomingParamCheck(principalId, "principalId");
 222  0
         incomingParamCheck(destRouteLevel, "destRouteLevel");
 223  0
         LOG.debug("Return to Previous [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + ", destRouteLevel=" + destRouteLevel + "]");
 224  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().returnDocumentToPreviousRouteLevel(principalId, routeHeader, destRouteLevel, annotation);
 225  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 226  
     }
 227  
 
 228  
     public RouteHeaderDTO returnDocumentToPreviousNode(String principalId, RouteHeaderDTO routeHeaderVO, ReturnPointDTO returnPoint, String annotation) throws WorkflowException {
 229  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 230  0
         incomingParamCheck(principalId, "principalId");
 231  0
         incomingParamCheck(returnPoint, "returnPoint");
 232  0
         LOG.debug("Return to Previous [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + ", destNodeName=" + returnPoint.getNodeName() + "]");
 233  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().returnDocumentToPreviousNode(principalId, routeHeader, returnPoint.getNodeName(), annotation);
 234  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 235  
     }
 236  
 
 237  
     public RouteHeaderDTO routeDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 238  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 239  0
         incomingParamCheck(principalId, "principalId");
 240  0
         LOG.debug("Route Document [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 241  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().routeDocument(principalId, routeHeader, annotation);
 242  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 243  
     }
 244  
 
 245  
     public RouteHeaderDTO saveRoutingData(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException {
 246  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 247  0
         incomingParamCheck(principalId, "principalId");
 248  0
         LOG.debug("Saving Routing Data [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + "]");
 249  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().saveRoutingData(principalId, routeHeader);
 250  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 251  
     }
 252  
 
 253  
     public RouteHeaderDTO saveDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 254  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 255  0
         incomingParamCheck(principalId, "principalId");
 256  0
         LOG.debug("Save Document [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 257  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().saveDocument(principalId, routeHeader, annotation);
 258  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 259  
     }
 260  
 
 261  
     public void deleteDocument(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException {
 262  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 263  0
         incomingParamCheck(principalId, "principalId");
 264  0
         LOG.debug("Delete [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + "]");
 265  0
         KEWServiceLocator.getWorkflowDocumentService().deleteDocument(principalId, routeHeader);
 266  0
     }
 267  
 
 268  
     public void logDocumentAction(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 269  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 270  0
         incomingParamCheck(principalId, "principalId");
 271  0
         LOG.debug("Log [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 272  0
         KEWServiceLocator.getWorkflowDocumentService().logDocumentAction(principalId, routeHeader, annotation);
 273  0
     }
 274  
 
 275  
     public RouteHeaderDTO moveDocument(String principalId, RouteHeaderDTO routeHeaderVO, MovePointDTO movePoint, String annotation) throws WorkflowException {
 276  0
         DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 277  0
         incomingParamCheck(principalId, "principalId");
 278  0
         LOG.debug("Move [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + ", startNode=" + movePoint.getStartNodeName() + "steps=" + movePoint.getStepsToMove() + "]");
 279  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().moveDocument(principalId, routeHeader, DTOConverter.convertMovePointVO(movePoint), annotation);
 280  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 281  
     }
 282  
 
 283  
     public RouteHeaderDTO revokeAdHocRequests(String principalId, RouteHeaderDTO routeHeaderVO, AdHocRevokeDTO revoke, String annotation) throws WorkflowException {
 284  0
             DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 285  0
         incomingParamCheck(principalId, "principalId");
 286  0
         LOG.debug("Revoke AdHoc [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 287  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().revokeAdHocRequests(principalId, routeHeader, DTOConverter.convertAdHocRevokeVO(revoke), annotation);
 288  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 289  
     }
 290  
 
 291  
     public RouteHeaderDTO superUserApprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, boolean runPostProcessor) throws WorkflowException {
 292  0
             DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 293  0
         incomingParamCheck(principalId, "principalId");
 294  0
         LOG.debug("SU Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 295  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserApprove(principalId, routeHeader, annotation, runPostProcessor);
 296  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 297  
     }
 298  
 
 299  
     public RouteHeaderDTO superUserApprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 300  0
             return superUserApprove(principalId, routeHeaderVO, annotation, true);
 301  
     }
 302  
 
 303  
     public RouteHeaderDTO superUserActionRequestApprove(String principalId, RouteHeaderDTO routeHeaderVO, Long actionRequestId, String annotation) throws WorkflowException {
 304  0
             DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 305  0
             incomingParamCheck(principalId, "principalId");
 306  0
             LOG.debug("SU Cancel [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 307  0
             routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserActionRequestApproveAction(principalId, routeHeader, actionRequestId, annotation, true);
 308  0
                 return DTOConverter.convertRouteHeader(routeHeader, principalId);
 309  
     }
 310  
 
 311  
     public RouteHeaderDTO superUserDisapprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, boolean runPostProcessor) throws WorkflowException {
 312  0
             DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 313  0
         incomingParamCheck(principalId, "principalId");
 314  0
         LOG.debug("SU Disapprove [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 315  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserDisapproveAction(principalId, routeHeader, annotation, runPostProcessor);
 316  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 317  
     }
 318  
 
 319  
     public RouteHeaderDTO superUserDisapprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 320  0
             return superUserDisapprove(principalId, routeHeaderVO, annotation, true);
 321  
     }
 322  
 
 323  
     public RouteHeaderDTO superUserCancel(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, boolean runPostProcessor) throws WorkflowException {
 324  0
             DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 325  0
         incomingParamCheck(principalId, "principalId");
 326  0
         LOG.debug("SU Cancel [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 327  0
         routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserCancelAction(principalId, routeHeader, annotation, runPostProcessor);
 328  0
         return DTOConverter.convertRouteHeader(routeHeader, principalId);
 329  
     }
 330  
 
 331  
     public RouteHeaderDTO superUserCancel(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 332  0
             return superUserCancel(principalId, routeHeaderVO, annotation, true);
 333  
     }
 334  
     
 335  
     public RouteHeaderDTO placeInExceptionRouting(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException {
 336  0
                   DocumentRouteHeaderValue routeHeader = init(routeHeaderVO);
 337  0
                   incomingParamCheck(principalId, "principalId");
 338  0
                   LOG.debug("placeInExceptionRouting [principalId=" + principalId + ", docId=" + routeHeaderVO.getDocumentId() + ", annotation=" + annotation + "]");
 339  0
                   routeHeader = KEWServiceLocator.getWorkflowDocumentService().placeInExceptionRouting(principalId, routeHeader, annotation);
 340  0
                   return DTOConverter.convertRouteHeader(routeHeader, principalId);
 341  
           }
 342  
 
 343  
         public DocumentContentDTO saveDocumentContent(DocumentContentDTO documentContent) throws WorkflowException {
 344  0
                 incomingParamCheck(documentContent, "documentContent");
 345  0
                 String documentId = documentContent.getDocumentId();
 346  0
                 incomingParamCheck(documentId, "documentContent document ID");
 347  0
                 KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true);
 348  0
         DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 349  0
                 LOG.debug("Saving Document Content [documentId=" + documentId + "]");
 350  0
                 String updatedDocumentContent = DTOConverter.buildUpdatedDocumentContent(documentContent);
 351  
             // updatedDocumentContent will be null if the content has not changed, only update if its changed
 352  0
             if (updatedDocumentContent != null) {
 353  0
                     document.setDocContent(updatedDocumentContent);
 354  0
                     KEWServiceLocator.getRouteHeaderService().saveRouteHeader(document);
 355  
             }
 356  0
             return DTOConverter.convertDocumentContent(document.getDocContent(), documentId);
 357  
         }
 358  
 
 359  
         public void superUserNodeApproveAction(String principalId, String documentId, String nodeName, String annotation, boolean runPostProcessor) throws WorkflowException {
 360  0
             init(documentId);
 361  0
             incomingParamCheck(principalId, "principalId");
 362  0
             LOG.debug("SU Node Approve Action [principalId=" + principalId + ", docId=" + documentId + ", nodeName=" + nodeName + ", annotation=" + annotation + "]");
 363  0
             KEWServiceLocator.getWorkflowDocumentService().superUserNodeApproveAction(principalId, documentId, nodeName, annotation, runPostProcessor);
 364  0
         }
 365  
 
 366  
         public void superUserNodeApproveAction(String principalId, String documentId, String nodeName, String annotation) throws WorkflowException {
 367  0
                 superUserNodeApproveAction(principalId, documentId, nodeName, annotation, true);
 368  0
         }
 369  
 
 370  
         public void superUserActionRequestApproveAction(String principalId, String documentId, Long actionRequestId, String annotation, boolean runPostProcessor) throws WorkflowException {
 371  0
             init(documentId);
 372  0
             incomingParamCheck(principalId, "principalId");
 373  0
             LOG.debug("SU Action Request Approve [principalId=" + principalId + ", docId=" + documentId + ", actionRequestId=" + actionRequestId + ", annotation=" + annotation + "]");
 374  0
             DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 375  0
             document = KEWServiceLocator.getWorkflowDocumentService().superUserActionRequestApproveAction(principalId, document, actionRequestId, annotation, runPostProcessor);
 376  0
         }
 377  
 
 378  
         public void superUserActionRequestApproveAction(String principalId, String documentId, Long actionRequestId, String annotation) throws WorkflowException {
 379  0
                 superUserActionRequestApproveAction(principalId, documentId, actionRequestId, annotation, true);
 380  0
         }
 381  
 
 382  
         public void superUserReturnToPreviousNode(String principalId, String documentId, String destinationNodeName, String annotation, boolean runPostProcessor) throws WorkflowException {
 383  0
             init(documentId);
 384  0
             incomingParamCheck(principalId, "principalId");
 385  0
             LOG.debug("SU Cancel [principalId=" + principalId + ", docId=" + documentId + ", destinationNodeName=" + destinationNodeName + ", annotation=" + annotation + "]");
 386  0
             KEWServiceLocator.getWorkflowDocumentService().superUserReturnDocumentToPreviousNode(principalId, documentId, destinationNodeName, annotation, runPostProcessor);
 387  0
         }
 388  
 
 389  
         public void superUserReturnToPreviousNode(String principalId, String documentId, String destinationNodeName, String annotation) throws WorkflowException {
 390  0
                 superUserReturnToPreviousNode(principalId, documentId, destinationNodeName, annotation, true);
 391  0
         }
 392  
 
 393  
         /**
 394  
          * This mehtod indexes a document based on the documentId
 395  
          * 
 396  
          * @see org.kuali.rice.kew.service.WorkflowDocumentActions#indexDocument(java.lang.Long)
 397  
          */        
 398  
         public void indexDocument(String documentId) {
 399  0
                 SearchableAttributeProcessingService searchableAttService = (SearchableAttributeProcessingService) MessageServiceNames.getSearchableAttributeService(KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId));
 400  0
                 searchableAttService.indexDocument(documentId);                
 401  0
         }
 402  
 
 403  
 }