summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorkaty.rotman <katy.rotman@amdocs.com>2018-05-24 14:09:26 +0300
committerOren Kleks <orenkle@amdocs.com>2018-05-28 08:15:19 +0000
commit6c72be9effaeff9f2b6dbc843b2d4d1ec1b60b1b (patch)
treec12f52038556398175f7a4ee64a821aa44659644 /catalog-be/src/main/java
parentd981ef67e956f1e5a28ca77f2841f49e468c5b1b (diff)
fixing sonar violations
Issue-ID: SDC-1363 Change-Id: I29b8df69d49d6ca0ba953b362f7574213e931183 Signed-off-by: katy.rotman <katy.rotman@amdocs.com>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
index 5a8aa7e1d5..8c9c63af03 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java
@@ -47,12 +47,15 @@ public class InterfacesOperationsToscaUtil {
private static final String OPERATIONS_KEY = "operations";
private static final String DEFAULT = "default";
- private static final String _DEFAULT = "_default";
+ private static final String DEFAULT_HAS_UNDERSCORE = "_default";
private static final String DOT = ".";
private static final String DEFAULT_INPUT_TYPE = "string";
private static final String SELF = "SELF";
private static final String GET_PROPERTY = "get_property";
- public static final String DEFAULTP = "defaultp";
+ private static final String DEFAULTP = "defaultp";
+
+ private InterfacesOperationsToscaUtil() {
+ }
/**
* Creates the interface_types element
@@ -67,7 +70,7 @@ public class InterfacesOperationsToscaUtil {
}
final Map<String, InterfaceDefinition> interfaces = ((Resource) component).getInterfaces();
- if ( MapUtils.isEmpty(interfaces)) {
+ if (MapUtils.isEmpty(interfaces)) {
return null;
}
@@ -78,8 +81,8 @@ public class InterfacesOperationsToscaUtil {
final Map<String, OperationDataDefinition> operations = interfaceDefinition.getOperations();
Map<String, Object> toscaOperations = new HashMap<>();
- for (String operationId : operations.keySet()) {
- toscaOperations.put(operations.get(operationId).getName(),
+ for (Map.Entry<String, OperationDataDefinition> operationEntry : operations.entrySet()) {
+ toscaOperations.put(operationEntry.getValue().getName(),
null); //currently not initializing any of the operations' fields as it is not needed
}
@@ -108,7 +111,7 @@ public class InterfacesOperationsToscaUtil {
}
final Map<String, InterfaceDefinition> interfaces = ((Resource) component).getInterfaces();
- if ( MapUtils.isEmpty(interfaces)) {
+ if (MapUtils.isEmpty(interfaces)) {
return;
}
for (InterfaceDefinition interfaceDefinition : interfaces.values()) {
@@ -150,23 +153,21 @@ public class InterfacesOperationsToscaUtil {
* @param operationsMap the map to update
*/
private static void handleDefaults(Map<String, Object> operationsMap) {
- for (String key : operationsMap.keySet()) {
- Object value = operationsMap.get(key);
+ for (Map.Entry<String, Object> operationEntry : operationsMap.entrySet()) {
+ final Object value = operationEntry.getValue();
if (value instanceof Map) {
handleDefaults((Map<String, Object>) value);
}
+ final String key = operationEntry.getKey();
if (key.equals(DEFAULTP)) {
Object removed = operationsMap.remove(key);
operationsMap.put(DEFAULT, removed);
}
}
-
-
}
private static String getLastPartOfName(String toscaResourceName) {
return toscaResourceName.substring(toscaResourceName.lastIndexOf(DOT) + 1);
-
}
private static boolean isArtifactPresent(Map.Entry<String, OperationDataDefinition> operationEntry) {
@@ -215,9 +216,8 @@ public class InterfacesOperationsToscaUtil {
if (objectAsMap.containsKey(DEFAULT)) {
Object defaultValue = objectAsMap.get(DEFAULT);
objectAsMap.remove(DEFAULT);
- objectAsMap.put(_DEFAULT, defaultValue);
+ objectAsMap.put(DEFAULT_HAS_UNDERSCORE, defaultValue);
}
return objectAsMap;
}
-
}