This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch camel-master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit c9f7b3cdfb7d0c04db14d5519a6cfbd14bdd72a1
Author: JiriOndrusek <ondrusek.j...@gmail.com>
AuthorDate: Mon Aug 17 11:59:12 2020 +0200

    Fixed setter and getter for RouteTemplateDefinition + small optimization
---
 .../src/main/java/org/apache/camel/quarkus/core/BaseModel.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/BaseModel.java
 
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/BaseModel.java
index 58d93bc..636f6cc 100644
--- 
a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/BaseModel.java
+++ 
b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/BaseModel.java
@@ -27,6 +27,7 @@ import 
org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.transformer.TransformerDefinition;
 import org.apache.camel.model.validator.ValidatorDefinition;
+import org.apache.camel.spi.NodeIdFactory;
 import org.apache.camel.util.CollectionStringBuffer;
 
 public abstract class BaseModel implements Model {
@@ -120,8 +121,9 @@ public abstract class BaseModel implements Model {
 
     @Override
     public RouteTemplateDefinition getRouteTemplateDefinition(String id) {
+        NodeIdFactory nodeIdFactory = 
camelContext.adapt(ExtendedCamelContext.class).getNodeIdFactory();
         for (RouteTemplateDefinition route : routeTemplateDefinitions) {
-            if 
(route.idOrCreate(camelContext.adapt(ExtendedCamelContext.class).getNodeIdFactory()).equals(id))
 {
+            if (route.idOrCreate(nodeIdFactory).equals(id)) {
                 return route;
             }
         }
@@ -138,12 +140,12 @@ public abstract class BaseModel implements Model {
 
     @Override
     public void addRouteTemplateDefinition(RouteTemplateDefinition 
routeTemplateDefinition) throws Exception {
-        this.routeTemplateDefinitions.addAll(routeTemplateDefinitions);
+        this.routeTemplateDefinitions.add(routeTemplateDefinition);
     }
 
     @Override
     public void 
removeRouteTemplateDefinitions(Collection<RouteTemplateDefinition> 
routeTemplateDefinitions) throws Exception {
-        routeTemplateDefinitions.removeAll(routeTemplateDefinitions);
+        this.routeTemplateDefinitions.removeAll(routeTemplateDefinitions);
     }
 
     @Override

Reply via email to