[Policy-52, Policy-92, Policy-93] Policy Enhancements and bugfixes
[policy/engine.git] / ECOMP-PAP-REST / src / main / java / org / openecomp / policy / pap / xacml / rest / elk / client / ElkConnectorImpl.java
index 4dd48ad..a6315f8 100644 (file)
@@ -206,17 +206,19 @@ public class ElkConnectorImpl implements ElkConnector{
                                "            \"must\" : [";
                
                String match_params = "";
+               boolean first = true;
                for(Entry<String, String> entry : filter_s.entrySet()){
                        String key = entry.getKey();
                        String value = entry.getValue();
-                       if(filter_s.size() == 1){
-                               match_params = "\"match\" : {\""+key+"\" : \""+value+"\" }";
+                       if(first){
+                               match_params = "\"match\" : {\""+key+"\" : \""+value+"\" }},";
+                               first = false;
                        }else{
-                               match_params = match_params + "match\" : { \""+key+"\" : \""+value+"\" } ,";
+                               match_params = match_params + "{\"match\" : { \""+key+"\" : \""+value+"\" } },";
                        }
                }
                if(match_params.endsWith(",")){
-                       match_params = match_params.substring(0, match_params.length()-1);
+                       match_params = match_params.substring(0, match_params.length()-2);
                }
 
                matches_s = matches_s + "{\n" + match_params + "\n}" ;