@ SuppressWarnings ( "rawtypes" ) public static Map < String , Object > prepareVariables ( Exchange exchange , Map < String , Object > parameters ) { Map < String , Object > processVariables = new HashMap < String , Object > ( ) ; Object camelBody = exchange . getIn ( ) . getBody ( ) ; if ( camelBody instanceof String ) { // If the COPY_MESSAGE_BODY_AS_PROCESS_VARIABLE_PARAMETER was passed // the value of it // is taken as variable to store the (string) body in String processVariableName = "camelBody" ; if ( parameters . containsKey ( CamundaBpmConstants . COPY_MESSAGE_BODY_AS_PROCESS_VARIABLE_PARAMETER ) ) { processVariableName = ( String ) parameters . get ( CamundaBpmConstants . COPY_MESSAGE_BODY_AS_PROCESS_VARIABLE_PARAMETER ) ; } processVariables . put ( processVariableName , camelBody ) ; } else if ( camelBody instanceof Map < ? , ? > ) { Map < ? , ? > camelBodyMap = ( Map < ? , ? > ) camelBody ; for ( Map . Entry e : camelBodyMap . entrySet ( ) ) { if ( e . getKey ( ) instanceof String ) { processVariables . put ( ( String ) e . getKey ( ) , e . getValue ( ) ) ; } } } else if ( camelBody != null ) { log . log ( Level . WARNING , "unkown type of camel body - not handed over to process engine: " + camelBody . getClass ( ) ) ; } return processVariables ; }
Copies variables from Camel into the process engine .