diff options
Diffstat (limited to 'bpmn/MSOCoreBPMN')
4 files changed, 22 insertions, 31 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..584ccda1ac 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,7 +238,7 @@ 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:Header/>\n"); @@ -270,7 +270,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..b47d73f665 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;
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..fbfe226a30 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); } /** |