Revert "Renaming Files having BluePrint to have Blueprint"
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / inbounds / designer-api / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / designer / api / BluePrintManagementGRPCHandler.kt
@@ -22,21 +22,21 @@ import com.google.protobuf.ByteString
 import com.google.protobuf.util.JsonFormat
 import io.grpc.stub.StreamObserver
 import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BlueprintModelHandler
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler
 import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
 import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
 import org.onap.ccsdk.cds.controllerblueprints.common.api.Status
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
 import org.onap.ccsdk.cds.controllerblueprints.core.emptyTONull
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.currentTimestamp
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintBootstrapInput
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintDownloadInput
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementOutput
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementServiceGrpc
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintRemoveInput
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintUploadInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput
 import org.onap.ccsdk.cds.controllerblueprints.management.api.DownloadAction
 import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk
 import org.onap.ccsdk.cds.controllerblueprints.management.api.RemoveAction
@@ -51,18 +51,18 @@ import org.springframework.stereotype.Service
 
 // TODO("Convert to coroutines handler")
 @Service
-open class BlueprintManagementGRPCHandler(
-    private val bluePrintModelHandler: BlueprintModelHandler,
+open class BluePrintManagementGRPCHandler(
+    private val bluePrintModelHandler: BluePrintModelHandler,
     private val errorCatalogService: ErrorCatalogService
 ) :
-    BlueprintManagementServiceGrpc.BlueprintManagementServiceImplBase() {
+    BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
 
-    private val log = LoggerFactory.getLogger(BlueprintManagementGRPCHandler::class.java)
+    private val log = LoggerFactory.getLogger(BluePrintManagementGRPCHandler::class.java)
 
     @PreAuthorize("hasRole('USER')")
     override fun uploadBlueprint(
-        request: BlueprintUploadInput,
-        responseObserver: StreamObserver<BlueprintManagementOutput>
+        request: BluePrintUploadInput,
+        responseObserver: StreamObserver<BluePrintManagementOutput>
     ) {
 
         runBlocking {
@@ -91,7 +91,7 @@ open class BlueprintManagementGRPCHandler(
                             failStatus(
                                 request.commonHeader,
                                 "Upload action($uploadAction) not implemented",
-                                BlueprintProcessorException("Not Implemented")
+                                BluePrintProcessorException("Not Implemented")
                             )
                         )
                     }
@@ -104,7 +104,7 @@ open class BlueprintManagementGRPCHandler(
                             failStatus(
                                 request.commonHeader,
                                 "Upload action($uploadAction) not implemented",
-                                BlueprintProcessorException("Not implemented")
+                                BluePrintProcessorException("Not implemented")
                             )
                         )
                     }
@@ -124,8 +124,8 @@ open class BlueprintManagementGRPCHandler(
 
     @PreAuthorize("hasRole('USER')")
     override fun downloadBlueprint(
-        request: BlueprintDownloadInput,
-        responseObserver: StreamObserver<BlueprintManagementOutput>
+        request: BluePrintDownloadInput,
+        responseObserver: StreamObserver<BluePrintManagementOutput>
     ) {
         runBlocking {
             val blueprintName = request.actionIdentifiers.blueprintName
@@ -148,7 +148,7 @@ open class BlueprintManagementGRPCHandler(
                             failStatus(
                                 request.commonHeader,
                                 "Search action($searchAction) not implemented",
-                                BlueprintProcessorException("Not implemented")
+                                BluePrintProcessorException("Not implemented")
                             )
                         )
                     }
@@ -168,9 +168,9 @@ open class BlueprintManagementGRPCHandler(
 
     @PreAuthorize("hasRole('USER')")
     override fun removeBlueprint(
-        request: BlueprintRemoveInput,
+        request: BluePrintRemoveInput,
         responseObserver:
-            StreamObserver<BlueprintManagementOutput>
+            StreamObserver<BluePrintManagementOutput>
     ) {
 
         runBlocking {
@@ -195,7 +195,7 @@ open class BlueprintManagementGRPCHandler(
                             failStatus(
                                 request.commonHeader,
                                 "Remove action($removeAction) not implemented",
-                                BlueprintProcessorException("Not implemented")
+                                BluePrintProcessorException("Not implemented")
                             )
                         )
                     }
@@ -214,8 +214,8 @@ open class BlueprintManagementGRPCHandler(
     }
 
     override fun bootstrapBlueprint(
-        request: BlueprintBootstrapInput,
-        responseObserver: StreamObserver<BlueprintManagementOutput>
+        request: BluePrintBootstrapInput,
+        responseObserver: StreamObserver<BluePrintManagementOutput>
     ) {
         runBlocking {
             try {
@@ -241,33 +241,33 @@ open class BlueprintManagementGRPCHandler(
         }
     }
 
-    private fun outputWithFileBytes(header: CommonHeader, byteArray: ByteArray): BlueprintManagementOutput =
-        BlueprintManagementOutput.newBuilder()
+    private fun outputWithFileBytes(header: CommonHeader, byteArray: ByteArray): BluePrintManagementOutput =
+        BluePrintManagementOutput.newBuilder()
             .setCommonHeader(header)
             .setFileChunk(FileChunk.newBuilder().setChunk(ByteString.copyFrom(byteArray)))
             .setStatus(
                 Status.newBuilder()
                     .setTimestamp(currentTimestamp())
                     .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
-                    .setMessage(BlueprintConstants.STATUS_SUCCESS)
+                    .setMessage(BluePrintConstants.STATUS_SUCCESS)
                     .setCode(200)
                     .build()
             )
             .build()
 
-    private fun successStatus(header: CommonHeader, propertyContent: String? = null): BlueprintManagementOutput {
+    private fun successStatus(header: CommonHeader, propertyContent: String? = null): BluePrintManagementOutput {
         // Populate Response Payload
-        val propertiesBuilder = BlueprintManagementOutput.newBuilder().propertiesBuilder
+        val propertiesBuilder = BluePrintManagementOutput.newBuilder().propertiesBuilder
         propertyContent?.let {
             JsonFormat.parser().merge(propertyContent, propertiesBuilder)
         }
-        return BlueprintManagementOutput.newBuilder()
+        return BluePrintManagementOutput.newBuilder()
             .setCommonHeader(header)
             .setProperties(propertiesBuilder.build())
             .setStatus(
                 Status.newBuilder()
                     .setTimestamp(currentTimestamp())
-                    .setMessage(BlueprintConstants.STATUS_SUCCESS)
+                    .setMessage(BluePrintConstants.STATUS_SUCCESS)
                     .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
                     .setCode(200)
                     .build()
@@ -275,19 +275,19 @@ open class BlueprintManagementGRPCHandler(
             .build()
     }
 
-    private fun failStatus(header: CommonHeader, message: String, e: Exception): BlueprintManagementOutput {
+    private fun failStatus(header: CommonHeader, message: String, e: Exception): BluePrintManagementOutput {
         log.error(message, e)
-        return if (e is BlueprintProcessorException) onErrorCatalog(header, message, e) else onError(header, message, e)
+        return if (e is BluePrintProcessorException) onErrorCatalog(header, message, e) else onError(header, message, e)
     }
 
-    private fun onError(header: CommonHeader, message: String, error: Exception): BlueprintManagementOutput {
+    private fun onError(header: CommonHeader, message: String, error: Exception): BluePrintManagementOutput {
         val code = GrpcErrorCodes.code(ErrorCatalogCodes.GENERIC_FAILURE)
-        return BlueprintManagementOutput.newBuilder()
+        return BluePrintManagementOutput.newBuilder()
             .setCommonHeader(header)
             .setStatus(
                 Status.newBuilder()
                     .setTimestamp(currentTimestamp())
-                    .setMessage(BlueprintConstants.STATUS_FAILURE)
+                    .setMessage(BluePrintConstants.STATUS_FAILURE)
                     .setEventType(EventType.EVENT_COMPONENT_FAILURE)
                     .setErrorMessage("Error : $message \n Details: ${error.errorMessageOrDefault()}")
                     .setCode(code)
@@ -296,20 +296,20 @@ open class BlueprintManagementGRPCHandler(
             .build()
     }
 
-    private fun onErrorCatalog(header: CommonHeader, message: String, error: BlueprintProcessorException):
-        BlueprintManagementOutput {
+    private fun onErrorCatalog(header: CommonHeader, message: String, error: BluePrintProcessorException):
+        BluePrintManagementOutput {
             val err = if (error.protocol == "") {
                 error.grpc(ErrorCatalogCodes.GENERIC_FAILURE)
             } else {
                 error.convertToGrpc()
             }
             val errorPayload = errorCatalogService.errorPayload(err.addErrorPayloadMessage(message))
-            return BlueprintManagementOutput.newBuilder()
+            return BluePrintManagementOutput.newBuilder()
                 .setCommonHeader(header)
                 .setStatus(
                     Status.newBuilder()
                         .setTimestamp(currentTimestamp())
-                        .setMessage(BlueprintConstants.STATUS_FAILURE)
+                        .setMessage(BluePrintConstants.STATUS_FAILURE)
                         .setEventType(EventType.EVENT_COMPONENT_FAILURE)
                         .setErrorMessage("Error : ${errorPayload.message}")
                         .setCode(errorPayload.code)