summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.aai
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-17 18:45:58 -0400
committerJim Hahn <jrh3@att.com>2020-08-17 18:48:11 -0400
commit2c789f6a45f50da129d05ff3ea20acd9f45774d0 (patch)
treecc4d10e4e8d6a91d6ba0d0a26f8eb411dcd234c7 /models-interactions/model-actors/actor.aai
parentf5eeaaeaeadf04571d8881f497c770ee1bbbdde5 (diff)
Remove event context from Operation post processor
Some operations, notably A&AI, post-process data by putting it into the event context. However, with the new strategy, the event context may not be populated. Modified the code to see if the context exists before putting the data into it. Issue-ID: POLICY-2746 Change-Id: Ie3b1bd13b4ac5ee59629daaebc05a62e6ef3c804 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.aai')
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java6
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java7
2 files changed, 8 insertions, 5 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
index c8e087036..388959ddf 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
@@ -193,8 +193,10 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
protected CompletableFuture<OperationOutcome> postProcessResponse(OperationOutcome outcome, String url,
Response rawResponse, String response) {
- logger.info("{}: caching response for {}", getFullName(), params.getRequestId());
- params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, new AaiCqResponse(response));
+ if (params.getContext() != null) {
+ logger.info("{}: caching response for {}", getFullName(), params.getRequestId());
+ params.getContext().setProperty(AaiCqResponse.CONTEXT_KEY, new AaiCqResponse(response));
+ }
return super.postProcessResponse(outcome, url, rawResponse, response);
}
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
index c18d06c95..c91e2a0d6 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
@@ -112,9 +112,10 @@ public class AaiGetOperation extends HttpOperation<StandardCoderObject> {
Response rawResponse, StandardCoderObject response) {
String entity = params.getTargetEntity();
- logger.info("{}: caching response of {} for {}", getFullName(), entity, params.getRequestId());
-
- params.getContext().setProperty(propertyPrefix + entity, response);
+ if (params.getContext() != null) {
+ logger.info("{}: caching response of {} for {}", getFullName(), entity, params.getRequestId());
+ params.getContext().setProperty(propertyPrefix + entity, response);
+ }
return super.postProcessResponse(outcome, url, rawResponse, response);
}