| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 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 |
|
|
| 36 |
|
|
| 37 |
|
|
| 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 |
|
} |