LcmEvent state handler refactoring
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / models / NcmpServiceCmHandle.java
index 963b484..ae40d33 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.cps.ncmp.api.models;
 import com.fasterxml.jackson.annotation.JsonSetter;
 import com.fasterxml.jackson.annotation.Nulls;
 import java.util.Collections;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -51,4 +52,16 @@ public class NcmpServiceCmHandle {
     @JsonSetter(nulls = Nulls.AS_EMPTY)
     private CompositeState compositeState;
 
+    /**
+     * NcmpServiceCmHandle copy constructor.
+     *
+     * @param ncmpServiceCmHandle Ncmp Service CmHandle
+     */
+    public NcmpServiceCmHandle(final NcmpServiceCmHandle ncmpServiceCmHandle) {
+        this.cmHandleId = ncmpServiceCmHandle.getCmHandleId();
+        this.dmiProperties = new LinkedHashMap<>(ncmpServiceCmHandle.getDmiProperties());
+        this.publicProperties = new LinkedHashMap<>(ncmpServiceCmHandle.getPublicProperties());
+        this.compositeState = ncmpServiceCmHandle.getCompositeState() != null ? new CompositeState(
+                ncmpServiceCmHandle.getCompositeState()) : null;
+    }
 }