Coverage Report - org.apache.camel.model.ExpressionNode
 
Classes in this File Line Coverage Branch Coverage Complexity
ExpressionNode
74% 
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.model;
 18  
 
 19  
 import java.util.ArrayList;
 20  
 import java.util.List;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlAccessType;
 23  
 import javax.xml.bind.annotation.XmlAccessorType;
 24  
 import javax.xml.bind.annotation.XmlElement;
 25  
 import javax.xml.bind.annotation.XmlElementRef;
 26  
 
 27  
 import org.apache.camel.Expression;
 28  
 import org.apache.camel.Predicate;
 29  
 import org.apache.camel.Processor;
 30  
 import org.apache.camel.impl.RouteContext;
 31  
 import org.apache.camel.model.language.ExpressionType;
 32  
 import org.apache.camel.processor.FilterProcessor;
 33  
 
 34  
 /**
 35  
  * A base class for nodes which contain an expression and a number of outputs
 36  
  *
 37  
  * @version $Revision: $
 38  
  */
 39  
 @XmlAccessorType(XmlAccessType.FIELD)
 40  
 public class ExpressionNode extends ProcessorType {
 41  
     @XmlElementRef
 42  147
     private List<InterceptorType> interceptors = new ArrayList<InterceptorType>();
 43  
     @XmlElementRef
 44  
     private ExpressionType expression;
 45  
     @XmlElementRef
 46  147
     private List<ProcessorType> outputs = new ArrayList<ProcessorType>();
 47  
 
 48  30
     public ExpressionNode() {
 49  30
     }
 50  
 
 51  0
     public ExpressionNode(ExpressionType expression) {
 52  0
         this.expression = expression;
 53  0
     }
 54  
 
 55  24
     public ExpressionNode(Expression expression) {
 56  24
         setExpression(new ExpressionType(expression));
 57  24
     }
 58  
 
 59  93
     public ExpressionNode(Predicate predicate) {
 60  93
         setExpression(new ExpressionType(predicate));
 61  93
     }
 62  
 
 63  
     public List<InterceptorType> getInterceptors() {
 64  129
         return interceptors;
 65  
     }
 66  
 
 67  
     public void setInterceptors(List<InterceptorType> interceptors) {
 68  0
         this.interceptors = interceptors;
 69  0
     }
 70  
 
 71  
     public ExpressionType getExpression() {
 72  264
         return expression;
 73  
     }
 74  
 
 75  
     public void setExpression(ExpressionType expression) {
 76  123
         this.expression = expression;
 77  123
     }
 78  
 
 79  
     public List<ProcessorType> getOutputs() {
 80  351
         return outputs;
 81  
     }
 82  
 
 83  
     public void setOutputs(List<ProcessorType> outputs) {
 84  0
         this.outputs = outputs;
 85  0
     }
 86  
 
 87  
     protected FilterProcessor createFilterProcessor(RouteContext routeContext) throws Exception {
 88  93
         Processor childProcessor = routeContext.createProcessor(this);
 89  93
         return new FilterProcessor(getExpression().createPredicate(routeContext), childProcessor);
 90  
     }
 91  
 
 92  
     @Override
 93  
     protected void configureChild(ProcessorType output) {
 94  69
         if (isInheritErrorHandler()) {
 95  66
             output.setErrorHandlerBuilder(getErrorHandlerBuilder());
 96  
         }
 97  69
     }
 98  
 }