From 53d14240b684df3d4f2fa8f02355effba722e514 Mon Sep 17 00:00:00 2001 From: ramverma Date: Wed, 4 Sep 2019 09:26:53 +0000 Subject: 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 --- .../distribution/model/OptimizationPolicy.java | 95 ++++++---------------- 1 file changed, 23 insertions(+), 72 deletions(-) (limited to 'model/src/main/java') 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"); } } -- cgit 1.2.3-korg