Coverage Report - org.kuali.rice.kew.actions.asyncservices.BlanketApproveProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
BlanketApproveProcessor
0%
0/19
0%
0/2
2.5
 
 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.actions.asyncservices;
 18  
 
 19  
 import java.util.Set;
 20  
 
 21  
 import org.kuali.rice.kew.actions.BlanketApproveAction;
 22  
 import org.kuali.rice.kew.actiontaken.ActionTakenValue;
 23  
 import org.kuali.rice.kew.docsearch.service.SearchableAttributeProcessingService;
 24  
 import org.kuali.rice.kew.exception.WorkflowRuntimeException;
 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.kim.bo.entity.KimPrincipal;
 29  
 
 30  
 
 31  
 /**
 32  
  * Responsible for invoking the async piece of BlanketApprove
 33  
  *
 34  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 35  
  */
 36  0
 public class BlanketApproveProcessor implements BlanketApproveProcessorService {
 37  
         
 38  0
         private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BlanketApproveProcessor.class);
 39  
         
 40  
         public void doBlanketApproveWork(Long documentId, String principalId, Long actionTakenId, Set<String> nodeNames) {
 41  0
                 doBlanketApproveWork(documentId, principalId, actionTakenId, nodeNames, false);
 42  0
         }
 43  
 
 44  
         public void doBlanketApproveWork(Long documentId, String principalId, Long actionTakenId, Set<String> nodeNames, boolean shouldSearchIndex) {
 45  0
                 KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true);
 46  0
                 DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId);
 47  0
                 ActionTakenValue actionTaken = KEWServiceLocator.getActionTakenService().findByActionTakenId(actionTakenId);
 48  0
                 KimPrincipal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(principalId);
 49  0
                 BlanketApproveAction blanketApprove = new BlanketApproveAction(document, principal, "", nodeNames);
 50  0
                 LOG.debug("Doing blanket approve work document " + document.getRouteHeaderId());
 51  
                 try {
 52  0
                         blanketApprove.performDeferredBlanketApproveWork(actionTaken);
 53  0
                 } catch (Exception e) {
 54  0
                         throw new WorkflowRuntimeException(e);
 55  0
                 }
 56  0
                 if (shouldSearchIndex) {
 57  0
                         SearchableAttributeProcessingService searchableAttService = (SearchableAttributeProcessingService) MessageServiceNames.getSearchableAttributeService(KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId));
 58  0
                         searchableAttService.indexDocument(documentId);
 59  
                 }
 60  0
                 LOG.debug("Work done and document requeued, document " + document.getRouteHeaderId());
 61  0
         }
 62  
 }