import static org.apache.commons.lang3.StringUtils.*
+import com.google.common.xml.XmlEscapers
+
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
/**
* @param execution the execution
* @param response the aai exception
*/
- WorkflowException MapAAIExceptionToWorkflowException(String response, Execution execution)
+ WorkflowException MapAAIExceptionToWorkflowException(String response, DelegateExecution execution)
{
def utils=new MsoUtils()
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
* @param execution the execution
* @param response the aai exception
*/
- WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(Execution execution, String response, int resCode){
+ WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(DelegateExecution execution, String response, int resCode){
def utils=new MsoUtils()
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", "Start MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled)
String buildErrorResponseXml(WorkflowException wfex) {
String xml
if(wfex != null){
- String mes = wfex.getErrorMessage()
+ String mes = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage())
int code = wfex.getErrorCode()
xml =
"""<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
errorMessage=""
}
if( errorCode.equals('5010')){
- return 'Could not communicate with A&AI'
+ return 'Could not communicate with A&AI'
}else if (errorCode.equals('5020')){
- return 'No response from A&AI'
+ return 'No response from A&AI'
}else{
- errorMessage = errorMessage.replace("&", "&").replace("<", "<").replace(">", ">")
- return 'Received error from A&AI (' +errorMessage +')'
+ return 'Received error from A&AI (' +errorMessage +')'
}
}
* @param errorCode the error code
* @param errorMessage the error message
*/
- public void buildWorkflowException(Execution execution, int errorCode, String errorMessage) {
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
MsoUtils utils = new MsoUtils()
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String processKey = getProcessKey(execution);
* @param errorCode the error code
* @param errorMessage the error message
*/
- public void buildAndThrowWorkflowException(Execution execution, int errorCode, String errorMessage) {
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String processKey = getProcessKey(execution);
utils.log("Building a WorkflowException for Subflow " + processKey, isDebugLogEnabled)
* @param - execution
*
*/
- public void processSubflowsBPMNException(Execution execution){
+ public void processSubflowsBPMNException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String processKey = getProcessKey(execution)
try{
* @return - falloutHandlerRequest
*
*/
- public String processMainflowsBPMNException(Execution execution, String requestInfo){
+ public String processMainflowsBPMNException(DelegateExecution execution, String requestInfo){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String processKey = getProcessKey(execution)
try{
}
requestInfo = utils.removeXmlPreamble(requestInfo)
WorkflowException wfex = execution.getVariable("WorkflowException")
- String errorMessage = wfex.getErrorMessage()
+ String errorMessage = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage())
int errorCode = wfex.getErrorCode()
String falloutHandlerRequest =
</aetgt:FalloutHandlerRequest>"""
utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
- utils.log("DEBUG", processKey + "Completed ProcessMainflowBPMNException Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled)
+ utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled)
return falloutHandlerRequest
}catch(Exception e){
utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled)
return null
}
+ utils.log("DEBUG", "Completed ProcessMainflowBPMNException Method", isDebugEnabled)
}
/**
* @param - execution
*
*/
- public void processJavaException(Execution execution){
+ public void processJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String processKey = getProcessKey(execution)
try{
}
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
// TODO Auto-generated method stub
}