X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ECOMP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fpap%2Fxacml%2Frest%2Felk%2Fclient%2FElkConnector.java;h=2b94e44c777dd687ef2348e7020f2cd19ec79dd0;hb=dda032f8bb161d54eb1f59de2b4a3efb774fc4d1;hp=1fd95abd4b05997580681d3bdd9e73b90a299973;hpb=a330af579866dacbe595e2e4ad1dd29cd3c96945;p=policy%2Fengine.git diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnector.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnector.java index 1fd95abd4..2b94e44c7 100644 --- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnector.java +++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnector.java @@ -20,7 +20,7 @@ package org.openecomp.policy.pap.xacml.rest.elk.client; -import java.util.ArrayList; +import java.util.Map; import org.openecomp.policy.rest.adapter.PolicyRestAdapter; @@ -58,106 +58,43 @@ public interface ElkConnector { none, } - public JestResult policy(String policyId) - throws IllegalStateException, IllegalArgumentException; - public boolean delete(PolicyRestAdapter policyData) throws IllegalStateException; - public ArrayList policyLocators(PolicyIndexType type, String text,int connector) - throws IllegalStateException, IllegalArgumentException; - - public ArrayList policyLocators(PolicyIndexType type, String text, - ArrayList,ArrayList>> filter_s,int connector) - throws IllegalStateException, IllegalArgumentException; - public JestResult search(PolicyIndexType type, String text) throws IllegalStateException, IllegalArgumentException; public JestResult search(PolicyIndexType type, String text, - ArrayList,ArrayList>> filter_s) + Map searchKeyValue) throws IllegalStateException, IllegalArgumentException; public boolean update(PolicyRestAdapter policyData) throws IllegalStateException; public ElkConnector singleton = new ElkConnectorImpl(); - public static PolicyIndexType toPolicyIndexType(PolicyType type) - throws IllegalArgumentException { - if (type == null) - throw new IllegalArgumentException("Unsupported NULL type conversion"); - - switch(type) { - case Config: - return PolicyIndexType.config; - case Action: - return PolicyIndexType.action; - case Decision: - return PolicyIndexType.decision; - case Config_Fault: - return PolicyIndexType.closedloop; - case Config_PM: - return PolicyIndexType.closedloop; - case Config_FW: - return PolicyIndexType.config; - case Config_MS: - return PolicyIndexType.config; - case none: - return PolicyIndexType.all; - default: - throw new IllegalArgumentException("Unsupported type conversion to index: " + type.name()); - } - } - public static PolicyIndexType toPolicyIndexType(String policyName) - throws IllegalArgumentException { - if (policyName == null) - throw new IllegalArgumentException("Unsupported NULL policy name conversion"); - - if (policyName.startsWith("Config_Fault")) { - return PolicyIndexType.closedloop; - } else if (policyName.startsWith("Config_PM")) { - return PolicyIndexType.closedloop; - } else if (policyName.startsWith("Config_FW")) { - return PolicyIndexType.config; - } else if (policyName.startsWith("Config_MS")) { - return PolicyIndexType.config; - }else if (policyName.startsWith("Action")) { - return PolicyIndexType.action; - } else if (policyName.startsWith("Decision")) { - return PolicyIndexType.decision; - } else if (policyName.startsWith("Config")) { - return PolicyIndexType.config; - } else { - throw new IllegalArgumentException - ("Unsupported policy name conversion to index: " + - policyName); - } - } - - public static PolicyType toPolicyType(String policyName) - throws IllegalArgumentException { + throws IllegalArgumentException { if (policyName == null) - throw new IllegalArgumentException("Unsupported NULL policy name conversion to Policy Type"); - + throw new IllegalArgumentException("Unsupported NULL policy name conversion"); + if (policyName.startsWith("Config_Fault")) { - return PolicyType.Config_Fault; + return PolicyIndexType.closedloop; } else if (policyName.startsWith("Config_PM")) { - return PolicyType.Config_PM; + return PolicyIndexType.closedloop; } else if (policyName.startsWith("Config_FW")) { - return PolicyType.Config_FW; + return PolicyIndexType.config; } else if (policyName.startsWith("Config_MS")) { - return PolicyType.Config_MS; + return PolicyIndexType.config; }else if (policyName.startsWith("Action")) { - return PolicyType.Action; + return PolicyIndexType.action; } else if (policyName.startsWith("Decision")) { - return PolicyType.Decision; + return PolicyIndexType.decision; } else if (policyName.startsWith("Config")) { - return PolicyType.Config; + return PolicyIndexType.config; } else { throw new IllegalArgumentException - ("Unsupported policy name conversion to index: " + - policyName); + ("Unsupported policy name conversion to index: " + + policyName); } }