Coverage Report - org.kuali.rice.kew.impl.document.WorkflowDocumentServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkflowDocumentServiceImpl
0%
0/174
0%
0/122
4.214
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kew.impl.document;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collection;
 20  
 import java.util.Collections;
 21  
 import java.util.LinkedHashSet;
 22  
 import java.util.List;
 23  
 import java.util.Set;
 24  
 
 25  
 import javax.jws.WebParam;
 26  
 
 27  
 import org.apache.commons.lang.StringUtils;
 28  
 import org.apache.log4j.Logger;
 29  
 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
 30  
 import org.kuali.rice.core.api.exception.RiceIllegalStateException;
 31  
 import org.kuali.rice.kew.actionrequest.ActionRequestValue;
 32  
 import org.kuali.rice.kew.actiontaken.ActionTakenValue;
 33  
 import org.kuali.rice.kew.api.action.ActionRequest;
 34  
 import org.kuali.rice.kew.api.action.ActionTaken;
 35  
 import org.kuali.rice.kew.api.document.Document;
 36  
 import org.kuali.rice.kew.api.document.DocumentContent;
 37  
 import org.kuali.rice.kew.api.document.DocumentDetail;
 38  
 import org.kuali.rice.kew.api.document.DocumentLink;
 39  
 import org.kuali.rice.kew.api.document.node.RouteNodeInstance;
 40  
 import org.kuali.rice.kew.api.document.WorkflowDocumentService;
 41  
 import org.kuali.rice.kew.dto.DTOConverter;
 42  
 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
 43  
 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValueContent;
 44  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 45  
 
 46  
 /**
 47  
  * TODO
 48  
  * 
 49  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 50  
  *
 51  
  */
 52  0
 public class WorkflowDocumentServiceImpl implements WorkflowDocumentService {
 53  
 
 54  0
         private static final Logger LOG = Logger.getLogger(WorkflowDocumentServiceImpl.class);
 55  
         
 56  
         @Override
 57  
         public Document getDocument(String documentId) {
 58  0
                 if (StringUtils.isBlank(documentId)) {
 59  0
                         throw new RiceIllegalArgumentException("documentId was blank or null");
 60  
                 }
 61  0
                 DocumentRouteHeaderValue documentBo = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 62  0
                 return DocumentRouteHeaderValue.to(documentBo);
 63  
         }
 64  
 
 65  
         @Override
 66  
         public boolean doesDocumentExist(String documentId) {
 67  0
             if (StringUtils.isBlank(documentId)) {
 68  0
             throw new RiceIllegalArgumentException("documentId was blank or null");
 69  
         }
 70  0
             DocumentRouteHeaderValue documentBo = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 71  0
             return documentBo != null;
 72  
         }
 73  
 
 74  
     public DocumentDetail getDocumentDetailByAppId(String documentTypeName, String appId) {
 75  0
         if (StringUtils.isEmpty(documentTypeName)) {
 76  0
             throw new RiceIllegalArgumentException("documentTypeName was blank or null");
 77  
         }
 78  0
         if (StringUtils.isEmpty(appId)) {
 79  0
             throw new RiceIllegalArgumentException("appId was blank or null");
 80  
         }
 81  
 
 82  0
         Collection documentIds = KEWServiceLocator.getRouteHeaderService().findByDocTypeAndAppId(documentTypeName, appId);
 83  0
         if(documentIds==null||documentIds.isEmpty()){
 84  0
             throw new RiceIllegalStateException("No RouteHeader Ids found for documentTypName: " + documentTypeName + ", appId: " + appId);
 85  
         }
 86  0
         if(documentIds.size()>1){
 87  0
             throw new RiceIllegalStateException("Multiple RouteHeader Ids found for documentTypName: " + documentTypeName + ", appId: " + appId);
 88  
                 }
 89  
 
 90  0
         return getDocumentDetail((String)documentIds.iterator().next());
 91  
         }
 92  
 
 93  
     public RouteNodeInstance getNodeInstance(String nodeInstanceId)  {
 94  0
         if (StringUtils.isEmpty(nodeInstanceId)) {
 95  0
             throw new RiceIllegalArgumentException("nodeInstanceId was blank or null");
 96  
         }
 97  0
         if ( LOG.isDebugEnabled() ) {
 98  0
                 LOG.debug("Fetching RouteNodeInstanceVO [id="+nodeInstanceId+"]");
 99  
         }
 100  0
         org.kuali.rice.kew.engine.node.RouteNodeInstance nodeInstance = KEWServiceLocator.getRouteNodeService().findRouteNodeInstanceById(nodeInstanceId);
 101  0
         return org.kuali.rice.kew.engine.node.RouteNodeInstance.to(nodeInstance);
 102  
     }
 103  
 
 104  
     public String getNewResponsibilityId() {
 105  0
         String rid = KEWServiceLocator.getResponsibilityIdService().getNewResponsibilityId();
 106  0
         if ( LOG.isDebugEnabled() ) {
 107  0
                 LOG.debug("returning responsibility Id " + rid);
 108  
         }
 109  0
         return rid;
 110  
     }
 111  
 
 112  
     @Override
 113  
     public String getDocumentStatus(String documentId) {
 114  0
         if (StringUtils.isEmpty(documentId)) {
 115  0
             throw new RiceIllegalArgumentException("documentId was blank or null");
 116  
         }
 117  0
         String documentStatus = KEWServiceLocator.getRouteHeaderService().getDocumentStatus(documentId);
 118  0
         if (StringUtils.isEmpty(documentStatus)) {
 119  0
             throw new RiceIllegalStateException("DocumentStatus not found for documentId: " + documentId);
 120  
         }
 121  0
         return documentStatus;
 122  
     }
 123  
 
 124  
     @Override
 125  
     public String getAppDocId(String documentId) {
 126  0
         if (documentId == null) {
 127  0
             throw new RiceIllegalArgumentException("documentId was blank or null");
 128  
         }
 129  0
                   return KEWServiceLocator.getRouteHeaderService().getAppDocId(documentId);
 130  
          }
 131  
         
 132  
         @Override
 133  
         public DocumentContent getDocumentContent(String documentId) {
 134  0
                 if (StringUtils.isBlank(documentId)) {
 135  0
                         throw new RiceIllegalArgumentException("documentId was blank or null");
 136  
                 }
 137  0
                 DocumentRouteHeaderValueContent content = KEWServiceLocator.getRouteHeaderService().getContent(documentId);
 138  0
                 return DocumentRouteHeaderValueContent.to(content);
 139  
         }
 140  
 
 141  
         @Override
 142  
         public List<ActionRequest> getRootActionRequests(String documentId) {
 143  0
                 List<ActionRequest> actionRequests = new ArrayList<ActionRequest>();
 144  0
                 List<ActionRequestValue> actionRequestBos = KEWServiceLocator.getActionRequestService().findAllRootActionRequestsByDocumentId(documentId);
 145  0
                 for (ActionRequestValue actionRequestBo : actionRequestBos) {
 146  0
                         actionRequests.add(ActionRequestValue.to(actionRequestBo));
 147  
                 }
 148  0
                 return Collections.unmodifiableList(actionRequests);
 149  
         }
 150  
         
 151  
         @Override
 152  
         public List<ActionRequest> getActionRequests(String documentId, String nodeName, String principalId) {
 153  0
         if (StringUtils.isBlank(documentId)) {
 154  0
                 throw new RiceIllegalArgumentException("documentId was null or blank");
 155  
         }
 156  0
         if ( LOG.isDebugEnabled() ) {
 157  0
                 LOG.debug("Fetching ActionRequests [docId="+documentId+", nodeName="+nodeName+", principalId="+principalId+"]");
 158  
         }
 159  0
         List<ActionRequestValue> actionRequestBos = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(documentId);
 160  0
         List<ActionRequestValue> matchingActionRequests = new ArrayList<ActionRequestValue>();
 161  0
         for (ActionRequestValue actionRequestValue : actionRequestBos) {
 162  0
             if (actionRequestMatches(actionRequestValue, nodeName, principalId)) {
 163  0
                 matchingActionRequests.add(actionRequestValue);
 164  
             }
 165  
         }
 166  0
         List<ActionRequest> actionRequests = new ArrayList<ActionRequest>(matchingActionRequests.size());
 167  0
         for (ActionRequestValue matchingActionRequest : matchingActionRequests) {
 168  0
                 actionRequests.add(ActionRequestValue.to(matchingActionRequest));
 169  
         }
 170  0
         return actionRequests;
 171  
     }
 172  
         
 173  
 
 174  
     protected boolean actionRequestMatches(ActionRequestValue actionRequest, String nodeName, String principalId) {
 175  0
         boolean matchesUserId = true;  // assume a match in case user is empty
 176  0
         boolean matchesNodeName = true;  // assume a match in case node name is empty
 177  0
         if (StringUtils.isNotBlank(nodeName)) {
 178  0
             matchesNodeName = nodeName.equals(actionRequest.getPotentialNodeName());
 179  
         }
 180  0
         if (principalId != null) {
 181  0
             matchesUserId = actionRequest.isRecipientRoutedRequest(principalId);
 182  
         }
 183  0
         return matchesNodeName && matchesUserId;
 184  
     }
 185  
 
 186  
 
 187  
         @Override
 188  
         public List<ActionTaken> getActionsTaken(String documentId) {
 189  0
                 List<ActionTaken> actionTakens = new ArrayList<ActionTaken>();
 190  0
                 Collection<ActionTakenValue> actionTakenBos = KEWServiceLocator.getActionTakenService().findByDocumentId(documentId);
 191  0
                 for (ActionTakenValue actionTakenBo : actionTakenBos) {
 192  0
                         actionTakens.add(ActionTakenValue.to(actionTakenBo));
 193  
                 }
 194  0
                 return actionTakens;
 195  
         }
 196  
         
 197  
         @Override
 198  
         public DocumentDetail getDocumentDetail(@WebParam(name = "documentId") String documentId) {
 199  0
                 if (StringUtils.isBlank(documentId)) {
 200  0
             throw new IllegalArgumentException("documentId was null or blank");
 201  
         }
 202  0
         if ( LOG.isDebugEnabled() ) {
 203  0
                 LOG.debug("Fetching DocumentDetail [id="+documentId+"]");
 204  
         }
 205  0
         DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 206  0
         if (document == null) {
 207  0
                 return null;
 208  
         }
 209  0
         DocumentDetail documentDetailVO = DTOConverter.convertDocumentDetailNew(document);
 210  0
         if ( LOG.isDebugEnabled() ) {
 211  0
                 LOG.debug("Returning DocumentDetailVO [id=" + documentId + "]");
 212  
         }
 213  0
         return documentDetailVO;
 214  
         }
 215  
         
 216  
         @Override
 217  
         public List<RouteNodeInstance> getRouteNodeInstances(String documentId) {
 218  0
             if ( LOG.isDebugEnabled() ) {
 219  0
                     LOG.debug("Fetching RouteNodeInstances [documentId=" + documentId + "]");
 220  
             }
 221  0
             DocumentRouteHeaderValue documentBo = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 222  0
             if (documentBo == null) {
 223  0
                     return Collections.emptyList();
 224  
             }
 225  0
             return convertRouteNodeInstances(KEWServiceLocator.getRouteNodeService().getFlattenedNodeInstances(documentBo, true));
 226  
     }        
 227  
         
 228  
         @Override
 229  
         public List<RouteNodeInstance> getActiveRouteNodeInstances(String documentId) {
 230  0
                 if ( LOG.isDebugEnabled() ) {
 231  0
                     LOG.debug("Fetching active RouteNodeInstances [documentId=" + documentId + "]");
 232  
             }
 233  0
         return convertRouteNodeInstances(KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(documentId));
 234  
         }
 235  
 
 236  
     @Override
 237  
     public List<RouteNodeInstance> getTerminalNodeInstances(String documentId) {
 238  0
             if ( LOG.isDebugEnabled() ) {
 239  0
                     LOG.debug("Fetching terminal RouteNodeInstanceVOs [docId=" + documentId + "]");
 240  
             }
 241  0
         return convertRouteNodeInstances(KEWServiceLocator.getRouteNodeService().getTerminalNodeInstances(documentId));
 242  
     }
 243  
 
 244  
     public List<RouteNodeInstance> getCurrentNodeInstances(String documentId) {
 245  0
             if ( LOG.isDebugEnabled() ) {
 246  0
                     LOG.debug("Fetching current RouteNodeInstanceVOs [docId=" + documentId + "]");
 247  
             }
 248  0
             return convertRouteNodeInstances(KEWServiceLocator.getRouteNodeService().getCurrentNodeInstances(documentId));
 249  
     }
 250  
 
 251  
         private List<RouteNodeInstance> convertRouteNodeInstances(List<org.kuali.rice.kew.engine.node.RouteNodeInstance> routeNodeInstanceBos) {
 252  0
                 List<RouteNodeInstance> routeNodeInstances = new ArrayList<RouteNodeInstance>();
 253  0
         for (org.kuali.rice.kew.engine.node.RouteNodeInstance routeNodeInstanceBo : routeNodeInstanceBos) {
 254  0
                 routeNodeInstances.add(org.kuali.rice.kew.engine.node.RouteNodeInstance.to(routeNodeInstanceBo));
 255  
         }
 256  0
         return Collections.unmodifiableList(routeNodeInstances);
 257  
         }
 258  
         
 259  
         @Override
 260  
         public List<String> getPreviousRouteNodeNames(String documentId) {
 261  0
                 if ( LOG.isDebugEnabled() ) {
 262  0
                         LOG.debug("Fetching previous node names [documentId=" + documentId + "]");
 263  
                 }
 264  0
                 DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 265  
                 
 266  
                 // TODO validate that the doc is null or not instead of just throwing NPE?
 267  
                 
 268  
                 //going conservative for now.  if the doc isn't enroute or exception nothing will be returned.
 269  0
                 if (document.isEnroute() || document.isInException()) {
 270  
 
 271  
                         // TODO: KULRICE-5329 verify that the rewrite of the numeric logic below is reasonable -- I'm guessing it's not -- this one's a fairly radical change since I had to throw
 272  
                         // away the whole premise of using the longValue of the id as a strategy, so I think I'm massively oversimplifying the original goal of the logic
 273  0
                         List<org.kuali.rice.kew.engine.node.RouteNodeInstance> routeNodeInstances = KEWServiceLocator.getRouteNodeService().getFlattenedNodeInstances(document, false);
 274  0
                         Set<String> routeNodeNames = new LinkedHashSet<String>();
 275  0
                         if (routeNodeInstances != null) {
 276  0
                                 for (org.kuali.rice.kew.engine.node.RouteNodeInstance routeNodeInstance : routeNodeInstances) {
 277  0
                                         if (routeNodeInstance.isComplete()) {
 278  0
                                                 routeNodeNames.add(routeNodeInstance.getName());
 279  
                                         }
 280  
                                 }
 281  
                         }
 282  
 //                        List<org.kuali.rice.kew.engine.node.RouteNodeInstance> activeNodeInstances = KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(document);
 283  
 //                        long largetActivatedNodeId = 0;
 284  
 //                        for (org.kuali.rice.kew.engine.node.RouteNodeInstance routeNodeInstance : activeNodeInstances) {
 285  
 //                                if (routeNodeInstance.getRouteNode().getRouteNodeId().longValue() > largetActivatedNodeId) {
 286  
 //                                        largetActivatedNodeId = routeNodeInstance.getRouteNode().getRouteNodeId().longValue();
 287  
 //                                }
 288  
 //                        }
 289  
 //
 290  
 //                        List<org.kuali.rice.kew.engine.node.RouteNodeInstance> routeNodes = KEWServiceLocator.getRouteNodeService().getFlattenedNodeInstances(document, false);
 291  
 //                        List<String> nodeNames = new ArrayList<String>();
 292  
 //
 293  
 //                        for (org.kuali.rice.kew.engine.node.RouteNodeInstance routeNode : routeNodes) {
 294  
 //                                if (routeNode.isComplete() && !nodeNames.contains(routeNode.getName())) {
 295  
 //                                        //if the prototype of the nodeInstance we're analyzing is less than the largest id of all our active prototypes
 296  
 //                                        //then add it to the list.  This is an attempt to account for return to previous hitting a single node multiple times
 297  
 //                                        if (routeNode.getRouteNode().getRouteNodeId().longValue() < largetActivatedNodeId) {
 298  
 //                                                nodeNames.add(routeNode.getName());
 299  
 //                                        }
 300  
 //                                }
 301  
 //                        }
 302  0
                         return Collections.unmodifiableList(new ArrayList<String>(routeNodeNames));
 303  
                 } else {
 304  0
                         return Collections.emptyList();
 305  
                 }
 306  
         }
 307  
 
 308  
 
 309  
     public List<String> getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(String actionRequestedCd, String documentId){
 310  0
             if (StringUtils.isEmpty(actionRequestedCd)) {
 311  0
             throw new RiceIllegalArgumentException("actionRequestCd was blank or null");
 312  
         }
 313  0
         if (StringUtils.isEmpty(documentId)) {
 314  0
             throw new RiceIllegalArgumentException("documentId was blank or null");
 315  
         }
 316  0
         return KEWServiceLocator.getActionRequestService().
 317  
                                     getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(actionRequestedCd, documentId);
 318  
     }
 319  
 
 320  
     public String getDocumentInitiatorPrincipalId(String documentId) {
 321  0
         if (StringUtils.isEmpty(documentId)) {
 322  0
             throw new RiceIllegalArgumentException("documentId was blank or null");
 323  
         }
 324  
 
 325  0
         DocumentRouteHeaderValue header = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId, false);
 326  0
         if ( header == null) {
 327  0
                 return null;
 328  
         }
 329  0
             return header.getInitiatorWorkflowId();
 330  
     }
 331  
 
 332  
     public String getDocumentRoutedByPrincipalId(String documentId) {
 333  0
         if (StringUtils.isEmpty(documentId)) {
 334  0
             throw new RiceIllegalArgumentException("documentId was blank or null");
 335  
         }
 336  
 
 337  0
         DocumentRouteHeaderValue header = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId, false);
 338  0
         if ( header == null) {
 339  0
                 return null;
 340  
         }
 341  0
             return header.getRoutedByUserWorkflowId();
 342  
     }
 343  
 
 344  
         @Override
 345  
         public DocumentLink addDocumentLink(DocumentLink documentLink) throws RiceIllegalArgumentException {
 346  0
                 if (documentLink == null) {
 347  0
                         throw new RiceIllegalArgumentException("documentLink was null");
 348  
                 }
 349  0
                 if (documentLink.getId() != null) {
 350  0
                         throw new RiceIllegalArgumentException("the given documentLink already has an id, cannot add a document link with an existing id");
 351  
                 }
 352  0
                 org.kuali.rice.kew.documentlink.DocumentLink documentLinkBo = org.kuali.rice.kew.documentlink.DocumentLink.from(documentLink);
 353  0
                 KEWServiceLocator.getDocumentLinkService().saveDocumentLink(documentLinkBo);
 354  0
                 return org.kuali.rice.kew.documentlink.DocumentLink.to(documentLinkBo);
 355  
         }
 356  
 
 357  
         @Override
 358  
         public DocumentLink deleteDocumentLink(String documentLinkId) throws RiceIllegalArgumentException {
 359  0
                 if (StringUtils.isBlank(documentLinkId)) {
 360  0
                         throw new RiceIllegalArgumentException("documentLinkId was null or blank");
 361  
                 }
 362  0
                 org.kuali.rice.kew.documentlink.DocumentLink documentLinkBo = KEWServiceLocator.getDocumentLinkService().getDocumentLink(Long.valueOf(documentLinkId));
 363  0
                 if (documentLinkBo == null) {
 364  0
                         throw new RiceIllegalArgumentException("Failed to locate document link with the given documentLinkId: " + documentLinkId);
 365  
                 }
 366  0
                 KEWServiceLocator.getDocumentLinkService().deleteDocumentLink(documentLinkBo);
 367  0
                 return org.kuali.rice.kew.documentlink.DocumentLink.to(documentLinkBo);
 368  
         }
 369  
             
 370  
         @Override
 371  
         public List<DocumentLink> deleteDocumentLinksByDocumentId(String originatingDocumentId) throws RiceIllegalArgumentException {
 372  0
                 if (StringUtils.isBlank(originatingDocumentId)) {
 373  0
                         throw new RiceIllegalArgumentException("originatingDocumentId was null or blank");
 374  
                 }
 375  0
                 List<org.kuali.rice.kew.documentlink.DocumentLink> documentLinkBos = KEWServiceLocator.getDocumentLinkService().getLinkedDocumentsByDocId(originatingDocumentId);
 376  0
                 if (documentLinkBos == null || documentLinkBos.isEmpty()) {
 377  0
                         return Collections.emptyList();
 378  
                 }
 379  0
                 List<DocumentLink> deletedDocumentLinks = new ArrayList<DocumentLink>();
 380  0
                 for (org.kuali.rice.kew.documentlink.DocumentLink documentLinkBo : documentLinkBos) {
 381  0
                         deletedDocumentLinks.add(org.kuali.rice.kew.documentlink.DocumentLink.to(documentLinkBo));
 382  0
                         KEWServiceLocator.getDocumentLinkService().deleteDocumentLink(documentLinkBo);
 383  
                 }
 384  0
                 return Collections.unmodifiableList(deletedDocumentLinks);
 385  
     }
 386  
             
 387  
         @Override
 388  
         public List<DocumentLink> getOutgoingDocumentLinks(String originatingDocumentId) throws RiceIllegalArgumentException {
 389  0
                 if (StringUtils.isBlank(originatingDocumentId)) {
 390  0
                         throw new RiceIllegalArgumentException("originatingDocumentId was null or blank");
 391  
                 }
 392  0
                 List<org.kuali.rice.kew.documentlink.DocumentLink> outgoingDocumentLinkBos = KEWServiceLocator.getDocumentLinkService().getLinkedDocumentsByDocId(originatingDocumentId);
 393  0
                 List<DocumentLink> outgoingDocumentLinks = new ArrayList<DocumentLink>();
 394  0
                 for (org.kuali.rice.kew.documentlink.DocumentLink outgoingDocumentLinkBo : outgoingDocumentLinkBos) {
 395  0
                         outgoingDocumentLinks.add(org.kuali.rice.kew.documentlink.DocumentLink.to(outgoingDocumentLinkBo));
 396  
                 }
 397  0
                 return Collections.unmodifiableList(outgoingDocumentLinks);
 398  
     }
 399  
         
 400  
         @Override
 401  
         public List<DocumentLink> getIncomingDocumentLinks(String destinationDocumentId) throws RiceIllegalArgumentException {
 402  0
                 if (StringUtils.isBlank(destinationDocumentId)) {
 403  0
                         throw new RiceIllegalArgumentException("destinationDocumentId was null or blank");
 404  
                 }
 405  0
                 List<org.kuali.rice.kew.documentlink.DocumentLink> incomingDocumentLinkBos = KEWServiceLocator.getDocumentLinkService().getOutgoingLinkedDocumentsByDocId(destinationDocumentId);
 406  0
                 List<DocumentLink> incomingDocumentLinks = new ArrayList<DocumentLink>();
 407  0
                 for (org.kuali.rice.kew.documentlink.DocumentLink incomingDocumentLinkBo : incomingDocumentLinkBos) {
 408  0
                         incomingDocumentLinks.add(org.kuali.rice.kew.documentlink.DocumentLink.to(incomingDocumentLinkBo));
 409  
                 }
 410  0
                 return Collections.unmodifiableList(incomingDocumentLinks);
 411  
     }
 412  
             
 413  
         @Override
 414  
         public DocumentLink getDocumentLink(String documentLinkId) throws RiceIllegalArgumentException {
 415  0
                 if (StringUtils.isBlank(documentLinkId)) {
 416  0
                         throw new RiceIllegalArgumentException("documentLinkId was null or blank");
 417  
                 }
 418  0
                 org.kuali.rice.kew.documentlink.DocumentLink documentLinkBo = KEWServiceLocator.getDocumentLinkService().getDocumentLink(Long.valueOf(documentLinkId));
 419  0
                 return org.kuali.rice.kew.documentlink.DocumentLink.to(documentLinkBo);
 420  
     }
 421  
         
 422  
 }