X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-tosca%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Ftosca%2Fsimple%2Fconcepts%2FJpaToscaTrigger.java;h=417e83fe0200e5b6f8e5f297e1aa81666ce3c040;hb=3f48197acf151c5f2b2b8b4e7bd366c2371619a0;hp=0a32701c9c13d2fbd4acfeb495fa1ab0109208c5;hpb=cc5b96bfd33cd7d91fe6994d348e8d6a0ebb54fa;p=policy%2Fmodels.git diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java index 0a32701c9..417e83fe0 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java @@ -24,23 +24,18 @@ package org.onap.policy.models.tosca.simple.concepts; import com.google.gson.annotations.SerializedName; - import java.time.Duration; import java.util.List; - import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.Table; - import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; - import org.apache.commons.lang3.ObjectUtils; -import org.onap.policy.common.utils.validation.Assertions; import org.onap.policy.common.utils.validation.ParameterValidationUtils; import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.base.PfKey; @@ -137,6 +132,18 @@ public class JpaToscaTrigger extends PfConcept { */ public JpaToscaTrigger(final JpaToscaTrigger copyConcept) { super(copyConcept); + this.key = new PfReferenceKey(copyConcept.key); + this.description = copyConcept.description; + this.eventType = copyConcept.eventType; + this.schedule = (copyConcept.schedule != null ? new JpaToscaTimeInterval(copyConcept.schedule) : null); + this.targetFilter = + (copyConcept.targetFilter != null ? new JpaToscaEventFilter(copyConcept.targetFilter) : null); + this.condition = copyConcept.condition; + this.constraint = copyConcept.constraint; + this.period = copyConcept.period; + this.evaluations = copyConcept.evaluations; + this.method = copyConcept.method; + this.action = copyConcept.action; } @Override @@ -148,12 +155,6 @@ public class JpaToscaTrigger extends PfConcept { if (targetFilter != null) { keyList.addAll(targetFilter.getKeys()); } - if (condition != null) { - keyList.addAll(condition.getKeys()); - } - if (constraint != null) { - keyList.addAll(constraint.getKeys()); - } return keyList; } @@ -170,12 +171,6 @@ public class JpaToscaTrigger extends PfConcept { if (targetFilter != null) { targetFilter.clean(); } - if (condition != null) { - condition.clean(); - } - if (constraint != null) { - constraint.clean(); - } method = (method != null ? method.trim() : method); action = action.trim(); @@ -233,8 +228,6 @@ public class JpaToscaTrigger extends PfConcept { result = (schedule != null ? schedule.validate(result) : result); result = (targetFilter != null ? targetFilter.validate(result) : result); - result = (condition != null ? condition.validate(result) : result); - result = (constraint != null ? constraint.validate(result) : result); return result; } @@ -248,7 +241,7 @@ public class JpaToscaTrigger extends PfConcept { return 0; } if (getClass() != otherConcept.getClass()) { - return this.hashCode() - otherConcept.hashCode(); + return getClass().getName().compareTo(otherConcept.getClass().getName()); } final JpaToscaTrigger other = (JpaToscaTrigger) otherConcept; @@ -312,24 +305,4 @@ public class JpaToscaTrigger extends PfConcept { return ObjectUtils.compare(action, other.action); } - - @Override - public PfConcept copyTo(@NonNull final PfConcept target) { - Assertions.instanceOf(target, JpaToscaTrigger.class); - - final JpaToscaTrigger copy = ((JpaToscaTrigger) target); - copy.setKey(new PfReferenceKey(key)); - copy.setDescription(description); - copy.setEventType(eventType); - copy.setSchedule(schedule != null ? new JpaToscaTimeInterval(schedule) : null); - copy.setTargetFilter(targetFilter != null ? new JpaToscaEventFilter(targetFilter) : null); - copy.setCondition(condition); - copy.setConstraint(constraint); - copy.setPeriod(period); - copy.setEvaluations(evaluations); - copy.setMethod(method); - copy.setAction(action); - - return copy; - } }