diff options
3 files changed, 15 insertions, 12 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index f23e5cdb5a..5c69987a54 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; import javax.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; @@ -210,23 +211,25 @@ public class VnfAdapterVfModuleObjectMapper { protected void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive, Map<String, Object> srcMap) throws MissingValueTagException { StringBuilder directives = new StringBuilder(); - int no_directives_size = 0; + int noOfDirectivesSize = 0; if (directive.equals(MsoMulticloudUtils.USER_DIRECTIVES) && srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) { - no_directives_size = 1; + noOfDirectivesSize = 1; } - if (srcMap.size() > no_directives_size) { + if (srcMap.size() > noOfDirectivesSize) { directives.append("{ \"attributes\": [ "); int i = 0; - for (String attributeName : srcMap.keySet()) { + for (Map.Entry<String, Object> attributeEntry : srcMap.entrySet()) { + String attributeName = attributeEntry.getKey(); + Object attributeValue = attributeEntry.getValue(); if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directive) && attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) { - if (srcMap.get(attributeName) == null) { + if (attributeValue == null) { logger.error("No value tag found for attribute: {}", attributeName); throw new MissingValueTagException("No value tag found for " + attributeName); } - directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString())); - if (i < (srcMap.size() - 1 + no_directives_size)) + directives.append(new AttributeNameValue(attributeName, attributeValue.toString())); + if (i < (srcMap.size() - 1 + noOfDirectivesSize)) directives.append(", "); i++; } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java index 3bd646fada..d15fbf9322 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java @@ -135,7 +135,7 @@ public class CloudifyClient { * @return An object of Class <R> */ public <R> CloudifyRequest<R> get(String path, Class<R> returnType) { - return new CloudifyRequest<R>(this, HttpMethod.GET, path, null, returnType); + return new CloudifyRequest<>(this, HttpMethod.GET, path, null, returnType); } } diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java index df63bd18d3..006768f2f1 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java @@ -37,7 +37,7 @@ public class CloudifyRequest<R> { private StringBuilder path = new StringBuilder(); - private Map<String, List<Object>> headers = new HashMap<String, List<Object>>(); + private Map<String, List<Object>> headers = new HashMap<>(); private Entity<?> entity; @@ -100,7 +100,7 @@ public class CloudifyRequest<R> { } public <T> Entity<T> entity(T entity, String contentType) { - return new Entity<T>(entity, contentType); + return new Entity<>(entity, contentType); } public Entity<?> entity() { @@ -160,7 +160,7 @@ public class CloudifyRequest<R> { + headers + ", entity=" + entity + ", returnType=" + returnType + "]"; } - private Map<String, List<Object>> queryParams = new LinkedHashMap<String, List<Object>>(); + private Map<String, List<Object>> queryParams = new LinkedHashMap<>(); public Map<String, List<Object>> queryParams() { return queryParams; @@ -171,7 +171,7 @@ public class CloudifyRequest<R> { List<Object> values = queryParams.get(key); values.add(value); } else { - List<Object> values = new ArrayList<Object>(); + List<Object> values = new ArrayList<>(); values.add(value); queryParams.put(key, values); } |