aboutsummaryrefslogtreecommitdiffstats
path: root/common/onap-tosca-datatype/src/main
diff options
context:
space:
mode:
authorshiria <shiri.amichai@amdocs.com>2018-10-10 15:16:15 +0300
committerOren Kleks <orenkle@amdocs.com>2018-10-15 09:43:40 +0000
commit1f50c72eb501af42c61c4ddbb011302a6290afdb (patch)
treebea97a3203f3560ab5bbd2a38fcb7316ec3e259d /common/onap-tosca-datatype/src/main
parentb54343dc3868300178017e60e4cd2c26dc08ff24 (diff)
Fix Policy type and Policy definition
Fix policy according to TOSCA spec Change-Id: I4e3da732666dd52895c4458f0cbd16c6ca47c1cd Issue-ID: SDC-1782 Signed-off-by: shiria <shiri.amichai@amdocs.com>
Diffstat (limited to 'common/onap-tosca-datatype/src/main')
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java30
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java55
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java77
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java189
4 files changed, 148 insertions, 203 deletions
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
new file mode 100644
index 0000000000..a394401112
--- /dev/null
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+
+package org.onap.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+import lombok.Data;
+
+@Data
+public class Condition {
+
+ private Map<String,Constraint> constraint;
+ private String period;
+ private Integer evaluations;
+ private String method;
+
+}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java
index e1c2fb468c..a9a45c4a3f 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,51 +22,16 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.List;
import java.util.Map;
+import lombok.Data;
+@Data
public class PolicyDefinition implements Template {
- private String type;
- private String description;
- private Map<String, String> metadata;
- private Map<String, Object> properties;
- private List<String> targets;
- public String getType() {
- return type;
- }
+ private String type;
+ private String description;
+ private Map<String, String> metadata;
+ private Map<String, Object> properties;
+ private List<String> targets;
+ private Map<String, Trigger> triggers;
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
- public List<String> getTargets() {
- return targets;
- }
-
- public void setTargets(List<String> targets) {
- this.targets = targets;
- }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java
index 54d52cceec..cd7da8614c 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,73 +22,18 @@ package org.onap.sdc.tosca.datatypes.model;
import java.util.List;
import java.util.Map;
+import lombok.Data;
-
+@Data
public class PolicyType {
- private String derived_from;
- private String version;
- private Map<String, String> metadata;
- private String description;
- private Map<String, PropertyDefinition> properties;
- private List<String> targets;
- private List<Trigger> triggers;
-
- public String getDerived_from() {
- return derived_from;
- }
-
- public void setDerived_from(String derived_from) {
- this.derived_from = derived_from;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public List<String> getTargets() {
- return targets;
- }
-
- public void setTargets(List<String> targets) {
- this.targets = targets;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public List<Trigger> getTriggers() {
- return triggers;
- }
+ private String derived_from;
+ private String version;
+ private Map<String, String> metadata;
+ private String description;
+ private Map<String, PropertyDefinition> properties;
+ private List<String> targets;
+ private Map<String, Trigger> triggers;
- public void setTriggers(
- List<Trigger> triggers) {
- this.triggers = triggers;
- }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
index 92f3b30183..f5a2f66e9d 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
@@ -2,96 +2,101 @@ package org.onap.sdc.tosca.datatypes.model;
public class Trigger {
- private String description;
- private String event_type;
- private TimeInterval schedule;
- private EventFilter target_filter;
- private Constraint condition;
- private Constraint constraint;
- private String period;
- private int evaluations;
- private String method;
- //action - String or operation?
- private Object action;
-
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getEvent_type() {
- return event_type;
- }
-
- public void setEvent_type(String event_type) {
- this.event_type = event_type;
- }
-
- public TimeInterval getSchedule() {
- return schedule;
- }
-
- public void setSchedule(TimeInterval schedule) {
- this.schedule = schedule;
- }
-
- public EventFilter getTarget_filter() {
- return target_filter;
- }
-
- public void setTarget_filter(EventFilter target_filter) {
- this.target_filter = target_filter;
- }
-
- public Constraint getCondition() {
- return condition;
- }
-
- public void setCondition(Constraint condition) {
- this.condition = condition;
- }
-
- public Constraint getConstraint() {
- return constraint;
- }
-
- public void setConstraint(Constraint constraint) {
- this.constraint = constraint;
- }
-
- public String getPeriod() {
- return period;
- }
-
- public void setPeriod(String period) {
- this.period = period;
- }
-
- public int getEvaluations() {
- return evaluations;
- }
-
- public void setEvaluations(int evaluations) {
- this.evaluations = evaluations;
- }
-
- public String getMethod() {
- return method;
- }
-
- public void setMethod(String method) {
- this.method = method;
- }
-
- public Object getAction() {
- return action;
- }
-
- public void setAction(Object action) {
- this.action = action;
- }
+ private String description;
+ private String event_type;
+ private TimeInterval schedule;
+ private EventFilter target_filter;
+ private Condition condition;
+ private Object action;
+
+ @Override
+ public int hashCode() {
+ int result = getDescription() != null ? getDescription().hashCode() : 0;
+ result = 31 * result + getEvent_type().hashCode();
+ result = 31 * result + (getSchedule() != null ? getSchedule().hashCode() : 0);
+ result = 31 * result + (getTarget_filter() != null ? getTarget_filter().hashCode() : 0);
+ result = 31 * result + (getCondition() != null ? getCondition().hashCode() : 0);
+ result = 31 * result + getAction().hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof Trigger)) {
+ return false;
+ }
+
+ Trigger trigger = (Trigger) o;
+
+ if (getDescription() != null ? !getDescription().equals(trigger.getDescription()) :
+ trigger.getDescription() != null) {
+ return false;
+ }
+ if (!getEvent_type().equals(trigger.getEvent_type())) {
+ return false;
+ }
+ if (getSchedule() != null ? !getSchedule().equals(trigger.getSchedule()) : trigger.getSchedule() != null) {
+ return false;
+ }
+ if (getTarget_filter() != null ? !getTarget_filter().equals(trigger.getTarget_filter()) :
+ trigger.getTarget_filter() != null) {
+ return false;
+ }
+ if (getCondition() != null ? !getCondition().equals(trigger.getCondition()) : trigger.getCondition() != null) {
+ return false;
+ }
+ return getAction().equals(trigger.getAction());
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEvent_type() {
+ return event_type;
+ }
+
+ public void setEvent_type(String eventType) {
+ this.event_type = eventType;
+ }
+
+ public TimeInterval getSchedule() {
+ return schedule;
+ }
+
+ public void setSchedule(TimeInterval schedule) {
+ this.schedule = schedule;
+ }
+
+ public EventFilter getTarget_filter() {
+ return target_filter;
+ }
+
+ public void setTarget_filter(EventFilter targetFilter) {
+ this.target_filter = targetFilter;
+ }
+
+ public Condition getCondition() {
+ return condition;
+ }
+
+ public void setCondition(Condition condition) {
+ this.condition = condition;
+ }
+
+ public Object getAction() {
+
+ return action;
+ }
+
+ public void setAction(Object action) {
+ this.action = action;
+ }
}