AT&T 1712 and 1802 release code
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / openecomp / mso / bpmn / common / scripts / AbstractServiceTaskProcessor.groovy
index 32925f0..d3f3696 100644 (file)
@@ -23,7 +23,7 @@ package org.openecomp.mso.bpmn.common.scripts;
 import groovy.json.JsonSlurper\r
 \r
 import org.camunda.bpm.engine.delegate.BpmnError\r
-import org.camunda.bpm.engine.runtime.Execution\r
+import org.camunda.bpm.engine.delegate.DelegateExecution\r
 import org.camunda.bpm.engine.variable.VariableMap\r
 import org.camunda.bpm.engine.variable.Variables\r
 import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats\r
@@ -126,7 +126,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * Logs a WorkflowException at the ERROR level with the specified message.\r
         * @param execution the execution\r
         */\r
-       public void logWorkflowException(Execution execution, String message) {\r
+       public void logWorkflowException(DelegateExecution execution, String message) {\r
                def workflowException = execution.getVariable("WorkflowException")\r
 \r
                if (workflowException == null) {\r
@@ -143,7 +143,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * @param execution the execution\r
         * @return the name of the destination variable\r
         */\r
-       public saveWorkflowException(Execution execution, String variable) {\r
+       public saveWorkflowException(DelegateExecution execution, String variable) {\r
                if (variable == null) {\r
                        throw new NullPointerException();\r
                }\r
@@ -164,7 +164,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * @param execution the execution\r
         * @return the validated request\r
         */\r
-       public String validateRequest(Execution execution, String... requiredVariables) {\r
+       public String validateRequest(DelegateExecution execution, String... requiredVariables) {\r
                ExceptionUtil exceptionUtil = new ExceptionUtil()\r
                def method = getClass().getSimpleName() + '.validateRequest(' +\r
                        'execution=' + execution.getId() +\r
@@ -252,7 +252,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * @param execution the execution\r
         * @return the inputVars\r
         */\r
-       public Map validateJSONReq(Execution execution) {\r
+       public Map validateJSONReq(DelegateExecution execution) {\r
                def method = getClass().getSimpleName() + '.validateJSONReq(' +\r
                                'execution=' + execution.getId() +\r
                                ')'\r
@@ -303,7 +303,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         *         top-level process\r
         * @throws IllegalStateException if a response has already been sent\r
         */\r
-       protected void sendWorkflowResponse(Execution execution, Object responseCode, String response) {\r
+       protected void sendWorkflowResponse(DelegateExecution execution, Object responseCode, String response) {\r
                def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
                try {\r
                        String processKey = getProcessKey(execution);\r
@@ -376,7 +376,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * Returns true if a workflow response has already been sent.\r
         * @param execution the execution\r
         */\r
-       protected boolean isWorkflowResponseSent(Execution execution) {\r
+       protected boolean isWorkflowResponseSent(DelegateExecution execution) {\r
                def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
                String processKey = getProcessKey(execution);\r
                return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true");\r
@@ -388,7 +388,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * \r
         * @param execution the execution\r
         */\r
-       public String getProcessKey(Execution execution) {\r
+       public String getProcessKey(DelegateExecution execution) {\r
                def testKey = execution.getVariable("testProcessKey")\r
                if(testKey!=null){\r
                        return testKey\r
@@ -402,11 +402,11 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * top-level process.\r
         * @param execution the execution\r
         */\r
-       public String getMainProcessKey(Execution execution) {\r
-               Execution exec = execution\r
+       public String getMainProcessKey(DelegateExecution execution) {\r
+               DelegateExecution exec = execution\r
 \r
                while (true) {\r
-                       Execution parent = exec.getSuperExecution()\r
+                       DelegateExecution parent = exec.getSuperExecution()\r
 \r
                        if (parent == null) {\r
                                parent = exec.getParent()\r
@@ -433,7 +433,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * @param elementName Name of element to search for.\r
         * @return The element node, if found in the xml.\r
         */\r
-       protected String getRequiredNodeXml(Execution execution, String xml, String elementName) {\r
+       protected String getRequiredNodeXml(DelegateExecution execution, String xml, String elementName) {\r
                ExceptionUtil exceptionUtil = new ExceptionUtil()\r
                def element = utils.getNodeXml(xml, elementName, false)\r
                if (element.trim().isEmpty()) {\r
@@ -455,7 +455,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * @param elementName Name of element to whose value to get.\r
         * @return The non-empty value of the element, if found in the xml.\r
         */\r
-       protected String getRequiredNodeText(Execution execution, String xml, String elementName) {\r
+       protected String getRequiredNodeText(DelegateExecution execution, String xml, String elementName) {\r
                ExceptionUtil exceptionUtil = new ExceptionUtil()\r
                def elementText = utils.getNodeText1(xml, elementName)\r
                if ((elementText == null) || (elementText.isEmpty())) {\r
@@ -501,7 +501,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
        *@param name\r
        *@param value\r
        */\r
-       public void setVariable(Execution execution, String name, Object value) {\r
+       public void setVariable(DelegateExecution execution, String name, Object value) {\r
                VariableMap variables = Variables.createVariables()\r
                variables.putValueTyped('payload', Variables.objectValue(value)\r
                .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value\r
@@ -517,7 +517,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
        *@param name\r
        *@return\r
        **/\r
-       public String getVariable(Execution execution, String name) {\r
+       public String getVariable(DelegateExecution execution, String name) {\r
                def myObj = execution.getVariable(name)\r
                if(myObj instanceof VariableMap){\r
                        VariableMap serializedObjectMap = (VariableMap) myObj\r
@@ -571,7 +571,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * Sets flows success indicator variable.\r
         *\r
         */\r
-       public void setSuccessIndicator(Execution execution, boolean isSuccess) {\r
+       public void setSuccessIndicator(DelegateExecution execution, boolean isSuccess) {\r
                String prefix = execution.getVariable('prefix')\r
                def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
 \r
@@ -584,7 +584,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * Sends a Error Sync Response\r
         *\r
         */\r
-       public void sendSyncError(Execution execution) {\r
+       public void sendSyncError(DelegateExecution execution) {\r
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
                String requestId = execution.getVariable("mso-request-id")\r
                logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)\r
@@ -605,7 +605,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
                if (args != null && args.size() > 0) {\r
 \r
                        // First argument of method to call is always the execution object\r
-                       Execution execution = (Execution) args[0]\r
+                       DelegateExecution execution = (DelegateExecution) args[0]\r
 \r
                        def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'\r
                        def isDebugEnabled =  execution.getVariable('isDebugLogEnabled')\r
@@ -693,7 +693,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse)\r
         * @param correlator the correlator value (e.g. a request ID)\r
         */\r
-       public String createCallbackURL(Execution execution, String messageType, String correlator) {\r
+       public String createCallbackURL(DelegateExecution execution, String messageType, String correlator) {\r
                String endpoint = (String) execution.getVariable('URN_mso_workflow_message_endpoint')\r
 \r
                if (endpoint == null || endpoint.isEmpty()) {\r
@@ -719,7 +719,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
         * @param messageType the message type (e.g. SNIROResponse)\r
         * @param correlator the correlator value (e.g. a request ID)\r
         */\r
-       public String createWorkflowMessageAdapterCallbackURL(Execution execution, String messageType, String correlator) {\r
+       public String createWorkflowMessageAdapterCallbackURL(DelegateExecution execution, String messageType, String correlator) {\r
                String endpoint = (String) execution.getVariable('URN_mso_adapters_workflow_message_endpoint')\r
 \r
                if (endpoint == null || endpoint.isEmpty()) {\r
@@ -737,7 +737,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
                        '/' + UriUtils.encodePathSegment(correlator, 'UTF-8')\r
        }\r
        \r
-       public void setRollbackEnabled(Execution execution, isDebugLogEnabled) {\r
+       public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) {\r
                \r
                // Rollback settings\r
                def prefix = execution.getVariable('prefix')\r
@@ -771,7 +771,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
                logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)\r
        }\r
        \r
-       public void setBasicDBAuthHeader(Execution execution, isDebugLogEnabled) {\r
+       public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {\r
                try {\r
                        String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")\r
                        utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)\r