Coverage Report - org.apache.camel.bam.rules.ProcessRules
 
Classes in this File Line Coverage Branch Coverage Complexity
ProcessRules
89% 
100% 
0
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 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.apache.camel.bam.rules;
 18  
 
 19  
 import org.apache.camel.Exchange;
 20  
 import org.apache.camel.bam.model.ActivityState;
 21  
 import org.apache.camel.bam.model.ProcessDefinition;
 22  
 import org.apache.camel.bam.model.ProcessInstance;
 23  
 import org.apache.camel.impl.ServiceSupport;
 24  
 import org.apache.camel.util.ServiceHelper;
 25  
 
 26  
 import java.util.ArrayList;
 27  
 import java.util.List;
 28  
 
 29  
 /**
 30  
  * @version $Revision: $
 31  
  */
 32  1
 public class ProcessRules extends ServiceSupport {
 33  
     private ProcessDefinition processDefinition;
 34  1
     private List<ActivityRules> activities = new ArrayList<ActivityRules>();
 35  
 
 36  
     public void processExpired(ActivityState activityState) throws Exception {
 37  1
         for (ActivityRules activityRules : activities) {
 38  3
             activityRules.processExpired(activityState);
 39  3
         }
 40  1
     }
 41  
 
 42  
     public void processExchange(Exchange exchange, ProcessInstance process) {
 43  1
         for (ActivityRules activityRules : activities) {
 44  3
             activityRules.processExchange(exchange, process);
 45  3
         }
 46  1
     }
 47  
 
 48  
     // Properties
 49  
     //-------------------------------------------------------------------------
 50  
     public List<ActivityRules> getActivities() {
 51  3
         return activities;
 52  
     }
 53  
 
 54  
     public ProcessDefinition getProcessDefinition() {
 55  1
         return processDefinition;
 56  
     }
 57  
 
 58  
     public void setProcessDefinition(ProcessDefinition processDefinition) {
 59  3
         this.processDefinition = processDefinition;
 60  3
     }
 61  
 
 62  
     // Implementation methods
 63  
     //-------------------------------------------------------------------------
 64  
     protected void doStart() throws Exception {
 65  1
         ServiceHelper.startServices(activities);
 66  1
     }
 67  
 
 68  
     protected void doStop() throws Exception {
 69  0
         ServiceHelper.stopServices(activities);
 70  0
     }
 71  
 }
 72  
 
 73  
 
 74