You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/01/21 08:19:42 UTC

[camel] branch master updated: Fixed camel-wordpress-starter to have all its options documented. Removed options not really in use.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new a2a698a  Fixed camel-wordpress-starter to have all its options documented. Removed options not really in use.
a2a698a is described below

commit a2a698aecc34bb190c8ea4409246f3e8880c87d2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jan 21 09:19:21 2019 +0100

    Fixed camel-wordpress-starter to have all its options documented. Removed options not really in use.
---
 .../src/main/docs/wordpress-component.adoc         | 12 +++---
 .../wordpress/WordpressComponentConfiguration.java | 46 ++--------------------
 .../wordpress/api/model/SearchCriteria.java        |  7 ++--
 .../producer/AbstractWordpressProducer.java        |  6 +--
 .../WordpressComponentConfiguration.java           | 16 +++-----
 5 files changed, 20 insertions(+), 67 deletions(-)

diff --git a/components/camel-wordpress/src/main/docs/wordpress-component.adoc b/components/camel-wordpress/src/main/docs/wordpress-component.adoc
index 8542653..16a50b0 100644
--- a/components/camel-wordpress/src/main/docs/wordpress-component.adoc
+++ b/components/camel-wordpress/src/main/docs/wordpress-component.adoc
@@ -42,7 +42,7 @@ with the following path and query parameters:
 |===
 
 
