streampipes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zehn...@apache.org
Subject [incubator-streampipes] 10/25: Add example for static property alternatives
Date Tue, 17 Dec 2019 09:48:11 GMT
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

commit f66413fa09781c5faa88beb5869e58945ad8e606
Author: Dominik Riemer <riemer@fzi.de>
AuthorDate: Wed Jul 17 08:12:51 2019 +0200

    Add example for static property alternatives
---
 .../StaticPropertyAlternativesController.java              | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/streampipes-pipeline-elements-examples-processors-jvm/src/main/java/org/streampipes/pe/examples/jvm/staticproperty/StaticPropertyAlternativesController.java
b/streampipes-pipeline-elements-examples-processors-jvm/src/main/java/org/streampipes/pe/examples/jvm/staticproperty/StaticPropertyAlternativesController.java
index 24b45c9..44419ab 100644
--- a/streampipes-pipeline-elements-examples-processors-jvm/src/main/java/org/streampipes/pe/examples/jvm/staticproperty/StaticPropertyAlternativesController.java
+++ b/streampipes-pipeline-elements-examples-processors-jvm/src/main/java/org/streampipes/pe/examples/jvm/staticproperty/StaticPropertyAlternativesController.java
@@ -26,6 +26,7 @@ import org.streampipes.sdk.extractor.ProcessingElementParameterExtractor;
 import org.streampipes.sdk.helpers.Alternatives;
 import org.streampipes.sdk.helpers.EpRequirements;
 import org.streampipes.sdk.helpers.Labels;
+import org.streampipes.sdk.helpers.Options;
 import org.streampipes.sdk.helpers.OutputStrategies;
 import org.streampipes.sdk.helpers.SupportedFormats;
 import org.streampipes.sdk.helpers.SupportedProtocols;
@@ -56,15 +57,22 @@ public class StaticPropertyAlternativesController extends
                             StaticProperties.integerFreeTextProperty(Labels.from("count-window-size",
                                     "Count Window Size", ""))),
                     Alternatives.from(Labels.from("time", "Time Window", ""),
-                            StaticProperties.integerFreeTextProperty(Labels.from("time" +
-                                    "-window-size", "Time Window Size", ""))))
+                            StaticProperties.group(Labels.from("group", "", ""),
+                                    StaticProperties.integerFreeTextProperty(Labels.from("time"
+
+                                            "-window-size", "Time Window Size", "")),
+                                    StaticProperties.singleValueSelection(Labels.from("time"
+
+                                            "-window-unit", "Time Unit", ""),
+                                            Options.from("Seconds", "Minutes", "Hours")))))
             .build();
   }
 
   @Override
   public ConfiguredEventProcessor<DummyParameters> onInvocation(DataProcessorInvocation
graph, ProcessingElementParameterExtractor extractor) {
 
-System.out.println("incov");
+    String selectedAlternative = extractor.selectedAlternativeInternalId("window");
+    if (selectedAlternative.equals("time")) {
+      Integer timeWindowSize = extractor.singleValueParameter("time-window-size", Integer.class);
+    }
 
     return new ConfiguredEventProcessor<>(new DummyParameters(graph), DummyEngine::new);
   }


Mime
View raw message