diff options
author | Liam Fallon <liam.fallon@est.tech> | 2019-04-01 15:36:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-01 15:36:19 +0000 |
commit | 66e8e039cdfe540c065c34d6a21412f1bf5305f2 (patch) | |
tree | 0d989eb76c827ab37bc1e8722dd84baaf7ee989b /models-pdp/src/main/java/org | |
parent | fbed360c0acdc127fdf56a99401c1aea691ce57e (diff) | |
parent | eb0b14eb7edbdea7410bb78db249bfe7fee2efd1 (diff) |
Merge "Add copy constructors to more models-pdp classes"
Diffstat (limited to 'models-pdp/src/main/java/org')
-rw-r--r-- | models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStateChange.java | 17 | ||||
-rw-r--r-- | models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpUpdate.java | 19 |
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())); + } } |