@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;
    }
@ 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 ) { 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.

This method will conditionally copy the Camel body to the "camelBody"
variable if it is of type java.lang.String, OR it will copy the Camel
body to individual variables within the process engine if it is of type
Map<String,Object>. If the copyVariablesFromProperties parameter is set
on the endpoint, the properties are copied instead

@param exchange
The Camel Exchange object
@param parameters
@return A Map<String,Object> containing all of the variables to be used
in the process engine