From 85e26c8fe34bf0964fb90b17219dffc1421ac383 Mon Sep 17 00:00:00 2001 From: Driptaroop Das Date: Wed, 16 Jan 2019 23:51:47 +0530 Subject: Sonar Fix VnfSearchQueryBuilder Sonar Fix VnfSearchQueryBuilder Issue-ID: AAI-2084 Change-Id: I608d7592717ee9b74d4e7641051cfbb62c498315 Signed-off-by: Driptaroop Das --- .../aai/sparky/aggregatevnf/search/VnfSearchQueryBuilder.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sparkybe-onap-service') diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilder.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilder.java index c833bd3..dd14db8 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilder.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/VnfSearchQueryBuilder.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * Copyright © 2017-2018 Amdocs + * Copyright © 2019 IBM * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,8 +103,8 @@ public class VnfSearchQueryBuilder { JsonObjectBuilder queryBlobBuilder = Json.createObjectBuilder(); JsonObjectBuilder aggsBlobBuilder = Json.createObjectBuilder(); JsonArrayBuilder mustBlobBuilder = Json.createArrayBuilder(); - for (String key : attributes.keySet()) { - mustBlobBuilder.add(getTermBlob(key, attributes.get(key))); + for (Map.Entry entry : attributes.entrySet()) { + mustBlobBuilder.add(getTermBlob(entry.getKey(), entry.getValue())); } JsonArray mustBlob = mustBlobBuilder.build(); @@ -127,8 +128,8 @@ public class VnfSearchQueryBuilder { public static void buildMultiTermCountQuery(JsonObjectBuilder jsonBuilder, Map attributes) { JsonArrayBuilder mustBlobBuilder = Json.createArrayBuilder(); - for (String key : attributes.keySet()) { - mustBlobBuilder.add(getTermBlob(key, attributes.get(key))); + for (Map.Entry entry : attributes.entrySet()) { + mustBlobBuilder.add(getTermBlob(entry.getKey(), entry.getValue())); } jsonBuilder.add("query", Json.createObjectBuilder().add("bool", Json.createObjectBuilder().add("must", mustBlobBuilder))); -- cgit 1.2.3-korg