summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-06-06 08:48:21 +0200
committerr.bogacki <r.bogacki@samsung.com>2019-06-06 08:48:58 +0200
commite3cb4cce8a4a67059063987b644441e4d41dba19 (patch)
treecb3b689574f4d29d966922dcd6822a6acae9680d /bpmn/MSOCoreBPMN/src
parent5f4c4f3f3215eb136f9c4f84f51dc8fcd5fe0353 (diff)
Improvements in ServiceDecomposition
Improvements in ServiceDecomposition according to the Sonar analysis. -Fixed imports. -Replaced System.out with logger. -Simplified if statements. -Removed unused code. Issue-ID: SO-1997 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com> Change-Id: If7c399635fffef5bc75b10c7d93be4b27e097bd7
Diffstat (limited to 'bpmn/MSOCoreBPMN/src')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index b3439d58e3..3632d187c9 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
@@ -24,7 +26,6 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -32,6 +33,8 @@ import com.fasterxml.jackson.annotation.JsonRootName;
import org.json.JSONObject;
import org.onap.so.bpmn.core.json.DecomposeJsonUtil;
import org.onap.so.bpmn.core.json.JsonDecomposingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@@ -41,10 +44,10 @@ import org.onap.so.bpmn.core.json.JsonDecomposingException;
* resource's decompositon
*/
@JsonRootName(value = "serviceResources")
-// @JsonTypeInfo(include=As.WRAPPER_OBJECT, use=Id.NAME)
public class ServiceDecomposition extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
+ private static final Logger logger = LoggerFactory.getLogger(ServiceDecomposition.class);
@JsonProperty("modelInfo")
private ModelInfo modelInfo;
@@ -315,8 +318,6 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public String getVnfResource(String resourceObjectId) {
for (Resource resource : getServiceResources()) {
- // resource.getModelInfo().getModelInvariantId();
-
if ("extracted information".equals(resourceObjectId)) {
return resource.toJsonString();
}
@@ -457,11 +458,11 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
boolean result = false;
for (Resource resource : (Iterable<Resource>) resources) {
- System.out.println("resource found");
+ logger.debug("resource found");
if (resource.resourceType == newResource.resourceType) {
- System.out.println("resource type matches");
+ logger.debug("resource type matches");
if (resource.getResourceId().equalsIgnoreCase(newResource.getResourceId())) {
- System.out.println("resource id matches");
+ logger.debug("resource id matches");
// returns TRUE if replacement is a success
result = Collections.replaceAll(resources, resource, newResource);
}
@@ -491,14 +492,12 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public boolean deleteResource(Resource resource) {
List serviceResourceList = getResourceList(resource);
for (Resource item : (Iterable<Resource>) serviceResourceList) {
- if (item.resourceType == resource.resourceType) {
- if (item.getResourceId().equalsIgnoreCase(resource.getResourceId())) {
- // returns TRUE if replacement is a success
- return serviceResourceList.remove(resource);
- }
+ if (item.resourceType == resource.resourceType
+ && item.getResourceId().equalsIgnoreCase(resource.getResourceId())) {
+ // returns TRUE if replacement is a success
+ return serviceResourceList.remove(resource);
}
}
-
return false;
}