Ignore fsm field in policies for serialization 17/101917/2
authorjhh <jorge.hernandez-herrero@att.com>
Tue, 18 Feb 2020 16:10:19 +0000 (10:10 -0600)
committerjhh <jorge.hernandez-herrero@att.com>
Tue, 18 Feb 2020 16:27:08 +0000 (10:27 -0600)
When printing lifecycle fsm state information with
telemetry, fsm causes a stack overflow, because of
the pointer back to the fsm parent object.   This
will correct this situation.

Issue-ID: POLICY-2345
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: If4e11f37a74fcc763517bc08c4a8e13c1a6561df
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeController.java
feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeRulesController.java

index 87128e4..ebc44e9 100644 (file)
@@ -20,7 +20,9 @@
 
 package org.onap.policy.drools.lifecycle;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Getter;
+import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
 
@@ -28,6 +30,9 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi
 public class PolicyTypeNativeController implements PolicyTypeController {
 
     protected final ToscaPolicyTypeIdentifier policyType;
+
+    @GsonJsonIgnore
+    @JsonIgnore
     protected final LifecycleFsm fsm;
 
     public PolicyTypeNativeController(LifecycleFsm fsm, ToscaPolicyTypeIdentifier policyType) {
index 7dd0d7a..8e928aa 100644 (file)
@@ -20,8 +20,9 @@
 
 package org.onap.policy.drools.lifecycle;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Getter;
-
+import org.onap.policy.common.gson.annotation.GsonJsonIgnore;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
 
@@ -29,6 +30,9 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi
 public class PolicyTypeRulesController implements PolicyTypeController {
 
     protected final ToscaPolicyTypeIdentifier policyType;
+
+    @GsonJsonIgnore
+    @JsonIgnore
     protected final LifecycleFsm fsm;
 
     public PolicyTypeRulesController(LifecycleFsm fsm, ToscaPolicyTypeIdentifier policyType) {