diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-11 14:06:42 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-12 09:12:22 -0400 |
commit | 2924fa7d806435a3bf9f2cb5abcdb01aa7295b00 (patch) | |
tree | 094c3b2140e492f8ffc700f0232405dcf83d2d2e /applications/monitoring/src/main | |
parent | 2a65ced426b393e9a6fe34c2c64303b1cc83e1a0 (diff) |
Better error handling for decisions
Throw exceptions when requests cannot be created and return
error information back. Consolidated some code to avoid sonar
duplication issues.
Companion review to https://gerrit.onap.org/r/c/policy/models/+/103548
Issue-ID: POLICY-2242
Change-Id: Ic873af933dab82e3aeef6335f55939666be20385
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/monitoring/src/main')
-rw-r--r-- | applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java b/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java index 436028fd..5c41a9e2 100644 --- a/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java +++ b/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java @@ -22,7 +22,6 @@ package org.onap.policy.xacml.pdp.application.monitoring; -import com.att.research.xacml.api.Request; import com.att.research.xacml.api.Response; import java.util.ArrayList; import java.util.Arrays; @@ -109,17 +108,10 @@ public class MonitoringPdpApplication extends StdXacmlApplicationServiceProvider public Pair<DecisionResponse, Response> makeDecision(DecisionRequest request, Map<String, String[]> requestQueryParams) { // - // Convert to a XacmlRequest + // Make the decision // - Request xacmlRequest = this.getTranslator().convertRequest(request); - // - // Now get a decision - // - Response xacmlResponse = this.xacmlDecision(xacmlRequest); - // - // Convert to a DecisionResponse - // - DecisionResponse decisionResponse = this.getTranslator().convertResponse(xacmlResponse); + Pair<DecisionResponse, Response> decisionPair = super.makeDecision(request, requestQueryParams); + DecisionResponse decisionResponse = decisionPair.getKey(); // // Abbreviate results if needed // @@ -137,7 +129,7 @@ public class MonitoringPdpApplication extends StdXacmlApplicationServiceProvider policy.remove("version"); } } - return Pair.of(decisionResponse, xacmlResponse); + return decisionPair; } @Override |