* ============LICENSE_END=========================================================
*/
-package com.att.bpm.scripts
+package org.openecomp.mso.bpmn.common.scripts
-import groovy.xml.XmlUtil
-
-import java.text.SimpleDateFormat
-import java.net.URLEncoder
-
-import org.apache.commons.codec.binary.Base64
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.runtime.Execution
-
-import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
import org.openecomp.mso.rest.RESTClient
import org.openecomp.mso.rest.RESTConfig
setSuccessIndicator(execution, false)
try {
- String request = validateRequest(execution, "att-mso-request-id")
+ String request = validateRequest(execution, "mso-request-id")
// Get the request type (the name of the root element) from the request
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
- execution.setVariable(prefix + 'messageId', messageId)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'messageId = ' + messageId, isDebugLogEnabled)
+ execution.setVariable('VNFAResponse_CORRELATOR', messageId)
+ logDebug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId, isDebugLogEnabled)
// Get the notificationUrl from the request
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
- String prefix = execution.getVariable('prefix')
- String callback = execution.getVariable(prefix + 'callback')
+ String callback = execution.getVariable('VNFAResponse_MESSAGE')
try {
logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled)
- Node root = new XmlParser().parseText(callback)
- if (root.name().endsWith('Exception')) {
- vnfAdapterWorkflowException(execution, callback)
- }
-
// The XML callback is available to the calling flow in any case,
- // even if a WorkflowException was generated.
+ // even if a WorkflowException is generated.
execution.setVariable(getProcessKey(execution) + 'Response', callback)
// TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
execution.setVariable("WorkflowResponse", callback)
- } catch(BpmnError b){
- throw b
+
+ Node root = new XmlParser().parseText(callback)
+ if (root.name().endsWith('Exception')) {
+ vnfAdapterWorkflowException(execution, callback)
+ }
} catch (Exception e) {
e.printStackTrace()
callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
String msg = "Received error from VnfAdapter: " + callback
logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, msg)
+ exceptionUtil.buildWorkflowException(execution, 7020, msg)
}
}
message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
String rolledBack = getChildText(root, "rolledBack")
rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Received " + root.name() +
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
" from VnfAdapter:" + category + message + rolledBack);
- }catch(BpmnError b){
- throw b
- }catch (Exception e) {
+ } catch (Exception e) {
response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
}
}