summaryrefslogtreecommitdiffstats
path: root/applications/optimization/src/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-03-11 14:06:42 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-03-12 09:12:22 -0400
commit2924fa7d806435a3bf9f2cb5abcdb01aa7295b00 (patch)
tree094c3b2140e492f8ffc700f0232405dcf83d2d2e /applications/optimization/src/main
parent2a65ced426b393e9a6fe34c2c64303b1cc83e1a0 (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/optimization/src/main')
-rw-r--r--applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java18
1 files changed, 4 insertions, 14 deletions
diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
index ee1ccdce..5a8978f7 100644
--- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
+++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
@@ -25,7 +25,6 @@ package org.onap.policy.xacml.pdp.application.optimization;
import com.att.research.xacml.api.Advice;
import com.att.research.xacml.api.AttributeAssignment;
import com.att.research.xacml.api.Decision;
-import com.att.research.xacml.api.Request;
import com.att.research.xacml.api.Response;
import com.att.research.xacml.api.Result;
import java.nio.file.Path;
@@ -180,25 +179,16 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
}
}
//
- // 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
- //
- Pair<DecisionResponse, Response> returnPair = Pair.of(this.getTranslator().convertResponse(xacmlResponse),
- xacmlResponse);
+ Pair<DecisionResponse, Response> decisionPair = super.makeDecision(request, requestQueryParams);
//
// Add back in advice from subscriber
//
if (xacmlSubscriberResponse != null) {
- addSubscriberAdvice(xacmlSubscriberResponse, returnPair.getLeft());
+ addSubscriberAdvice(xacmlSubscriberResponse, decisionPair.getLeft());
}
- return returnPair;
+ return decisionPair;
}
@Override