From 36edf1a3688ab064918a8be2edff758130795205 Mon Sep 17 00:00:00 2001 From: Munir Ahmad Date: Wed, 7 Mar 2018 19:21:48 -0500 Subject: Swap StringBuilder with string where makes sense Change-Id: I3faaa90d97e936b0d86282db5958e1048460ee81 Issue-ID: SO-437 Signed-off-by: Munir Ahmad --- .../mso/asdc/util/ASDCNotificationLogging.java | 111 ++++----------------- 1 file changed, 20 insertions(+), 91 deletions(-) (limited to 'asdc-controller') 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(); } -- cgit 1.2.3-korg