diff options
Diffstat (limited to 'applications/optimization/src')
3 files changed, 15 insertions, 17 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 50bc0bd8..92a8e688 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 @@ -137,7 +137,7 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid // // Convert the request // - DecisionRequest subscriberRequest = new DecisionRequest(request); + var subscriberRequest = new DecisionRequest(request); // // Override the PolicyType to ensure we are only looking at Subscriber Policies // 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 52f1ec0a..068245ff 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,6 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeAssignmentExpressionType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.EffectType; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory; import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType; import org.apache.commons.lang3.StringUtils; @@ -95,7 +94,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator // // Dump our revised policy out // - try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { + try (var os = new ByteArrayOutputStream()) { XACMLPolicyWriter.writePolicyFile(os, policy); LOGGER.info("{}", os); } catch (IOException e) { @@ -161,11 +160,11 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator // // Iterate through all the subscriber names // - AnyOfType anyOf = new AnyOfType(); + var anyOf = new AnyOfType(); for (Object subscriberName : subscriberNames instanceof Collection ? (List<Object>) subscriberNames : Arrays.asList(subscriberNames)) { - MatchType match = ToscaPolicyTranslatorUtils.buildMatchTypeDesignator( + var match = ToscaPolicyTranslatorUtils.buildMatchTypeDesignator( XACML3.ID_FUNCTION_STRING_EQUAL, subscriberName, XACML3.ID_DATATYPE_STRING, @@ -197,7 +196,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator // // Create our subscriber advice expression // - AdviceExpressionType adviceExpression = new AdviceExpressionType(); + var adviceExpression = new AdviceExpressionType(); adviceExpression.setAppliesTo(EffectType.PERMIT); adviceExpression.setAdviceId(ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER.stringValue()); // @@ -221,7 +220,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator // // Add it to the overall expressions // - AdviceExpressionsType adviceExpressions = new AdviceExpressionsType(); + var adviceExpressions = new AdviceExpressionsType(); adviceExpressions.getAdviceExpression().add(adviceExpression); // // Done return our advice expressions @@ -232,11 +231,11 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator private static AdviceExpressionType generateSubscriberAdviceAttributes(AdviceExpressionType adviceExpression, Identifier attributeId, Collection<Object> adviceAttribute) { for (Object attribute : adviceAttribute) { - AttributeValueType value = new AttributeValueType(); + var value = new AttributeValueType(); value.setDataType(XACML3.ID_DATATYPE_STRING.stringValue()); value.getContent().add(attribute.toString()); - AttributeAssignmentExpressionType assignment = new AttributeAssignmentExpressionType(); + var assignment = new AttributeAssignmentExpressionType(); assignment.setAttributeId(attributeId.stringValue()); assignment.setCategory(XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT.stringValue()); assignment.setExpression(new ObjectFactory().createAttributeValue(value)); diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java index 263c6540..5eda7678 100644 --- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java +++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ package org.onap.policy.xacml.pdp.application.optimization; import com.att.research.xacml.api.AttributeValue; import com.att.research.xacml.api.DataType; import com.att.research.xacml.api.DataTypeException; -import com.att.research.xacml.api.DataTypeFactory; import com.att.research.xacml.api.Identifier; import com.att.research.xacml.api.Request; import com.att.research.xacml.api.XACML3; @@ -58,13 +57,13 @@ public class OptimizationSubscriberRequest extends StdMatchablePolicyRequest { */ @SuppressWarnings({"rawtypes", "unchecked"}) public static Request createInstance(DecisionRequest decisionRequest) throws XacmlApplicationException { - Request request = StdMatchablePolicyRequest.createInstance(decisionRequest); + var request = StdMatchablePolicyRequest.createInstance(decisionRequest); // // Add in the context attributes // - StdMutableRequest mutableRequest = new StdMutableRequest(request); - StdMutableRequestAttributes contextAttributes = new StdMutableRequestAttributes(); + var mutableRequest = new StdMutableRequest(request); + var contextAttributes = new StdMutableRequestAttributes(); contextAttributes.setCategory(XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT); // // Add the context attributes @@ -94,12 +93,12 @@ public class OptimizationSubscriberRequest extends StdMatchablePolicyRequest { protected static StdMutableRequestAttributes addSubject(StdMutableRequestAttributes attributes, Collection<Object> values, Identifier id) throws DataTypeException { - DataTypeFactory factory = getDataTypeFactory(); + var factory = getDataTypeFactory(); if (factory == null) { return null; } for (Object value : values) { - StdMutableAttribute mutableAttribute = new StdMutableAttribute(); + var mutableAttribute = new StdMutableAttribute(); mutableAttribute.setCategory(XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT); mutableAttribute.setAttributeId(id); mutableAttribute.setIncludeInResults(true); |