aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-06-07 10:19:23 +0200
committerRobert Bogacki <r.bogacki@samsung.com>2019-06-10 06:27:20 +0000
commit9a1bd11106c62fbc6efdd7d46cb759fc60056ee9 (patch)
tree7ca8409f84d495b632c43efc2e90f89aa841a0b2 /bpmn/so-bpmn-infrastructure-common
parentbb271cc82880d15dc9396170ac6ed95de22958a3 (diff)
Improvements in JsonUtilForPnfCorrelationId
General fixes and improvements according to the Sonar analysis -Added private constructor for a utility class. -Refactored lambda expression. Issue-ID: SO-1992 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com> Change-Id: Ife8cfdf9c341dc89a1699fd616ec68cba734a5d5
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index 7cb78a10e5..8010ce62ab 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2018 Nokia.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,15 +36,18 @@ public final class JsonUtilForPnfCorrelationId {
private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "correlationId";
+ private JsonUtilForPnfCorrelationId() {
+ throw new IllegalStateException("Utility class");
+ }
+
static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
JsonElement je = new JsonParser().parse(json);
JsonArray array = je.getAsJsonArray();
List<String> list = new ArrayList<>();
Spliterator<JsonElement> spliterator = array.spliterator();
- spliterator.forEachRemaining(jsonElement -> {
- handleEscapedCharacters(jsonElement).ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
- .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
- });
+ spliterator.forEachRemaining(jsonElement -> handleEscapedCharacters(jsonElement)
+ .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
+ .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId))));
return list;
}