From b6d9063e06ab8cdf2d97fc75810792659344e4a8 Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Fri, 16 Mar 2018 20:50:41 -0500 Subject: New Optimization Policy This is the new Optimization Policy to support the Integration of the OOF Policy Model into the Policy Platform. Added changes from Frank Wang to fix the following issues with existing Model Parser: 1. TOSCA Rendering issues 2. Matching Attributes support 3. ImportModelAPI to support TOSCA model upload via REST API Running local Sonar tonight to start fixing Sonar issues Added changes per review comments and fixed Sonar issues Change-Id: Ia8ce09c28a718ce4460475e76a750caef774bd6b Issue-ID: POLICY-622 Signed-off-by: Michael Mokry --- .../src/main/java/org/onap/policy/utils/PolicyUtils.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'PolicyEngineUtils') diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java index e17ddc681..06263853e 100644 --- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java +++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyUtils.java @@ -157,6 +157,21 @@ public class PolicyUtils { return SUCCESS; } + /** + * Validate a field (accepts Dash) if it contains unacceptable policy input and return "success" if good. + * + * @param field + * @return + */ + public static String policySpecialCharWithDashValidator(String field){ + String error; + if ("".equals(field) || !field.matches("^[a-zA-Z0-9_-]*$")) { + error = "The Value in Required Field will allow only '{0-9}, {a-z}, {A-Z}, _, -' following set of Combinations"; + return error; + } + return SUCCESS; + } + /** * Validate the XACML description tag and return "success" if good. * -- cgit 1.2.3-korg