You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/11/17 14:53:39 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-253] use event schema from adapter description if exists

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

wiener pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 1040204  [STREAMPIPES-253] use event schema from adapter description if exists
1040204 is described below

commit 10402040011f10bd172800880828d9bba7d3a134
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Tue Nov 17 15:47:33 2020 +0100

    [STREAMPIPES-253] use event schema from adapter description if exists
---
 .../data-marketplace/data-marketplace.component.ts | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts b/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts
index ee30a9a..8fb9b15 100644
--- a/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts
+++ b/ui/src/app/connect/components/data-marketplace/data-marketplace.component.ts
@@ -145,16 +145,24 @@ export class DataMarketplaceComponent implements OnInit {
         this.newAdapterFromDescription.name = "";
         this.newAdapterFromDescription.description = "";
         if (this.newAdapterFromDescription instanceof AdapterStreamDescription) {
-            this.newAdapterFromDescription.dataStream = new SpDataStream();
-            this.newAdapterFromDescription.dataStream["@class"] = "org.apache.streampipes.model.SpDataStream";
-            this.newAdapterFromDescription.dataStream.eventSchema = new EventSchema();
-            this.newAdapterFromDescription.dataStream.eventSchema["@class"] = "org.apache.streampipes.model.schema.EventSchema";
+
+            // Create new SpDataStream and EventSchema if not already exists, e.g. in adapter template
+            if (this.newAdapterFromDescription.dataStream == undefined) {
+                this.newAdapterFromDescription.dataStream = new SpDataStream();
+                this.newAdapterFromDescription.dataStream["@class"] = "org.apache.streampipes.model.SpDataStream";
+                this.newAdapterFromDescription.dataStream.eventSchema = new EventSchema();
+                this.newAdapterFromDescription.dataStream.eventSchema["@class"] = "org.apache.streampipes.model.schema.EventSchema";
+            }
         }
         if (this.newAdapterFromDescription instanceof AdapterSetDescription) {
-            this.newAdapterFromDescription.dataSet = new SpDataSet();
-            this.newAdapterFromDescription.dataSet["@class"] = "org.apache.streampipes.model.SpDataSet";
-            this.newAdapterFromDescription.dataSet.eventSchema = new EventSchema();
-            this.newAdapterFromDescription.dataSet.eventSchema["@class"] = "org.apache.streampipes.model.schema.EventSchema";
+
+            // Create new SpDataSet and EventSchema if not already exists, e.g. in adapter template
+            if (this.newAdapterFromDescription.dataSet == undefined) {
+                this.newAdapterFromDescription.dataSet = new SpDataSet();
+                this.newAdapterFromDescription.dataSet["@class"] = "org.apache.streampipes.model.SpDataSet";
+                this.newAdapterFromDescription.dataSet.eventSchema = new EventSchema();
+                this.newAdapterFromDescription.dataSet.eventSchema["@class"] = "org.apache.streampipes.model.schema.EventSchema";
+            }
         }
         this.ShepherdService.trigger("select-adapter");
     }