summaryrefslogtreecommitdiffstats
path: root/dcae-analytics-model/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'dcae-analytics-model/src/main')
-rw-r--r--dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Direction.java24
-rw-r--r--dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Threshold.java4
-rw-r--r--dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/ThresholdMixin.java8
3 files changed, 21 insertions, 15 deletions
diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Direction.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Direction.java
index 76c8086..0d7203b 100644
--- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Direction.java
+++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Direction.java
@@ -20,6 +20,8 @@
package org.openecomp.dcae.apod.analytics.model.domain.policy.tca;
+import java.math.BigDecimal;
+
import javax.annotation.Nonnull;
/**
@@ -32,32 +34,32 @@ public enum Direction implements TCAPolicyModel {
EQUAL {
@Override
- public Boolean operate(@Nonnull Long value1, @Nonnull Long value2) {
- return value1.equals(value2);
+ public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
+ return value1.compareTo(value2) == 0;
}
},
LESS {
@Override
- public Boolean operate(@Nonnull Long value1, @Nonnull Long value2) {
- return value1 < value2;
+ public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
+ return value1.compareTo(value2) < 0;
}
},
LESS_OR_EQUAL {
@Override
- public Boolean operate(@Nonnull Long value1, @Nonnull Long value2) {
- return value1 <= value2;
+ public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
+ return value1.compareTo(value2) <= 0;
}
},
GREATER {
@Override
- public Boolean operate(@Nonnull Long value1, @Nonnull Long value2) {
- return value1 > value2;
+ public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
+ return value1.compareTo(value2) > 0;
}
},
GREATER_OR_EQUAL {
@Override
- public Boolean operate(@Nonnull Long value1, @Nonnull Long value2) {
- return value1 >= value2;
+ public Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2) {
+ return value1.compareTo(value2) >= 0;
}
};
@@ -69,6 +71,6 @@ public enum Direction implements TCAPolicyModel {
*
* @return result of operation for the direction logic
*/
- public abstract Boolean operate(@Nonnull Long value1, @Nonnull Long value2);
+ public abstract Boolean operate(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2);
}
diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Threshold.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Threshold.java
index 0d6193d..4f98fa5 100644
--- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Threshold.java
+++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/policy/tca/Threshold.java
@@ -24,6 +24,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.openecomp.dcae.apod.analytics.model.domain.cef.EventSeverity;
+import java.math.BigDecimal;
+
/**
*
* @author Rajiv Singla . Creation Date: 11/5/2016.
@@ -100,7 +102,7 @@ public class Threshold extends BaseTCAPolicyModel {
* @param actualFieldValue new value for actual Field value that caused the violation
* @return actual field value that caused the violation
*/
- private Long actualFieldValue;
+ private BigDecimal actualFieldValue;
/**
* Creates a deep copy of give {@link Threshold}
diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/ThresholdMixin.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/ThresholdMixin.java
index 02d4b83..27344f8 100644
--- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/ThresholdMixin.java
+++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/ThresholdMixin.java
@@ -23,6 +23,8 @@ package org.openecomp.dcae.apod.analytics.model.util.json.mixin.policy.tca;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigDecimal;
+
/**
*
* @author Rajiv Singla . Creation Date: 11/5/2016.
@@ -30,15 +32,15 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public abstract class ThresholdMixin extends BaseTCAPolicyModelMixin {
@JsonIgnore
- private Long actualFieldValue;
+ private BigDecimal actualFieldValue;
@JsonIgnore
- public Long getActualFieldValue() {
+ public BigDecimal getActualFieldValue() {
return actualFieldValue;
}
@JsonProperty
- public void setActualFieldValue(Long actualFieldValue) {
+ public void setActualFieldValue(BigDecimal actualFieldValue) {
this.actualFieldValue = actualFieldValue;
}
}