summaryrefslogtreecommitdiffstats
path: root/model/src/main/java
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2021-07-07 14:21:34 -0400
committerRam Krishna Verma <ram_krishna.verma@bell.ca>2021-07-07 14:57:57 -0400
commit9eba753aed9d5575fa24ab8806e4d614668c75cb (patch)
tree181eb2b234fc01a14629e882d4356cf351405f38 /model/src/main/java
parent49d86a99c3ed1920e3d999d85b7ae95a61b8d23a (diff)
Use lombok in policy/distribution
Use lombok for getter, setter, constructor & builder functions. Remove unused classes. Remove duplicate classes for testing exceptions. Issue-ID: POLICY-3393 Change-Id: I8a565bc6a5699b8716982f84e03b6a11d08ce65b Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'model/src/main/java')
-rw-r--r--model/src/main/java/org/onap/policy/distribution/model/Csar.java20
-rw-r--r--model/src/main/java/org/onap/policy/distribution/model/OptimizationPolicy.java71
-rw-r--r--model/src/main/java/org/onap/policy/distribution/model/PolicyAsString.java44
-rw-r--r--model/src/main/java/org/onap/policy/distribution/model/Tosca.java26
4 files changed, 21 insertions, 140 deletions
diff --git a/model/src/main/java/org/onap/policy/distribution/model/Csar.java b/model/src/main/java/org/onap/policy/distribution/model/Csar.java
index df7eaf28..652d84cb 100644
--- a/model/src/main/java/org/onap/policy/distribution/model/Csar.java
+++ b/model/src/main/java/org/onap/policy/distribution/model/Csar.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,24 +21,15 @@
package org.onap.policy.distribution.model;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
/**
* Represents a CSAR file that a {@link Policy} can be decoded from.
*/
+@Getter
+@AllArgsConstructor
public class Csar implements PolicyInput {
private String csarFilePath;
-
- public Csar(final String csarFilePath) {
- this.csarFilePath = csarFilePath;
- }
-
- /**
- * Get the path to the CSAR file.
- *
- * @return the path of the CSAR file
- */
- public String getCsarPath() {
- return csarFilePath;
- }
-
}
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
deleted file mode 100644
index d39c8dd9..00000000
--- a/model/src/main/java/org/onap/policy/distribution/model/OptimizationPolicy.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-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.
- */
-@Getter
-@Setter
-@ToString
-@EqualsAndHashCode(callSuper = true)
-public class OptimizationPolicy extends ToscaEntity {
-
- private static final String OPTIMIZATION = "Optimization";
- private String policyName;
- private String policyDescription;
- private String onapName;
- private String configBody;
- private String configBodyType;
- private Date timetolive;
- private String guard;
- private String riskLevel;
- private String riskType;
-
- @Override
- public String getName() {
- return policyName;
- }
-
- @Override
- public void setName(final String name) {
- this.policyName = name;
- }
-
- @Override
- public String getVersion() {
- // Utilizing this method to return the policy type instead of version for the old model.
- return OPTIMIZATION;
- }
-
- @Override
- public void setVersion(final String version) {
- throw new NotImplementedException("Not supported");
- }
-}
diff --git a/model/src/main/java/org/onap/policy/distribution/model/PolicyAsString.java b/model/src/main/java/org/onap/policy/distribution/model/PolicyAsString.java
index 1600d8f7..22dd8f57 100644
--- a/model/src/main/java/org/onap/policy/distribution/model/PolicyAsString.java
+++ b/model/src/main/java/org/onap/policy/distribution/model/PolicyAsString.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,51 +21,18 @@
package org.onap.policy.distribution.model;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
/**
* This class represents a policy which can be decoded by a relevant {@link PolicyDecoder}.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
+@Getter
+@AllArgsConstructor
public class PolicyAsString implements Policy {
private String policyName;
private String policyType;
private String policy;
-
- /**
- * Constructor for creating instance of {@link PolicyAsString}.
- *
- * @param policyName the policy file name
- * @param policyType the policy type
- * @param policy the policy
- */
- public PolicyAsString(final String policyName, final String policyType, final String policy) {
- this.policyName = policyName;
- this.policyType = policyType;
- this.policy = policy;
- }
-
- /**
- * Returns the policy of this {@link PolicyAsString} instance.
- *
- * @return the policy
- */
- public String getPolicy() {
- return policy;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getPolicyName() {
- return policyName;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public String getPolicyType() {
- return policyType;
- }
}
diff --git a/model/src/main/java/org/onap/policy/distribution/model/Tosca.java b/model/src/main/java/org/onap/policy/distribution/model/Tosca.java
index b7b14c4f..a1996b77 100644
--- a/model/src/main/java/org/onap/policy/distribution/model/Tosca.java
+++ b/model/src/main/java/org/onap/policy/distribution/model/Tosca.java
@@ -1,43 +1,35 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.policy.distribution.model;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
/**
* Represents a TOSCA file that a {@link Policy} can be decoded from.
*/
+@Getter
+@AllArgsConstructor
public class Tosca implements PolicyInput {
private String toscaFilePath;
-
- public Tosca(String toscaFilePath) {
- this.toscaFilePath = toscaFilePath;
- }
-
- /**
- * Get the path to the TOSCA file.
- *
- * @return the path of the TOSCA file
- */
- String getToscaFilePath() {
- return toscaFilePath;
- }
-
}