Author: davsclaus
Date: Wed Jan  4 10:11:00 2012
New Revision: 1227096

URL: http://svn.apache.org/viewvc?rev=1227096&view=rev
Log:
CAMEL-4809: When predicate on interceptors should use WhenDefinition to be 
consistent between Java DSL and XML DSLs.

Modified:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java?rev=1227096&r1=1227095&r2=1227096&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
 Wed Jan  4 10:11:00 2012
@@ -112,15 +112,16 @@ public class InterceptDefinition extends
      * @param predicate the predicate
      * @return the builder
      */
-    public ChoiceDefinition when(Predicate predicate) {
-        return choice().when(predicate);
+    public InterceptDefinition when(Predicate predicate) {
+        WhenDefinition when = new WhenDefinition(predicate);
+        addOutput(when);
+        return this;
     }
 
     /**
      * This method is <b>only</b> for handling some post configuration
-     * that is needed from the Spring DSL side as JAXB does not invoke the 
fluent
-     * builders, so we need to manually handle this afterwards, and since this 
is
-     * an interceptor it has to do a bit of magic logic to fixup to handle 
predicates
+     * that is needed since this is an interceptor, and we have to do
+     * a bit of magic logic to fixup to handle predicates
      * with or without proceed/stop set as well.
      */
     public void afterPropertiesSet() {

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java?rev=1227096&r1=1227095&r2=1227096&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
 Wed Jan  4 10:11:00 2012
@@ -122,8 +122,10 @@ public class InterceptSendToEndpointDefi
      * @param predicate  the predicate
      * @return the builder
      */
-    public ChoiceDefinition when(Predicate predicate) {
-        return choice().when(predicate);
+    public InterceptSendToEndpointDefinition when(Predicate predicate) {
+        WhenDefinition when = new WhenDefinition(predicate);
+        addOutput(when);
+        return this;
     }
 
     /**
@@ -138,9 +140,8 @@ public class InterceptSendToEndpointDefi
 
     /**
      * This method is <b>only</b> for handling some post configuration
-     * that is needed from the Spring DSL side as JAXB does not invoke the 
fluent
-     * builders, so we need to manually handle this afterwards, and since this 
is
-     * an interceptor it has to do a bit of magic logic to fixup to handle 
predicates
+     * that is needed since this is an interceptor, and we have to do
+     * a bit of magic logic to fixup to handle predicates
      * with or without proceed/stop set as well.
      */
     public void afterPropertiesSet() {


Reply via email to