public static void writeProcessInstance(MarshallerWriteContext context,
RuleFlowProcessInstance processInstance) throws IOException {
ObjectOutputStream stream = context.stream;
stream.writeLong( processInstance.getId() );
stream.writeUTF( processInstance.getProcessId() );
stream.writeInt( processInstance.getState() );
stream.writeLong( processInstance.getNodeInstanceCounter() );
VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
Map<String, Object> variables = variableScopeInstance.getVariables();