aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnr/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-04 16:27:18 -0400
committerJim Hahn <jrh3@att.com>2020-08-06 19:19:46 -0400
commitdeed677c3dc8751209d50e7d35132c929fe6800d (patch)
tree01f3149d4a03206e134d889d50834ae8d141a0ce /models-interactions/model-actors/actor.sdnr/src/main
parent364ef26929f06637bca03dd7bfb5e8ac69b611f8 (diff)
Modify Actors to use properties when provided
Modified the Actors to use properties when the application provides them instead of going to the event context for the data. This sometimes entailed moving code out of the Operation subclass constructor that used or validated the context data. Combined some property names and renamed others. Changed VF Count from AtomicInteger to Integer. Issue-ID: POLICY-2746 Change-Id: Ib8730538309bb77d2f4f6161e9a20a49362d8972 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.sdnr/src/main')
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
index f88f3c300..4511cc3c5 100644
--- a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
+++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
@@ -46,7 +46,7 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
*/
public static final String NAME = "any";
- private static final List<String> PROPERTY_NAMES = List.of(OperationProperties.AAI_VSERVER_LINK);
+ private static final List<String> PROPERTY_NAMES = List.of(OperationProperties.EVENT_PAYLOAD);
/**
* Keys used to match the response with the request listener. The sub request ID is a
@@ -156,7 +156,7 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
requestCommonHeader.setSubRequestId(subRequestId);
sdnrRequest.setCommonHeader(requestCommonHeader);
- sdnrRequest.setPayload(params.getContext().getEvent().getPayload());
+ sdnrRequest.setPayload(getEventPayload());
sdnrRequest.setAction(params.getOperation());
/*
@@ -169,4 +169,18 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
/* Return the request to be sent through dmaap. */
return dmaapRequest;
}
+
+ /**
+ * Gets the event payload, first checking for it in the properties and then in the
+ * event.
+ *
+ * @return the event payload
+ */
+ protected String getEventPayload() {
+ if (containsProperty(OperationProperties.EVENT_PAYLOAD)) {
+ return getProperty(OperationProperties.EVENT_PAYLOAD);
+ }
+
+ return params.getContext().getEvent().getPayload();
+ }
}