sndp2693 commented on a change in pull request #38:
URL:
https://github.com/apache/incubator-streampipes-extensions/pull/38#discussion_r603081999
##########
File path:
streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/logical/BooleanOperatorProcessor.java
##########
@@ -0,0 +1,99 @@
+package
org.apache.streampipes.processors.transformation.jvm.processor.booloperator.logical;
+
+import org.apache.streampipes.commons.exceptions.SpRuntimeException;
+import org.apache.streampipes.model.DataProcessorType;
+import org.apache.streampipes.model.graph.DataProcessorDescription;
+import org.apache.streampipes.model.runtime.Event;
+import
org.apache.streampipes.processors.transformation.jvm.processor.booloperator.logical.enums.BooleanOperatorType;
+import
org.apache.streampipes.processors.transformation.jvm.processor.booloperator.logical.operations.IBoolOperation;
+import
org.apache.streampipes.processors.transformation.jvm.processor.booloperator.logical.operations.factory.BoolOperationFactory;
+import org.apache.streampipes.sdk.builder.PrimitivePropertyBuilder;
+import org.apache.streampipes.sdk.builder.ProcessingElementBuilder;
+import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder;
+import org.apache.streampipes.sdk.helpers.EpRequirements;
+import org.apache.streampipes.sdk.helpers.Labels;
+import org.apache.streampipes.sdk.helpers.Locales;
+import org.apache.streampipes.sdk.helpers.OutputStrategies;
+import org.apache.streampipes.sdk.utils.Assets;
+import org.apache.streampipes.sdk.utils.Datatypes;
+import org.apache.streampipes.wrapper.context.EventProcessorRuntimeContext;
+import org.apache.streampipes.wrapper.routing.SpOutputCollector;
+import org.apache.streampipes.wrapper.standalone.ProcessorParams;
+import org.apache.streampipes.wrapper.standalone.StreamPipesDataProcessor;
+
+import java.util.List;
+
+import static
org.apache.streampipes.processors.transformation.jvm.processor.booloperator.logical.enums.BooleanOperatorType.NOT;
+
+public class BooleanOperatorProcessor extends StreamPipesDataProcessor {
+
+ private static final String BOOLEAN_PROCESSOR_INPUT_KEY =
"boolean-processor-configs";
+ private static final String BOOLEAN_PROCESSOR_OUT_KEY =
"boolean-operations-result";
+ private BooleanOperationInputConfigs configs;
+
+ @Override
+ public DataProcessorDescription declareModel() {
+ return
ProcessingElementBuilder.create("org.apache.streampipes.processors.transformation.jvm.processor.booloperator.logical")
+ .withAssets(Assets.DOCUMENTATION, Assets.ICON)
+ .withLocales(Locales.EN)
+ .category(DataProcessorType.ENRICH)
+ .requiredStream(
+ StreamRequirementsBuilder
+ .create()
+ .requiredProperty(EpRequirements.anyProperty())
+ .build())
+
.requiredTextParameter(Labels.withId(BOOLEAN_PROCESSOR_INPUT_KEY))
+ .outputStrategy(OutputStrategies.append(
+ PrimitivePropertyBuilder.create(
+ Datatypes.String, BOOLEAN_PROCESSOR_OUT_KEY)
+ .build()))
+ .build();
+ }
+
+ @Override
+ public void onInvocation(ProcessorParams processorParams,
SpOutputCollector spOutputCollector, EventProcessorRuntimeContext
eventProcessorRuntimeContext) throws SpRuntimeException {
+ BooleanOperationInputConfigs configs =
processorParams.extractor().singleValueParameter(BOOLEAN_PROCESSOR_INPUT_KEY,
BooleanOperationInputConfigs.class);
Review comment:
Thank you for pointing out. I'll add
taticProperties.singleValueSelection for operator type in manner
.requiredSingleValueSelection(Labels.withId(BOOLEAN_OPERATOR_TYPE),
Options.from(
BooleanOperatorType.AND.operator(),
BooleanOperatorType.OR.operator(),
BooleanOperatorType.NOT.operator(),
BooleanOperatorType.XOR.operator(),
BooleanOperatorType.X_NOR.operator(),
BooleanOperatorType.NOR.operator()))
For properties the intention is to let user select/pass them. However i am
not sure what should be the Options that we need provide.
Is there as way we can allow user to pass set of properties on which we'll
perform bool operation?
We have requiredMultiValueSelection(), but again i don't know the set of
properties which needs to be mentioned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]