-==== Query Parameters (11 parameters):
+==== Query Parameters (12 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -51,8 +51,9 @@ with the following path and query parameters:
 | *apiVersion* (common) | The Wordpress REST API version | 2 | String
 | *criteria* (common) | The criteria to use with complex searches. |  | Map
 | *force* (common) | Whether to bypass trash and force deletion. | false | Boolean
-| *id* (common) | The entity id |  | Integer
+| *id* (common) | The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post |  | Integer
 | *password* (common) | Password from authorized user |  | String
+| *searchCriteria* (common) | Search criteria |  | SearchCriteria
 | *url* (common) | *Required* The Wordpress API URL from your site, e.g. http://myblog.com/wp-json/ |  | String
 | *user* (common) | Authorized user to perform writing operations |  | String
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
@@ -65,7 +66,7 @@ with the following path and query parameters:
 === Spring Boot Auto-Configuration
 
 
-The component supports 10 options, which are listed below.
+The component supports 9 options, which are listed below.
 
 
 
@@ -73,11 +74,10 @@ The component supports 10 options, which are listed below.
 |===
 | Name | Description | Default | Type
 | *camel.component.wordpress.configuration.api-version* | The Wordpress REST API version | 2 | String
-| *camel.component.wordpress.configuration.criteria-properties* |  |  | Map
 | *camel.component.wordpress.configuration.force* | Whether to bypass trash and force deletion. | false | Boolean
-| *camel.component.wordpress.configuration.id* | The entity id |  | Integer
+| *camel.component.wordpress.configuration.id* | The entity ID. Should be passed when the operation performed requires a specific entity, e.g. deleting a post |  | Integer
 | *camel.component.wordpress.configuration.password* | Password from authorized user |  | String
-| *camel.component.wordpress.configuration.search-criteria* |  |  | SearchCriteria
+| *camel.component.wordpress.configuration.search-criteria* | Search criteria |  | SearchCriteria
 | *camel.component.wordpress.configuration.url* | The Wordpress API URL from your site, e.g. http://myblog.com/wp-json/ |  | String
 | *camel.component.wordpress.configuration.user* | Authorized user to perform writing operations |  | String
 | *camel.component.wordpress.enabled* | Whether to enable auto configuration of the wordpress component. This is enabled by default. |  | Boolean
diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponentConfiguration.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponentConfiguration.java
index 0c21fe9..8ee12b9 100644
--- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponentConfiguration.java
+++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponentConfiguration.java
@@ -18,8 +18,6 @@ package org.apache.camel.component.wordpress;
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.camel.component.wordpress.api.WordpressConstants;
@@ -27,12 +25,13 @@ import org.apache.camel.component.wordpress.api.model.SearchCriteria;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.util.StringHelper;
 
 @UriParams
 public class WordpressComponentConfiguration {
 
+    private URI uri;
+
     @UriParam(description = "The Wordpress API URL from your site, e.g. http://myblog.com/wp-json/")
     @Metadata(required = true)
     private String url;
@@ -48,18 +47,9 @@ public class WordpressComponentConfiguration {
     private Map<String, Object> criteria;
     @UriParam(description = "Whether to bypass trash and force deletion.", defaultValue = "false", javaType = "java.lang.Boolean")
     private Boolean force = false;
-
+    @UriParam(description = "Search criteria")
     private SearchCriteria searchCriteria;
 
-    /**
-     * Wordpress URL in {@link URI} format
-     */
-    private URI uri;
-
-    public WordpressComponentConfiguration() {
-
-    }
-
     public String getUrl() {
         return url;
     }
@@ -96,9 +86,6 @@ public class WordpressComponentConfiguration {
         this.user = user;
     }
 
-    /**
-     * The entity id
-     */
     public Integer getId() {
         return id;
     }
@@ -115,11 +102,6 @@ public class WordpressComponentConfiguration {
         this.force = force;
     }
 
-    /**
-     * The search criteria
-     * 
-     * @return
-     */
     public SearchCriteria getSearchCriteria() {
         return searchCriteria;
     }
@@ -128,28 +110,6 @@ public class WordpressComponentConfiguration {
         this.searchCriteria = searchCriteria;
     }
 
-    public Map<String, Object> getCriteriaProperties() {
-        if (criteria != null) {
-            return Collections.unmodifiableMap(criteria);
-        }
-        return null;
-    }
-
-    public void setCriteriaProperties(Map<String, Object> criteriaProperties) {
-        this.criteria = Collections.unmodifiableMap(criteriaProperties);
-    }
-
-    /**
-     * Return all configuration properties on a map.
-     * 
-     * @return
-     */
-    public Map<String, Object> asMap() {
-        final Map<String, Object> map = new HashMap<>();
-        IntrospectionSupport.getProperties(this, map, null);
-        return map;
-    }
-
     public void validate() {
         StringHelper.notEmpty(this.apiVersion, "apiVersion");
         StringHelper.notEmpty(this.url, "url");
diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/model/SearchCriteria.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/model/SearchCriteria.java
index 2542bd2..ccc2050 100644
--- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/model/SearchCriteria.java
+++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/api/model/SearchCriteria.java
@@ -21,6 +21,9 @@ import java.util.List;
 
 import static com.google.common.base.MoreObjects.toStringHelper;
 
+/**
+ * Search criterias.
+ */
 public class SearchCriteria implements Serializable {
 
     private static final long serialVersionUID = 1002576245120313648L;
@@ -32,10 +35,6 @@ public class SearchCriteria implements Serializable {
     private List<Integer> exclude;
     private List<Integer> include;
 
-    public SearchCriteria() {
-
-    }
-
     public Integer getPage() {
         return page;
     }
diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/producer/AbstractWordpressProducer.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/producer/AbstractWordpressProducer.java
index e85957b..73b8423 100644
--- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/producer/AbstractWordpressProducer.java
+++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/producer/AbstractWordpressProducer.java
@@ -50,12 +50,12 @@ public abstract class AbstractWordpressProducer<T> extends DefaultProducer {
     @Override
     public final void process(Exchange exchange) throws Exception {
         if (this.getConfiguration().getId() == null) {
-            exchange.getOut().setBody(this.processInsert(exchange));
+            exchange.getMessage().setBody(this.processInsert(exchange));
         } else {
             if (this.getEndpoint().getOperationDetail() == null) {
-                exchange.getOut().setBody(this.processUpdate(exchange));
+                exchange.getMessage().setBody(this.processUpdate(exchange));
             } else {
-                exchange.getOut().setBody(this.processDelete(exchange));
+                exchange.getMessage().setBody(this.processDelete(exchange));
             }
         }
     }
diff --git a/platforms/spring-boot/components-starter/camel-wordpress-starter/src/main/java/org/apache/camel/component/wordpress/springboot/WordpressComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-wordpress-starter/src/main/java/org/apache/camel/component/wordpress/springboot/WordpressComponentConfiguration.java
index b14b35e..3c68257 100644
--- a/platforms/spring-boot/components-starter/camel-wordpress-starter/src/main/java/org/apache/camel/component/wordpress/springboot/WordpressComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-wordpress-starter/src/main/java/org/apache/camel/component/wordpress/springboot/WordpressComponentConfiguration.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.wordpress.springboot;
 
-import java.util.Map;
 import javax.annotation.Generated;
 import org.apache.camel.component.wordpress.api.model.SearchCriteria;
 import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
@@ -86,15 +85,18 @@ public class WordpressComponentConfiguration
          */
         private String user;
         /**
-         * The entity id
+         * The entity ID. Should be passed when the operation performed requires
+         * a specific entity, e.g. deleting a post
          */
         private Integer id;
         /**
          * Whether to bypass trash and force deletion.
          */
         private Boolean force = false;
+        /**
+         * Search criteria
+         */
         private SearchCriteria searchCriteria;
-        private Map criteriaProperties;
 
         public String getUrl() {
             return url;
@@ -151,13 +153,5 @@ public class WordpressComponentConfiguration
         public void setSearchCriteria(SearchCriteria searchCriteria) {
             this.searchCriteria = searchCriteria;
         }
-
-        public Map getCriteriaProperties() {
-            return criteriaProperties;
-        }
-
-        public void setCriteriaProperties(Map criteriaProperties) {
-            this.criteriaProperties = criteriaProperties;
-        }
     }
 }
\ No newline at end of file