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
* 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
* @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
* @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
* @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
* 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
* 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
* \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
* 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
* @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
* @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
*@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
*@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
* 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
* 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
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
* @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
* @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
'/' + 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
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