Coverage Report - org.kuali.rice.kew.rule.RulePostProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
RulePostProcessor
0%
0/10
0%
0/2
1.167
 
 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.rule;
 18  
 
 19  
 import org.kuali.rice.kew.postprocessor.DefaultPostProcessor;
 20  
 import org.kuali.rice.kew.postprocessor.DeleteEvent;
 21  
 import org.kuali.rice.kew.postprocessor.DocumentRouteLevelChange;
 22  
 import org.kuali.rice.kew.postprocessor.DocumentRouteStatusChange;
 23  
 import org.kuali.rice.kew.postprocessor.PostProcessor;
 24  
 import org.kuali.rice.kew.postprocessor.ProcessDocReport;
 25  
 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
 26  
 import org.kuali.rice.kew.routeheader.service.RouteHeaderService;
 27  
 import org.kuali.rice.kew.rule.service.RuleService;
 28  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 29  
 import org.kuali.rice.kew.util.KEWConstants;
 30  
 
 31  
 
 32  
 /**
 33  
  * The {@link PostProcessor} implementation for rules.  Delegates to the
 34  
  * {@link RuleService#makeCurrent(Long)} method.
 35  
  *
 36  
  * @see RuleService#makeCurrent(Long)
 37  
  *
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  0
 public class RulePostProcessor extends DefaultPostProcessor {
 41  
 
 42  
     public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception {
 43  0
         DocumentRouteHeaderValue routeHeader = getRouteHeaderService().getRouteHeader(statusChangeEvent.getDocumentId());
 44  
         
 45  0
         if (KEWConstants.ROUTE_HEADER_PROCESSED_CD.equals(routeHeader.getDocRouteStatus())) {
 46  0
             getRuleService().makeCurrent(routeHeader.getDocumentId());
 47  
         }
 48  0
         return new ProcessDocReport(true, "");
 49  
     }    
 50  
     
 51  
     public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception {
 52  0
         return new ProcessDocReport(true, "");
 53  
     }
 54  
 
 55  
     public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception {
 56  0
         return new ProcessDocReport(true, "");
 57  
     }
 58  
 
 59  
     public String getVersion() throws Exception {
 60  0
         return "";
 61  
     }
 62  
 
 63  
     private RouteHeaderService getRouteHeaderService() {
 64  0
         return (RouteHeaderService) KEWServiceLocator.getService(KEWServiceLocator.DOC_ROUTE_HEADER_SRV);
 65  
     }
 66  
 
 67  
     private RuleService getRuleService() {
 68  0
         return (RuleService) KEWServiceLocator.getService(KEWServiceLocator.RULE_SERVICE);
 69  
     }
 70  
 
 71  
 }