summaryrefslogtreecommitdiffstats
path: root/models-pdp/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'models-pdp/src/main')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java3
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java6
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java8
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java21
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java24
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java28
6 files changed, 28 insertions, 62 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
index 4e7fc4117..6d5f804f8 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java
@@ -22,6 +22,7 @@
package org.onap.policy.models.pdp.concepts;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -69,7 +70,7 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> {
this.description = source.description;
this.pdpGroupState = source.pdpGroupState;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
- this.pdpSubgroups = PfUtils.mapList(source.pdpSubgroups, PdpSubGroup::new);
+ this.pdpSubgroups = PfUtils.mapList(source.pdpSubgroups, PdpSubGroup::new, new ArrayList<>(0));
}
@Override
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
index 3655aa796..e50694b93 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
@@ -21,6 +21,7 @@
package org.onap.policy.models.pdp.concepts;
+import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
@@ -78,8 +79,9 @@ public class PdpStatus extends PdpMessage {
this.state = source.state;
this.healthy = source.healthy;
this.description = source.description;
- this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaPolicyTypeIdentifier::new);
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new);
+ this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaPolicyTypeIdentifier::new,
+ new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
this.deploymentInstanceInfo = source.deploymentInstanceInfo;
this.properties = source.properties;
this.statistics = (source.statistics == null ? null : new PdpStatistics(source.statistics));
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
index 2618a5017..236cc858a 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
@@ -21,6 +21,7 @@
package org.onap.policy.models.pdp.concepts;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -64,12 +65,13 @@ public class PdpSubGroup {
*/
public PdpSubGroup(@NonNull final PdpSubGroup source) {
this.pdpType = source.pdpType;
- this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaPolicyTypeIdentifier::new);
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new);
+ this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaPolicyTypeIdentifier::new,
+ new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
this.currentInstanceCount = source.currentInstanceCount;
this.desiredInstanceCount = source.desiredInstanceCount;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
- this.pdpInstances = PfUtils.mapList(source.pdpInstances, Pdp::new);
+ this.pdpInstances = PfUtils.mapList(source.pdpInstances, Pdp::new, new ArrayList<>(0));
}
/**
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
index 7d90c03b1..5820a355b 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
@@ -25,21 +25,17 @@ package org.onap.policy.models.pdp.persistence.concepts;
import java.io.Serializable;
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.apache.commons.lang3.StringUtils;
-import org.onap.policy.common.utils.validation.Assertions;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
import org.onap.policy.models.base.PfKey;
@@ -113,6 +109,10 @@ public class JpaPdp extends PfConcept implements PfAuthorative<Pdp>, Serializabl
*/
public JpaPdp(@NonNull final JpaPdp copyConcept) {
super(copyConcept);
+ this.key = new PfReferenceKey(copyConcept.key);
+ this.pdpState = copyConcept.pdpState;
+ this.healthy = copyConcept.healthy;
+ this.message = copyConcept.message;
}
/**
@@ -230,17 +230,4 @@ public class JpaPdp extends PfConcept implements PfAuthorative<Pdp>, Serializabl
return ObjectUtils.compare(message, other.message);
}
-
- @Override
- public PfConcept copyTo(@NonNull final PfConcept target) {
- Assertions.instanceOf(target, JpaPdp.class);
-
- final JpaPdp copy = ((JpaPdp) target);
- copy.setKey(new PfReferenceKey(key));
- copy.setPdpState(pdpState);
- copy.setHealthy(healthy);
- copy.setMessage(message);
-
- return copy;
- }
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java
index 36d5cc18e..0df620bcf 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroup.java
@@ -28,7 +28,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
@@ -41,14 +40,11 @@ import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
-
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.common.utils.validation.Assertions;
import org.onap.policy.common.utils.validation.ParameterValidationUtils;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -135,6 +131,11 @@ public class JpaPdpGroup extends PfConcept implements PfAuthorative<PdpGroup> {
*/
public JpaPdpGroup(@NonNull final JpaPdpGroup copyConcept) {
super(copyConcept);
+ this.key = new PfConceptKey(copyConcept.key);
+ this.description = copyConcept.description;
+ this.pdpGroupState = copyConcept.pdpGroupState;
+ this.properties = (copyConcept.properties == null ? null : new LinkedHashMap<>(copyConcept.properties));
+ this.pdpSubGroups = PfUtils.mapList(copyConcept.pdpSubGroups, JpaPdpSubGroup::new, new ArrayList<>(0));
}
/**
@@ -310,19 +311,4 @@ public class JpaPdpGroup extends PfConcept implements PfAuthorative<PdpGroup> {
return PfUtils.compareObjects(pdpSubGroups, other.pdpSubGroups);
}
-
- @Override
- public PfConcept copyTo(@NonNull final PfConcept target) {
- Assertions.instanceOf(target, JpaPdpGroup.class);
-
- final JpaPdpGroup copy = ((JpaPdpGroup) target);
- copy.setKey(new PfConceptKey(key));
-
- copy.setDescription(description);
- copy.setPdpGroupState(pdpGroupState);
- copy.setProperties(properties == null ? null : new LinkedHashMap<>(properties));
- copy.setPdpSubGroups(PfUtils.mapList(pdpSubGroups, JpaPdpSubGroup::new));
-
- return copy;
- }
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
index 723d427de..3a81c0b30 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
@@ -28,7 +28,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
@@ -44,8 +43,6 @@ import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
-
-import org.onap.policy.common.utils.validation.Assertions;
import org.onap.policy.common.utils.validation.ParameterValidationUtils;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
@@ -145,6 +142,14 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
*/
public JpaPdpSubGroup(@NonNull final JpaPdpSubGroup copyConcept) {
super(copyConcept);
+ this.key = new PfReferenceKey(copyConcept.key);
+ this.supportedPolicyTypes = PfUtils.mapList(copyConcept.supportedPolicyTypes,
+ PfConceptKey::new, new ArrayList<>(0));
+ this.policies = PfUtils.mapList(copyConcept.policies, PfConceptKey::new, new ArrayList<>(0));
+ this.currentInstanceCount = copyConcept.currentInstanceCount;
+ this.desiredInstanceCount = copyConcept.desiredInstanceCount;
+ this.properties = (copyConcept.properties != null ? new LinkedHashMap<>(copyConcept.properties) : null);
+ this.pdpInstances = PfUtils.mapList(copyConcept.pdpInstances, JpaPdp::new, new ArrayList<>(0));
}
/**
@@ -393,21 +398,4 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
return PfUtils.compareObjects(pdpInstances, other.pdpInstances);
}
-
- @Override
- public PfConcept copyTo(@NonNull final PfConcept target) {
- Assertions.instanceOf(target, JpaPdpSubGroup.class);
-
- final JpaPdpSubGroup copy = ((JpaPdpSubGroup) target);
- copy.setKey(new PfReferenceKey(key));
-
- copy.setSupportedPolicyTypes(PfUtils.mapList(supportedPolicyTypes, PfConceptKey::new));
- copy.setPolicies(PfUtils.mapList(policies, PfConceptKey::new));
- copy.setCurrentInstanceCount(currentInstanceCount);
- copy.setDesiredInstanceCount(desiredInstanceCount);
- copy.setProperties(properties == null ? null : new LinkedHashMap<>(properties));
- copy.setPdpInstances(PfUtils.mapList(pdpInstances, JpaPdp::new));
-
- return copy;
- }
}