From 9d3f4f0bef642836731213dc05e9127bca34200c Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Wed, 23 Jun 2021 11:05:05 -0400 Subject: Use protected methods vs private Application and common code in xacml-pdp is meant to be available for developers to re-use and/or extend as desired. Private methods are unnecessary at this time, but could be re-visited in a later release. For Honolulu, simply moving to protected to keep functionality the same. Possibly for Istanbul we can make more changes to support mixing of ONAP application with custom applications during runtime. Issue-ID: POLICY-3305 Change-Id: I6db23bda3c81fdbbf86e39cc2cd2e706d8bee63d Signed-off-by: Pamela Dragosh (cherry picked from commit 8e0aa0ffa5cef537de1c841acf38300832c52a56) Signed-off-by: Pamela Dragosh --- .../pdp/application/optimization/OptimizationPdpApplication.java | 8 ++++---- .../optimization/OptimizationPdpApplicationTranslator.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'applications/optimization/src/main/java/org') 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 92a8e688..998ed537 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 @@ -188,14 +188,14 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid } @SuppressWarnings("unchecked") - private boolean hasSubscriberAttributes(DecisionRequest request) { + protected boolean hasSubscriberAttributes(DecisionRequest request) { return request.getContext() != null && request.getContext().containsKey(RESOURCE_SUBSCRIBERNAME) && request.getContext().get(RESOURCE_SUBSCRIBERNAME) instanceof List && ! ((List) request.getContext().get(RESOURCE_SUBSCRIBERNAME)).isEmpty(); } - private boolean addSubscriberAttributes(Response xacmlResponse, DecisionRequest initialRequest) { + protected boolean addSubscriberAttributes(Response xacmlResponse, DecisionRequest initialRequest) { // // This has multiple results right now because of how the attributes were added to the // request. That will have to be fixed in the future, for now find the Permit result @@ -221,7 +221,7 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid return false; } - private void addSubscriberAdvice(Response xacmlResponse, DecisionResponse response) { + protected void addSubscriberAdvice(Response xacmlResponse, DecisionResponse response) { // // Again find the Permit result // @@ -237,7 +237,7 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid @SuppressWarnings("unchecked") - private void scanAdvice(Collection adviceCollection, DecisionRequest initialRequest) { + protected void scanAdvice(Collection adviceCollection, DecisionRequest initialRequest) { // // There really should only be one advice object // diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java index e1fe2dcd..84a6ffae 100644 --- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java +++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java @@ -136,7 +136,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator } @SuppressWarnings("unchecked") - private static void addValuesToMap(Object values, String key, Map mapAdvice) { + protected static void addValuesToMap(Object values, String key, Map mapAdvice) { if (values instanceof Collection) { List valueList = new ArrayList<>(); ((Collection) values).forEach(val -> valueList.add(val.toString())); @@ -147,7 +147,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator } - private static PolicyType addSubscriberNameIntoTarget(PolicyType policy, + protected static PolicyType addSubscriberNameIntoTarget(PolicyType policy, Map subscriberProperties) throws ToscaPolicyConversionException { // // Iterate through all the subscriber names @@ -174,7 +174,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator return policy; } - private static AdviceExpressionsType generateSubscriberAdvice(Map subscriberProperties) + protected static AdviceExpressionsType generateSubscriberAdvice(Map subscriberProperties) throws ToscaPolicyConversionException { // // Create our subscriber advice expression @@ -207,7 +207,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator return adviceExpressions; } - private static void generateSubscriberAdviceAttributes(AdviceExpressionType adviceExpression, + protected static void generateSubscriberAdviceAttributes(AdviceExpressionType adviceExpression, Identifier attributeId, Collection adviceAttribute) { for (Object attribute : adviceAttribute) { var value = new AttributeValueType(); -- cgit 1.2.3-korg