From 1b456572b4a1b34651c3fb81749af543b624fa7e Mon Sep 17 00:00:00 2001 From: Daniel Cruz Date: Tue, 3 Apr 2018 21:09:58 -0500 Subject: Fix Event Syntax The "requestID" field was changed to "requestId" which brakes the use cases since this does not conform to the events DCAE will be sending. To avoid further issues with changed variable names, all onset fields now have a serialized name that will be used when serializing/deserializing with gson. Issue-ID: POLICY-681 Change-Id: I731b0c83a9b6c9bbaae0312f76382d7f4644db8c Signed-off-by: Daniel Cruz --- .../onap/policy/controlloop/ControlLoopEvent.java | 25 +++++++++++++++++++++- .../controlloop/VirtualControlLoopEvent.java | 5 +++++ .../VirtualControlLoopNotification.java | 4 ++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java index d3f1786c7..eab04e22e 100644 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java +++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java @@ -20,23 +20,46 @@ package org.onap.policy.controlloop; +import com.google.gson.annotations.SerializedName; + import java.io.Serializable; import java.util.UUID; public abstract class ControlLoopEvent implements Serializable { private static final long serialVersionUID = 2391252138583119195L; - + + @SerializedName("closedLoopControlName") private String closedLoopControlName; + + @SerializedName("version") private String version = "1.0.2"; + + @SerializedName("requestID") private UUID requestId; + + @SerializedName("closedLoopEventClient") private String closedLoopEventClient; + + @SerializedName("target_type") private ControlLoopTargetType targetType; + + @SerializedName("target") private String target; + + @SerializedName("from") private String from; + + @SerializedName("policyScope") private String policyScope; + + @SerializedName("policyName") private String policyName; + + @SerializedName("policyVersion") private String policyVersion; + + @SerializedName("closedLoopEventStatus") private ControlLoopEventStatus closedLoopEventStatus; public ControlLoopEvent() { diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java index ec4fc47dd..b5ae50ac8 100644 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java +++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java @@ -29,8 +29,13 @@ import java.util.Map; public class VirtualControlLoopEvent extends ControlLoopEvent { private static final long serialVersionUID = -5752405682246066226L; + + @SerializedName("closedLoopAlarmStart") private Instant closedLoopAlarmStart; + + @SerializedName("closedLoopAlarmEnd") private Instant closedLoopAlarmEnd; + @SerializedName("AAI") private Map aai = new HashMap<>(); diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java index acb81f8ba..71a901505 100644 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java +++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java @@ -32,7 +32,11 @@ public class VirtualControlLoopNotification extends ControlLoopNotification { @SerializedName("AAI") private Map aai = new HashMap<>(); + + @SerializedName("closedLoopAlarmStart") private Instant closedLoopAlarmStart; + + @SerializedName("closedLoopAlarmEnd") private Instant closedLoopAlarmEnd; public VirtualControlLoopNotification() {} -- cgit 1.2.3-korg