summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@est.tech>2019-09-04 09:26:53 +0000
committerramverma <ram.krishna.verma@est.tech>2019-09-04 09:26:53 +0000
commit53d14240b684df3d4f2fa8f02355effba722e514 (patch)
tree2e6a5cd13f27a1fca909ede4060a537c4dc8d362 /model
parenta790e5194cd246b286265589ed598270dd5c96fe (diff)
Bring back the old HPA decoder & model
Bringing back the old HPA policy decoder and its related classes and tests. The distribution framework will support both the new PAP/API and the old policy engine in El Alto release. Issue-ID: POLICY-1871 Change-Id: Iab911b793207a09b02e906ed6913c54bc252f64c Signed-off-by: ramverma <ram.krishna.verma@est.tech>
Diffstat (limited to 'model')
-rw-r--r--model/pom.xml5
-rw-r--r--model/src/main/java/org/onap/policy/distribution/model/OptimizationPolicy.java95
2 files changed, 28 insertions, 72 deletions
diff --git a/model/pom.xml b/model/pom.xml
index 9cd53650..9e7e9f63 100644
--- a/model/pom.xml
+++ b/model/pom.xml
@@ -35,5 +35,10 @@
<artifactId>utils</artifactId>
<version>${policy.common.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.models</groupId>
+ <artifactId>policy-models-tosca</artifactId>
+ <version>${policy.models.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/model/src/main/java/org/onap/policy/distribution/model/OptimizationPolicy.java b/model/src/main/java/org/onap/policy/distribution/model/OptimizationPolicy.java
index 2ca3c945..9a889eed 100644
--- a/model/src/main/java/org/onap/policy/distribution/model/OptimizationPolicy.java
+++ b/model/src/main/java/org/onap/policy/distribution/model/OptimizationPolicy.java
@@ -22,10 +22,22 @@ package org.onap.policy.distribution.model;
import java.util.Date;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import org.apache.commons.lang3.NotImplementedException;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
+
/**
* An optimization policy.
*/
-public class OptimizationPolicy implements Policy {
+@Getter
+@Setter
+@ToString
+@EqualsAndHashCode(callSuper = true)
+public class OptimizationPolicy extends ToscaEntity {
private static final String OPTIMIZATION = "Optimization";
private String policyName;
@@ -39,84 +51,23 @@ public class OptimizationPolicy implements Policy {
private String riskType;
@Override
- public String getPolicyName() {
+ public String getName() {
return policyName;
}
@Override
- public String getPolicyType() {
- return OPTIMIZATION;
- }
-
- public void setPolicyName(final String policyName) {
- this.policyName = policyName;
- }
-
- public String getPolicyDescription() {
- return policyDescription;
- }
-
- public void setPolicyDescription(final String policyDescription) {
- this.policyDescription = policyDescription;
- }
-
- public String getPolicyConfigType() {
- return getPolicyType();
- }
-
- public String getOnapName() {
- return onapName;
- }
-
- public void setOnapName(final String onapName) {
- this.onapName = onapName;
- }
-
- public String getConfigBody() {
- return configBody;
- }
-
- public void setConfigBody(final String configBody) {
- this.configBody = configBody;
+ public void setName(final String name) {
+ this.policyName = name;
}
- public String getConfigBodyType() {
- return configBodyType;
- }
-
- public void setConfigBodyType(final String configBodyType) {
- this.configBodyType = configBodyType;
- }
-
- public Date getTimetolive() {
- return timetolive;
- }
-
- public void setTimetolive(final Date timetolive) {
- this.timetolive = timetolive;
- }
-
- public String getGuard() {
- return guard;
- }
-
- public void setGuard(final String guard) {
- this.guard = guard;
- }
-
- public String getRiskLevel() {
- return riskLevel;
- }
-
- public void setRiskLevel(final String riskLevel) {
- this.riskLevel = riskLevel;
- }
-
- public String getRiskType() {
- return riskType;
+ @Override
+ public String getVersion() {
+ // Utilizing this method to return the policy type instead of version for the old model.
+ return OPTIMIZATION;
}
- public void setRiskType(final String riskType) {
- this.riskType = riskType;
+ @Override
+ public void setVersion(final String version) {
+ throw new NotImplementedException("Not supported");
}
}