X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FOptimizationConfigPolicy.java;fp=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FOptimizationConfigPolicy.java;h=097a33f8ed9a9cf8c73022843f7cfb1991902f79;hb=349714f2b187d55560fd8ed9a461f64cac233743;hp=82a6c4b8393ebe0e4247cf549675268aa61e9fd5;hpb=c46961c5322b8113dcf859e07e596bd7e473bc5d;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java index 82a6c4b83..097a33f8e 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,7 +25,6 @@ import com.att.research.xacml.std.IdentifierImpl; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Splitter; - import java.io.File; import java.io.IOException; import java.io.PrintWriter; @@ -38,7 +37,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; - import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType; @@ -52,7 +50,6 @@ 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 oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; - import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.onap.policy.common.logging.eelf.MessageCodes; @@ -183,7 +180,7 @@ public class OptimizationConfigPolicy extends Policy { matching = getValueFromDictionary(policyAdapter.getServiceType()); } else { String jsonVersion = StringUtils.replaceEach(rootNode.get("version").toString(), - new String[] {"\""}, new String[] {""}); + new String[] {"\""}, new String[] {""}); matching = getValueFromDictionary(policyAdapter.getServiceType() + "-v" + jsonVersion); } if (matching != null && !matching.isEmpty()) { @@ -253,7 +250,7 @@ public class OptimizationConfigPolicy extends Policy { accessURI = new URI(ACTION_ID); } catch (URISyntaxException e) { PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "OptimizationConfigPolicy", - "Exception creating ACCESS URI"); + "Exception creating ACCESS URI"); } accessAttributeDesignator.setCategory(CATEGORY_ACTION); accessAttributeDesignator.setDataType(STRING_DATATYPE); @@ -273,7 +270,7 @@ public class OptimizationConfigPolicy extends Policy { configURI = new URI(RESOURCE_ID); } catch (URISyntaxException e) { PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "OptimizationConfigPolicy", - "Exception creating Config URI"); + "Exception creating Config URI"); } configAttributeDesignator.setCategory(CATEGORY_RESOURCE); configAttributeDesignator.setDataType(STRING_DATATYPE); @@ -313,8 +310,8 @@ public class OptimizationConfigPolicy extends Policy { if (value.isContainerNode() && !value.isArray()) { pullMatchValue(value); // RECURSIVE CALL } else { - newValue = StringUtils.replaceEach(value.toString(), new String[] {"[", "]", "\""}, - new String[] {"", "", ""}); + newValue = + StringUtils.replaceEach(value.toString(), new String[] {"[", "]", "\""}, new String[] {"", "", ""}); mapAttribute.put(key, newValue); } } @@ -328,7 +325,7 @@ public class OptimizationConfigPolicy extends Policy { CommonClassDaoImpl dbConnection = new CommonClassDaoImpl(); List result = - dbConnection.getDataById(OptimizationModels.class, "modelName:version", modelName + ":" + modelVersion); + dbConnection.getDataById(OptimizationModels.class, "modelName:version", modelName + ":" + modelVersion); if (result != null && !result.isEmpty()) { OptimizationModels model = (OptimizationModels) result.get(0); ruleTemplate = model.getAnnotation(); @@ -337,7 +334,7 @@ public class OptimizationConfigPolicy extends Policy { } // Data required for Advice part is setting here. - private AdviceExpressionsType getAdviceExpressions(int version, String fileName) { + protected AdviceExpressionsType getAdviceExpressions(int version, String fileName) { AdviceExpressionsType advices = new AdviceExpressionsType(); AdviceExpressionType advice = new AdviceExpressionType(); advice.setAdviceId("OptimizationID");