bossenti commented on a change in pull request #38: URL: https://github.com/apache/incubator-streampipes-extensions/pull/38#discussion_r603509935
########## File path: streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/logical/BooleanOperatorProcessor.java ########## @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +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.model.schema.PropertyScope; +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.Options; +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_OUT_KEY = "boolean-operations-result"; + private static final String BOOLEAN_OPERATOR_TYPE = "operator"; + private static final String PROPERTIES_LIST = "properties"; + 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() + .requiredPropertyWithUnaryMapping(EpRequirements.booleanReq(), + Labels.withId(PROPERTIES_LIST), PropertyScope.NONE) + .build()) + .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())) + .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 { + List<String> properties = processorParams.extractor().getUnaryMappingsFromCollection(PROPERTIES_LIST); Review comment: ```suggestion List<String> properties = processorParams.extractor().mappingPropertyValues((PROPERTIES_LIST); ``` due to change in `declareModel` ########## File path: streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/logical/BooleanOperatorProcessor.java ########## @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +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.model.schema.PropertyScope; +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.Options; +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_OUT_KEY = "boolean-operations-result"; + private static final String BOOLEAN_OPERATOR_TYPE = "operator"; + private static final String PROPERTIES_LIST = "properties"; + 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() + .requiredPropertyWithUnaryMapping(EpRequirements.booleanReq(), Review comment: ```suggestion .requiredPropertyWithNaryMapping(EpRequirements.booleanReq(), ``` `requiredPropertyWithNaryMapping` allows the user to select multiple values (the other is just a single select) ########## File path: streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/logical/BooleanOperatorProcessor.java ########## @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +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.model.schema.PropertyScope; +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.Options; +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_OUT_KEY = "boolean-operations-result"; + private static final String BOOLEAN_OPERATOR_TYPE = "operator"; + private static final String PROPERTIES_LIST = "properties"; + private BooleanOperationInputConfigs configs; + + @Override + public DataProcessorDescription declareModel() { + return ProcessingElementBuilder.create("org.apache.streampipes.processors.transformation.jvm.processor.booloperator.logical") Review comment: ```suggestion return ProcessingElementBuilder.create("org.apache.streampipes.processors.transformation.jvm.booloperator.logical") ``` has to be equal to the id at the top of `strings.en` ########## File path: streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/logical/BooleanOperatorProcessor.java ########## @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +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.model.schema.PropertyScope; +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.Options; +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_OUT_KEY = "boolean-operations-result"; + private static final String BOOLEAN_OPERATOR_TYPE = "operator"; + private static final String PROPERTIES_LIST = "properties"; Review comment: values have to equal the names in the `strings.en` file -- 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]
