summaryrefslogtreecommitdiffstats
path: root/sparkybe-onap-service/src/main
diff options
context:
space:
mode:
authorPawel <pawel.kasperkiewicz@nokia.com>2018-04-20 13:43:06 +0200
committerJames Forsyth <jf2512@att.com>2018-05-23 20:18:59 +0000
commit6bbcdab2b14a179524db0efb34fb2f90d88b266e (patch)
treeb282c9a3370ef17570ee12a6f8ac3da940068367 /sparkybe-onap-service/src/main
parentc01d79c6605f11b29d65f6f7fa6a909554df5e2b (diff)
fixes in AggregateSummaryProcessor.java
Issue-ID: AAI-1048 Change-Id: I3cc8be604b41b48c4a881c1b6b816f2a7b97abaa Signed-off-by: Pawel <pawel.kasperkiewicz@nokia.com>
Diffstat (limited to 'sparkybe-onap-service/src/main')
-rw-r--r--sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/AggregateSummaryProcessor.java23
1 files changed, 10 insertions, 13 deletions
diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/AggregateSummaryProcessor.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/AggregateSummaryProcessor.java
index 949c369..24ba725 100644
--- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/AggregateSummaryProcessor.java
+++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregatevnf/search/AggregateSummaryProcessor.java
@@ -47,6 +47,10 @@ public class AggregateSummaryProcessor {
LoggerFactory.getInstance().getLogger(AggregateSummaryProcessor.class);
private static final String KEY_FILTERS = "filters";
+ private static final String FILTER_ID_KEY = "filterId";
+ private static final String FILTER_VALUE_KEY = "filterValue";
+ private static final String TOTAL = "total";
+ private static final int DEFAULT_SHOULD_MATCH_SCORE = 1;
private ElasticSearchAdapter elasticSearchAdapter = null;
@@ -99,7 +103,7 @@ public class AggregateSummaryProcessor {
}
if (requestFilters != null && requestFilters.length() > 0) {
- List<JSONObject> filtersToQuery = new ArrayList<JSONObject>();
+ List<JSONObject> filtersToQuery = new ArrayList<>();
for (int i = 0; i < requestFilters.length(); i++) {
JSONObject filterEntry = requestFilters.getJSONObject(i);
filtersToQuery.add(filterEntry);
@@ -122,7 +126,6 @@ public class AggregateSummaryProcessor {
LOG.error(AaiUiMsgs.ERROR_GENERIC,
"AggregateSummaryProcessor failed to process request due to error = " + exc.getMessage());
-
}
}
@@ -136,15 +139,9 @@ public class AggregateSummaryProcessor {
return payload.toString();
}
- private static final String FILTER_ID_KEY = "filterId";
- private static final String FILTER_VALUE_KEY = "filterValue";
- private static final int DEFAULT_SHOULD_MATCH_SCORE = 1;
- private static final String VNF_FILTER_AGGREGATION = "vnfFilterAggregation";
-
-
- private String getVnfFilterAggregations(List<JSONObject> filtersToQuery) throws IOException {
+ private String getVnfFilterAggregations(List<JSONObject> filtersToQuery) {
- List<SearchFilter> searchFilters = new ArrayList<SearchFilter>();
+ List<SearchFilter> searchFilters = new ArrayList<>();
for (JSONObject filterEntry : filtersToQuery) {
String filterId = filterEntry.getString(FILTER_ID_KEY);
@@ -180,7 +177,7 @@ public class AggregateSummaryProcessor {
private String buildEmptyAggregateVnfResponseJson() {
JSONObject finalOutputToFe = new JSONObject();
- finalOutputToFe.put("total", 0);
+ finalOutputToFe.put(TOTAL, 0);
return finalOutputToFe.toString();
}
@@ -191,8 +188,8 @@ public class AggregateSummaryProcessor {
JSONObject hits = responseJson.getJSONObject("hits");
- int totalHits = hits.getInt("total");
- finalOutputToFe.put("total", totalHits);
+ int totalHits = hits.getInt(TOTAL);
+ finalOutputToFe.put(TOTAL, totalHits);
JSONObject aggregations = responseJson.getJSONObject("aggregations");
String[] aggKeys = JSONObject.getNames(aggregations);