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/PdpStateChange.java17
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java19
2 files changed, 34 insertions, 2 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStateChange.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStateChange.java
index bca162e91..d8f938bbc 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStateChange.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStateChange.java
@@ -28,7 +28,8 @@ import org.onap.policy.models.pdp.enums.PdpMessageType;
import org.onap.policy.models.pdp.enums.PdpState;
/**
- * Class to represent the PDP_STATE_CHANGE message that PAP will send to either PDPGroup/Subgroup or a PDP.
+ * Class to represent the PDP_STATE_CHANGE message that PAP will send to either
+ * PDPGroup/Subgroup or a PDP.
*
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
@@ -49,4 +50,18 @@ public class PdpStateChange extends PdpMessage {
public PdpStateChange() {
super(PdpMessageType.PDP_STATE_CHANGE);
}
+
+ /**
+ * Constructs the object, making a deep copy.
+ *
+ * @param source source from which to copy
+ */
+ public PdpStateChange(PdpStateChange source) {
+ super(PdpMessageType.PDP_STATE_CHANGE);
+
+ this.name = source.name;
+ this.state = source.state;
+ this.pdpGroup = source.pdpGroup;
+ this.pdpSubgroup = source.pdpSubgroup;
+ }
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
index 5c99a56f5..c8c8783df 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java
@@ -22,7 +22,7 @@
package org.onap.policy.models.pdp.concepts;
import java.util.List;
-
+import java.util.stream.Collectors;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@@ -53,4 +53,21 @@ public class PdpUpdate extends PdpMessage {
public PdpUpdate() {
super(PdpMessageType.PDP_UPDATE);
}
+
+ /**
+ * Constructs the object, making a deep copy.
+ *
+ * @param source source from which to copy
+ */
+ public PdpUpdate(PdpUpdate source) {
+ super(PdpMessageType.PDP_UPDATE);
+
+ this.name = source.name;
+ this.pdpType = source.pdpType;
+ this.description = source.description;
+ this.pdpGroup = source.pdpGroup;
+ this.pdpSubgroup = source.pdpSubgroup;
+ this.policies = (source.policies == null ? null
+ : source.policies.stream().map(ToscaPolicy::new).collect(Collectors.toList()));
+ }
}