Enabling Code Formatter
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / services / workflow-service / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / services / workflow / executor / ComponentExecuteNodeExecutor.kt
index b6e7675..2ff0606 100644 (file)
@@ -31,39 +31,39 @@ import org.slf4j.LoggerFactory
 import org.springframework.stereotype.Service
 
 @Service
-open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService: NodeTemplateExecutionService)
-    ExecuteNodeExecutor() {
+open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService: NodeTemplateExecutionService) :
+    ExecuteNodeExecutor() {
 
     private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
 
     @Throws(SvcLogicException::class)
-    override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext)
-            : SvcLogicNode = runBlocking {
+    override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext):
+        SvcLogicNode = runBlocking {
 
-        var outValue: String
+            var outValue: String
 
-        val ctx = svcLogicContext as BlueprintSvcLogicContext
+            val ctx = svcLogicContext as BlueprintSvcLogicContext
 
-        val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
+            val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
 
-        val executionInput = ctx.getRequest() as ExecutionServiceInput
+            val executionInput = ctx.getRequest() as ExecutionServiceInput
 
-        try {            // Get the Request from the Context and Set to the Function Input and Invoke the function
-            val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(ctx.getBluePrintService(),
-                nodeTemplateName, executionInput)
+            try { // Get the Request from the Context and Set to the Function Input and Invoke the function
+                val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(
+                    ctx.getBluePrintService(),
+                    nodeTemplateName, executionInput
+                )
 
-            ctx.setResponse(executionOutput)
+                ctx.setResponse(executionOutput)
 
-            outValue = executionOutput.status.message
-            ctx.status = executionOutput.status.message
+                outValue = executionOutput.status.message
+                ctx.status = executionOutput.status.message
+            } catch (e: Exception) {
+                log.error("Could not execute plugin($nodeTemplateName) : ", e)
+                outValue = "failure"
+                ctx.status = "failure"
+            }
 
-        } catch (e: Exception) {
-            log.error("Could not execute plugin($nodeTemplateName) : ", e)
-            outValue = "failure"
-            ctx.status = "failure"
+            getNextNode(node, outValue)
         }
-
-        getNextNode(node, outValue)
-    }
-
-}
\ No newline at end of file
+}