You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/05/09 09:31:45 UTC

[incubator-streampipes] branch dev updated: Extend SDK for STREAMPIPES-118

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

zehnder 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 7fb8238  Extend SDK for STREAMPIPES-118
7fb8238 is described below

commit 7fb82387cf5f67adb174d6629007806d80e4e4c5
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Sat May 9 11:31:03 2020 +0200

    Extend SDK for STREAMPIPES-118
---
 .../container/locales/LabelGenerator.java           | 14 +++++++++++---
 .../apache/streampipes/sdk/StaticProperties.java    | 21 ++++++++-------------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/streampipes-container/src/main/java/org/apache/streampipes/container/locales/LabelGenerator.java b/streampipes-container/src/main/java/org/apache/streampipes/container/locales/LabelGenerator.java
index 54913cf..69e76fe 100644
--- a/streampipes-container/src/main/java/org/apache/streampipes/container/locales/LabelGenerator.java
+++ b/streampipes-container/src/main/java/org/apache/streampipes/container/locales/LabelGenerator.java
@@ -96,9 +96,17 @@ public class LabelGenerator {
     sp.setLabel(getTitle(props, sp.getInternalName()));
     sp.setDescription(getDescription(props, sp.getInternalName()));
     if (sp instanceof CollectionStaticProperty) {
-      ((CollectionStaticProperty) sp).getMembers().forEach(a -> {
-        generateLabels(props, a);
-      });
+
+      if  (((CollectionStaticProperty) sp).getMembers() != null) {
+        ((CollectionStaticProperty) sp).getMembers().forEach(a -> {
+          generateLabels(props, a);
+        });
+      } else {
+        ((StaticPropertyGroup) ((CollectionStaticProperty) sp).getStaticPropertyTemplate()).getStaticProperties().forEach(a -> {
+          generateLabels(props, a);
+        });
+      }
+
     } else if (sp instanceof StaticPropertyGroup) {
       ((StaticPropertyGroup) sp).getStaticProperties().forEach(g -> {
         g.setLabel(getTitle(props, g.getInternalName()));
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java
index 73dddbf..762f923 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/StaticProperties.java
@@ -18,19 +18,7 @@
 
 package org.apache.streampipes.sdk;
 
-import org.apache.streampipes.model.staticproperty.FreeTextStaticProperty;
-import org.apache.streampipes.model.staticproperty.OneOfStaticProperty;
-import org.apache.streampipes.model.staticproperty.Option;
-import org.apache.streampipes.model.staticproperty.PropertyValueSpecification;
-import org.apache.streampipes.model.staticproperty.RuntimeResolvableAnyStaticProperty;
-import org.apache.streampipes.model.staticproperty.RuntimeResolvableOneOfStaticProperty;
-import org.apache.streampipes.model.staticproperty.SecretStaticProperty;
-import org.apache.streampipes.model.staticproperty.StaticProperty;
-import org.apache.streampipes.model.staticproperty.StaticPropertyGroup;
-import org.apache.streampipes.model.staticproperty.SupportedProperty;
-import org.apache.streampipes.model.staticproperty.CollectionStaticProperty;
-import org.apache.streampipes.model.staticproperty.SelectionStaticProperty;
-import org.apache.streampipes.model.staticproperty.StaticPropertyAlternatives;
+import org.apache.streampipes.model.staticproperty.*;
 import org.apache.streampipes.sdk.helpers.Label;
 import org.apache.streampipes.sdk.utils.Datatypes;
 
@@ -59,6 +47,13 @@ public class StaticProperties {
     return fsp;
   }
 
+  public static FileStaticProperty fileProperty(Label label) {
+    FileStaticProperty fp = new FileStaticProperty(label.getInternalId(), label.getLabel(), label
+            .getDescription());
+
+    return fp;
+  }
+
   public static RuntimeResolvableOneOfStaticProperty singleValueSelectionFromContainer(Label label) {
     return new RuntimeResolvableOneOfStaticProperty(label.getInternalId(), label
             .getLabel(), label.getDescription());