aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMunir Ahmad <munir.ahmad@bell.ca>2018-03-07 19:21:48 -0500
committerMunir Ahmad <munir.ahmad@bell.ca>2018-03-08 02:08:00 +0000
commit36edf1a3688ab064918a8be2edff758130795205 (patch)
tree60495d93fd3e29d90aa856d200bc69b8a6feb2fa
parentbcfb7e24ab050bd530e9aa2c9557386a4b9f82f5 (diff)
Swap StringBuilder with string where makes sense
Change-Id: I3faaa90d97e936b0d86282db5958e1048460ee81 Issue-ID: SO-437 Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java111
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java12
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java7
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java6
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java26
5 files changed, 37 insertions, 125 deletions
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
index 2080be137c..396784add4 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
@@ -42,51 +42,15 @@ public class ASDCNotificationLogging {
if (asdcNotification == null) {
return "NULL";
}
- StringBuilder buffer = new StringBuilder("ASDC Notification:");
- buffer.append(System.lineSeparator());
-
- buffer.append("DistributionID:");
- buffer.append(testNull(asdcNotification.getDistributionID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceName:");
- buffer.append(testNull(asdcNotification.getServiceName()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceVersion:");
- buffer.append(testNull(asdcNotification.getServiceVersion()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceUUID:");
- buffer.append(testNull(asdcNotification.getServiceUUID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceInvariantUUID:");
- buffer.append(testNull(asdcNotification.getServiceInvariantUUID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceDescription:");
- buffer.append(testNull(asdcNotification.getServiceDescription()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("Service Artifacts List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())));
- buffer.append(System.lineSeparator());
-
- buffer.append("Resource Instances List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpASDCResourcesList(asdcNotification)));
- buffer.append(System.lineSeparator());
-
-
- return buffer.toString();
+ return "ASDC Notification:" + System.lineSeparator() +
+ "DistributionID:" + testNull(asdcNotification.getDistributionID()) + System.lineSeparator() +
+ "ServiceName:" + testNull(asdcNotification.getServiceName()) + System.lineSeparator() +
+ "ServiceVersion:" + testNull(asdcNotification.getServiceVersion()) + System.lineSeparator() +
+ "ServiceUUID:" + testNull(asdcNotification.getServiceUUID()) + System.lineSeparator() +
+ "ServiceInvariantUUID:" + testNull(asdcNotification.getServiceInvariantUUID()) + System.lineSeparator() +
+ "ServiceDescription:" + testNull(asdcNotification.getServiceDescription()) + System.lineSeparator() +
+ "Service Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())) + System.lineSeparator() +
+ "Resource Instances List:" + System.lineSeparator() + testNull(dumpASDCResourcesList(asdcNotification)) + System.lineSeparator();
}
public static String dumpCSARNotification(INotificationData asdcNotification, ToscaResourceStructure toscaResourceStructure) {
@@ -418,52 +382,17 @@ public class ASDCNotificationLogging {
return null;
}
- StringBuilder buffer = new StringBuilder("Resource Instance Info:");
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceInstanceName:");
- buffer.append(testNull(resourceInstance.getResourceInstanceName()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceCustomizationUUID:");
- buffer.append(testNull(resourceInstance.getResourceCustomizationUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceInvariantUUID:");
- buffer.append(testNull(resourceInstance.getResourceInvariantUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceName:");
- buffer.append(testNull(resourceInstance.getResourceName()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceType:");
- buffer.append(testNull(resourceInstance.getResourceType()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceUUID:");
- buffer.append(testNull(resourceInstance.getResourceUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceVersion:");
- buffer.append(testNull(resourceInstance.getResourceVersion()));
- buffer.append(System.lineSeparator());
-
- buffer.append("Category:");
- buffer.append(testNull(resourceInstance.getCategory()));
- buffer.append(System.lineSeparator());
-
- buffer.append("SubCategory:");
- buffer.append(testNull(resourceInstance.getSubcategory()));
- buffer.append(System.lineSeparator());
-
- buffer.append("Resource Artifacts List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())));
- buffer.append(System.lineSeparator());
-
- return buffer.toString();
-
+ return "Resource Instance Info:" + System.lineSeparator() +
+ "ResourceInstanceName:" + testNull(resourceInstance.getResourceInstanceName()) + System.lineSeparator() +
+ "ResourceCustomizationUUID:" + testNull(resourceInstance.getResourceCustomizationUUID()) + System.lineSeparator() +
+ "ResourceInvariantUUID:" + testNull(resourceInstance.getResourceInvariantUUID()) + System.lineSeparator() +
+ "ResourceName:" + testNull(resourceInstance.getResourceName()) + System.lineSeparator() +
+ "ResourceType:" + testNull(resourceInstance.getResourceType()) + System.lineSeparator() +
+ "ResourceUUID:" + testNull(resourceInstance.getResourceUUID()) + System.lineSeparator() +
+ "ResourceVersion:" + testNull(resourceInstance.getResourceVersion()) + System.lineSeparator() +
+ "Category:" + testNull(resourceInstance.getCategory()) + System.lineSeparator() +
+ "SubCategory:" + testNull(resourceInstance.getSubcategory()) + System.lineSeparator() +
+ "Resource Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())) + System.lineSeparator();
}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
index 8da155fe08..ec0b54a14f 100644
--- a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
+++ b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
@@ -159,15 +159,9 @@ public class MsoJsonProperties extends AbstractMsoProperties {
@Override
public String toString() {
- StringBuilder response = new StringBuilder();
- response.append("Config file ").append(propertiesFileName).append("(Timer:").append(automaticRefreshInMinutes)
- .append("mins):").append(System.getProperty("line.separator"));
- response.append(this.jsonRootNode.toString());
- response.append(System.getProperty("line.separator"));
- response.append(System.getProperty("line.separator"));
- return response.toString();
-
+ return "Config file " + propertiesFileName + "(Timer:" + automaticRefreshInMinutes + "mins):" + System
+ .getProperty("line.separator") + this.jsonRootNode.toString() + System.getProperty("line.separator")
+ + System.getProperty("line.separator");
}
-
}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
index c556ddadb5..cf8ef47554 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
@@ -1175,14 +1175,11 @@ public class CatalogDatabase implements Closeable {
* @return VnfRecipe object or null if none found
*/
public VnfRecipe getVnfRecipeByNameVersion(String modelName, String modelVersion, String action) {
- StringBuilder hql = new StringBuilder("FROM VnfRecipe WHERE vnfType = :vnfType AND version= :version AND action = :action ");
long startTime = System.currentTimeMillis();
- LOGGER.debug("Catalog database - get VNF recipe with name " + modelName
- + " and action "
- + action);
+ LOGGER.debug("Catalog database - get VNF recipe with name " + modelName + " and action " + action);
- Query query = getSession().createQuery(hql.toString());
+ Query query = getSession().createQuery("FROM VnfRecipe WHERE vnfType = :vnfType AND version= :version AND action = :action ");
query.setParameter(VNF_TYPE, modelName);
query.setParameter(MODEL_VERSION, modelVersion);
query.setParameter(ACTION, action);
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
index b4c1f0594f..e22d1eb036 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
@@ -37,10 +37,6 @@ public class ArRecipe extends Recipe implements Serializable {
@Override
public String toString () {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append(",modelName=").append(modelName);
- sb.append(",arParamXSD=").append(getParamXSD());
- return sb.toString();
+ return super.toString() + ",modelName=" + modelName + ",arParamXSD=" + getParamXSD();
}
}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java
index b211dbd4c3..cb5bf64b8c 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java
@@ -179,21 +179,17 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("VnfResourceCustomization: ");
- sb.append("ModelCustUuid=").append(this.modelCustomizationUuid);
- sb.append(", ModelInstanceName=").append(this.modelInstanceName);
- sb.append(", vnfResourceModelUuid=").append(this.vnfResourceModelUUID);
- sb.append(", creationTimestamp=").append(this.created);
- sb.append(", minInstances=").append(this.minInstances);
- sb.append(", maxInstances=").append(this.maxInstances);
- sb.append(", availabilityZoneMaxCount=").append(this.availabilityZoneMaxCount);
-// sb.append(", vnfResource:\n" + this.vnfResource == null ? "null" : this.vnfResource.toString());
- sb.append(", nfFunction=").append(this.nfFunction);
- sb.append(", nfType=").append(this.nfType);
- sb.append(", nfRole=").append(this.nfRole);
- sb.append(", nfNamingCode=").append(this.nfNamingCode);
-
- return sb.toString();
+ return "VnfResourceCustomization: " + "ModelCustUuid=" + this.modelCustomizationUuid +
+ ", ModelInstanceName=" + this.modelInstanceName +
+ ", vnfResourceModelUuid=" + this.vnfResourceModelUUID +
+ ", creationTimestamp=" + this.created +
+ ", minInstances=" + this.minInstances +
+ ", maxInstances=" + this.maxInstances +
+ ", availabilityZoneMaxCount=" + this.availabilityZoneMaxCount +
+ ", nfFunction=" + this.nfFunction +
+ ", nfType=" + this.nfType +
+ ", nfRole=" + this.nfRole +
+ ", nfNamingCode=" + this.nfNamingCode;
}
}