aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCoreBPMN')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java7
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java39
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java4
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java12
4 files changed, 27 insertions, 35 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java
index 204d9e4e5e..9c79df85ff 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java
@@ -238,9 +238,10 @@ public class HealthCheckHandler {
BPMNLogger.debug(healthcheckDebugEnabled, "Post url is: " + url);
//now create a soap request message as follows:
- final StringBuffer payload = new StringBuffer();
+ final StringBuilder payload = new StringBuilder();
payload.append("\n");
- payload.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:req=\"" + adapterNamespace + "/requestsdb\">\n");
+ payload.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:req=\"")
+ .append(adapterNamespace).append("/requestsdb\">\n");
payload.append("<soapenv:Header/>\n");
payload.append("<soapenv:Body>\n");
payload.append("<req:getSiteStatus>\n");
@@ -270,7 +271,7 @@ public class HealthCheckHandler {
BufferedReader rd = new BufferedReader(
new InputStreamReader(response.getEntity().getContent()));
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
index 0e985cc8f1..c81e96dccb 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java
@@ -150,7 +150,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
*/
@JsonIgnore
public String getServiceResourcesJsonString(){
- StringBuffer serviceResourcesJsonStringBuffer = new StringBuffer();
+ StringBuilder serviceResourcesJsonStringBuffer = new StringBuilder();
serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceNetworks())));
serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceVnfs())));
serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceAllottedResources())));
@@ -186,15 +186,13 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
@JsonIgnore
public String getVnfResource(String resourceObjectId) {
- Iterator<Resource> iter = getServiceResources().iterator();
- while (iter.hasNext()) {
- Resource resource = iter.next();
- //resource.getModelInfo().getModelInvariantId();
+ for (Resource resource : getServiceResources()) {
+ //resource.getModelInfo().getModelInvariantId();
- if ("extracted information".equals(resourceObjectId)){
- return resource.toJsonString();
- }
- }
+ if ("extracted information".equals(resourceObjectId)) {
+ return resource.toJsonString();
+ }
+ }
return "";
}
@@ -290,13 +288,11 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public boolean replaceResource(Resource newResource){
boolean result = false;
List serviceResources = getServiceResources();
- Iterator<Resource> iter = serviceResources.iterator();
- while (iter.hasNext()) {
- Resource resource = iter.next();
+ for (Resource resource : (Iterable<Resource>) serviceResources) {
System.out.println("resource found");
- if (resource.resourceType == newResource.resourceType){
+ if (resource.resourceType == newResource.resourceType) {
System.out.println("resource type matches");
- if (resource.getResourceId().equalsIgnoreCase(newResource.getResourceId())){
+ if (resource.getResourceId().equalsIgnoreCase(newResource.getResourceId())) {
System.out.println("resource id matches");
//returns TRUE if replacement is a success
result = Collections.replaceAll(serviceResources, resource, newResource);
@@ -326,12 +322,9 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
*/
public boolean deleteResource(Resource resource){
List serviceResources = getServiceResources();
- Iterator<Resource> iter = serviceResources.iterator();
- while (iter.hasNext()) {
- Resource item = iter.next();
-
- if (item.resourceType == resource.resourceType){
- if (item.getResourceId().equalsIgnoreCase(resource.getResourceId())){
+ for (Resource item : (Iterable<Resource>) serviceResources) {
+ if (item.resourceType == resource.resourceType) {
+ if (item.getResourceId().equalsIgnoreCase(resource.getResourceId())) {
//returns TRUE if replacement is a success
return serviceResources.remove(resource);
}
@@ -377,10 +370,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
@JsonIgnore
public Resource getServiceResource(String resourceId){
List<Resource> resources = getServiceResources();
- Iterator<Resource> iter = resources.iterator();
- while (iter.hasNext()){
- Resource resource = iter.next();
- if (resource.getResourceId().equalsIgnoreCase(resourceId)){
+ for (Resource resource : resources) {
+ if (resource.getResourceId().equalsIgnoreCase(resourceId)) {
//match
return resource;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
index 640dc697a2..2612c383ab 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
@@ -122,7 +122,7 @@ public class JsonUtils {
* @return String containing the XML translation
*/
public static String toXMLString(Object obj, String tagName) throws JSONException {
- StringBuffer strBuf = new StringBuffer();
+ StringBuilder strBuf = new StringBuilder();
int i;
JSONArray jsonArr;
JSONObject jsonObj;
@@ -388,7 +388,7 @@ public class JsonUtils {
return 0;
} else {
if (rawValue instanceof Integer) {
- msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + ((String) rawValue).toString());
+ msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + ((String) rawValue));
return (Integer) rawValue;
} else {
msoLogger.debug("getJsonValue(): the raw value is NOT an Integer Object=" + rawValue.toString());
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java
index c2b832812e..f5b9f8dc56 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/xml/XmlTool.java
@@ -64,10 +64,10 @@ public final class XmlTool {
private static final Map<String, Integer> ENTITIES = new HashMap<>();
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.BPEL);
static {
- ENTITIES.put("amp", new Integer(38));
- ENTITIES.put("quot", new Integer(34));
- ENTITIES.put("lt", new Integer(60));
- ENTITIES.put("gt", new Integer(62));
+ ENTITIES.put("amp", 38);
+ ENTITIES.put("quot", 34);
+ ENTITIES.put("lt", 60);
+ ENTITIES.put("gt", 62);
}
/**
@@ -155,7 +155,7 @@ public final class XmlTool {
out.append("&amp;");
modified = true;
} else if (c < 32 || c > 126) {
- out.append("&#" + (int)c + ";");
+ out.append("&#").append((int) c).append(";");
modified = true;
} else {
out.append(c);
@@ -199,7 +199,7 @@ public final class XmlTool {
out.append("&amp;");
modified = true;
} else if (c < 32 || c > 126) {
- out.append("&#" + (int)c + ";");
+ out.append("&#").append((int) c).append(";");
modified = true;
} else {
out.append(c);