Skip to content

Commit

Permalink
Extract transformation rule priorities to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikriemer committed Oct 4, 2023
1 parent 294fef4 commit 6a111f7
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.model.connect.rules;

public enum TransformationRulePriority {

ADD_TIMESTAMP(100),
ADD_VALUE(110),

RENAME(210),
MOVE(220),
CREATE_NESTED(230),
DELETE(240),

CHANGE_UNIT(310),
TIMESTAMP_TRANSFORMATION(320),
CORRECTION_VALUE(330),
CHANGE_DATATYPE(340),

REMOVE_DUPLICATES(410),
EVENT_RATE(420);

private final int code;

TransformationRulePriority(int code) {
this.code = code;
}

public int getCode() {
return this.code;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.schema;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class CreateNestedRuleDescription extends SchemaTransformationRuleDescription {

Expand Down Expand Up @@ -53,6 +54,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 230;
return TransformationRulePriority.CREATE_NESTED.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.schema;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class DeleteRuleDescription extends SchemaTransformationRuleDescription {

Expand Down Expand Up @@ -54,6 +55,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 240;
return TransformationRulePriority.DELETE.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.schema;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class MoveRuleDescription extends SchemaTransformationRuleDescription {

Expand Down Expand Up @@ -65,7 +66,7 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 220;
return TransformationRulePriority.MOVE.getCode();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.schema;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class RenameRuleDescription extends SchemaTransformationRuleDescription {

Expand Down Expand Up @@ -65,6 +66,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 210;
return TransformationRulePriority.RENAME.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.stream;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class EventRateTransformationRuleDescription extends StreamTransformationRuleDescription {

Expand Down Expand Up @@ -61,6 +62,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 420;
return TransformationRulePriority.EVENT_RATE.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.stream;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class RemoveDuplicatesTransformationRuleDescription extends StreamTransformationRuleDescription {

Expand Down Expand Up @@ -48,6 +49,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 410;
return TransformationRulePriority.REMOVE_DUPLICATES.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.value;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class AddTimestampRuleDescription extends ValueTransformationRuleDescription {

Expand Down Expand Up @@ -52,6 +53,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 100;
return TransformationRulePriority.ADD_TIMESTAMP.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.value;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class AddValueTransformationRuleDescription extends ValueTransformationRuleDescription {

Expand Down Expand Up @@ -59,6 +60,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 110;
return TransformationRulePriority.ADD_VALUE.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.value;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class ChangeDatatypeTransformationRuleDescription extends ValueTransformationRuleDescription {

Expand Down Expand Up @@ -67,6 +68,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 340;
return TransformationRulePriority.CHANGE_DATATYPE.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.value;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class CorrectionValueTransformationRuleDescription extends ValueTransformationRuleDescription {

Expand Down Expand Up @@ -76,6 +77,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 330;
return TransformationRulePriority.CORRECTION_VALUE.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.value;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class TimestampTranfsformationRuleDescription extends ValueTransformationRuleDescription {

Expand Down Expand Up @@ -89,6 +90,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 320;
return TransformationRulePriority.TIMESTAMP_TRANSFORMATION.getCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.streampipes.model.connect.rules.value;

import org.apache.streampipes.model.connect.rules.ITransformationRuleVisitor;
import org.apache.streampipes.model.connect.rules.TransformationRulePriority;

public class UnitTransformRuleDescription extends ValueTransformationRuleDescription {

Expand Down Expand Up @@ -77,6 +78,6 @@ public void accept(ITransformationRuleVisitor visitor) {

@Override
public int getRulePriority() {
return 310;
return TransformationRulePriority.CHANGE_UNIT.getCode();
}
}

0 comments on commit 6a111f7

Please sign in to comment.