summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-04-25 08:07:59 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-04-25 08:07:59 +0200
commit198f189099a0754f6ef53c180f4d6415728828e4 (patch)
treec2f70e0c81cbbf253ca11aa49cc0c05dd71c2d6a /src/main/java/org/onap
parented3d183036a0295a6b5ae9357eead53e16765106 (diff)
sonar clean code
- refactor parse tosca - add test tosca Change-Id: Ib4c92efdab239dad1e6f2c49deadb3027380485c Issue-ID: EXTAPI-46 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
index 34aed18..cfe8d82 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java
@@ -21,6 +21,9 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.apache.commons.collections.CollectionUtils;
@@ -48,9 +51,12 @@ public class ToscaInfosProcessor {
if (toscaInfosTopologyTemplate.get("inputs") != null) {
ArrayList serviceSpecCharacteristic = new ArrayList();
LinkedHashMap toscaInfos = (LinkedHashMap) toscaInfosTopologyTemplate.get("inputs");
- for (Object key : toscaInfos.entrySet()) {
- String keyString = (String) key;
- LinkedHashMap inputParameter = (LinkedHashMap) toscaInfos.get(key);
+ Set<Entry<String, LinkedHashMap>> stringLinkedHashMapEntry = (Set<Entry<String, LinkedHashMap>>) toscaInfos
+ .entrySet();
+
+ for (Map.Entry<String,LinkedHashMap> key :stringLinkedHashMapEntry) {
+ String keyString = key.getKey();
+ LinkedHashMap inputParameter = key.getValue();
LinkedHashMap mapParameter = new LinkedHashMap();
String parameterType = (String) inputParameter.get("type");
mapParameter.put("name", keyString);
@@ -60,7 +66,7 @@ public class ToscaInfosProcessor {
mapParameter.put("required", inputParameter.get("required"));
mapParameter.put("status", inputParameter.get("status"));
List<LinkedHashMap> serviceSpecCharacteristicValues =
- buildServiceSpecCharacteristicsValues(inputParameter, parameterType);
+ buildServiceSpecCharacteristicsValues(inputParameter, parameterType);
mapParameter.put("serviceSpecCharacteristicValue", serviceSpecCharacteristicValues);
serviceSpecCharacteristic.add(mapParameter);
}