[jboss-svn-commits] JBL Code SVN: r24383 - in labs/jbossrules/branches/mfossati: drools-core/src/main/java/org/drools/marshalling and 16 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Dec 15 13:45:29 EST 2008


Author: mfossati
Date: 2008-12-15 13:45:28 -0500 (Mon, 15 Dec 2008)
New Revision: 24383

Added:
   labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java
   labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshaller.java
   labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java
   labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/RuleFlowProcessInstanceMarshaller.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/orm.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/persistence.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/ComplexProcessTestCase.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/DroolsOSWorkFlowTestCase.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple3ProcessTest.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleDroolsFlowTestCase.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/composite/
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/composite/CompositeWorkflow.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyCondition.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyFunctionProvider.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/suite/
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/suite/SimpleTestSuite.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/CV.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/RDA.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista-orig.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/example.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/holiday2.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/log4j.properties
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simplerf.rf
Modified:
   labs/jbossrules/branches/mfossati/drools-core/.project
   labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
   labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java
   labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/PersisterEnums.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/.classpath
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/DroolsWorkflow.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/xml/OSWorkflowSemanticModule.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleProcessTest.java
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simple.xml
   labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/workflows.xml
   labs/jbossrules/branches/mfossati/drools-process-enterprise/.classpath
   labs/jbossrules/branches/mfossati/drools-process-enterprise/.project
   labs/jbossrules/branches/mfossati/drools-process-enterprise/pom.xml
   labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/java/org/drools/persistence/processinstance/ProcessInstanceInfo.java
   labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/resources/META-INF/persistence.xml
   labs/jbossrules/branches/mfossati/drools-process-enterprise/src/test/resources/META-INF/MyWorkItemHandlers.conf
Log:
First commit, added persistence for osworkflow. Refactored Input/OutputMarshaller to add support to osWorkflow processInstances.  

Modified: labs/jbossrules/branches/mfossati/drools-core/.project
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/.project	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-core/.project	2008-12-15 18:45:28 UTC (rev 24383)
@@ -1,9 +1,7 @@
 <projectDescription>
   <name>drools-core</name>
   <comment>A rule production system</comment>
-  <projects>
-    <project>drools-api</project>
-  </projects>
+  <projects/>
   <buildSpec>
     <buildCommand>
       <name>org.eclipse.jdt.core.javabuilder</name>

Added: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/AbstractProcessInstanceMarshaller.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,297 @@
+package org.drools.marshalling;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.process.core.context.swimlane.SwimlaneContext;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.process.instance.context.swimlane.SwimlaneContextInstance;
+import org.drools.process.instance.context.variable.VariableScopeInstance;
+import org.drools.runtime.process.NodeInstance;
+import org.drools.runtime.process.NodeInstanceContainer;
+import org.drools.runtime.process.ProcessInstance;
+import org.drools.workflow.instance.WorkflowProcessInstance;
+import org.drools.workflow.instance.impl.NodeInstanceImpl;
+import org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl;
+import org.drools.workflow.instance.node.CompositeContextNodeInstance;
+import org.drools.workflow.instance.node.ForEachNodeInstance;
+import org.drools.workflow.instance.node.HumanTaskNodeInstance;
+import org.drools.workflow.instance.node.JoinInstance;
+import org.drools.workflow.instance.node.MilestoneNodeInstance;
+import org.drools.workflow.instance.node.RuleSetNodeInstance;
+import org.drools.workflow.instance.node.SubProcessNodeInstance;
+import org.drools.workflow.instance.node.TimerNodeInstance;
+import org.drools.workflow.instance.node.WorkItemNodeInstance;
+
+public abstract class AbstractProcessInstanceMarshaller implements ProcessMarshaller {
+
+	// Output methods
+	
+	public void writeProcessInstance(MarshallerWriteContext context, ProcessInstance processInstance)
+			throws IOException {
+
+		WorkflowProcessInstanceImpl workFlow = (WorkflowProcessInstanceImpl) processInstance;
+		ObjectOutputStream stream = context.stream;
+		// saves the processInstance class first
+		stream.writeObject(processInstance.getClass());
+		stream.writeLong(workFlow.getId());
+		stream.writeUTF(workFlow.getProcessId());
+		stream.writeInt(workFlow.getState());
+		stream.writeLong(workFlow.getNodeInstanceCounter());
+
+		VariableScopeInstance variableScopeInstance = (VariableScopeInstance) workFlow
+				.getContextInstance(VariableScope.VARIABLE_SCOPE);
+		Map<String, Object> variables = variableScopeInstance.getVariables();
+		List<String> keys = new ArrayList<String>(variables.keySet());
+		Collections.sort(keys, new Comparator<String>() {
+			public int compare(String o1, String o2) {
+				return o1.compareTo(o2);
+			}
+		});
+		stream.writeInt(keys.size());
+		for (String key : keys) {
+			stream.writeUTF(key);
+			stream.writeObject(variables.get(key));
+		}
+
+		SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) workFlow
+				.getContextInstance(SwimlaneContext.SWIMLANE_SCOPE);
+		if (swimlaneContextInstance != null) {
+			Map<String, String> swimlaneActors = swimlaneContextInstance.getSwimlaneActors();
+			stream.writeInt(swimlaneActors.size());
+			for (Map.Entry<String, String> entry : swimlaneActors.entrySet()) {
+				stream.writeUTF(entry.getKey());
+				stream.writeUTF(entry.getValue());
+			}
+		}
+		List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>(workFlow.getNodeInstances());
+		Collections.sort(nodeInstances, new Comparator<NodeInstance>() {
+			public int compare(NodeInstance o1, NodeInstance o2) {
+				return (int) (o1.getId() - o2.getId());
+			}
+		});
+		for (NodeInstance nodeInstance : nodeInstances) {
+			stream.writeShort(PersisterEnums.NODE_INSTANCE);
+			writeNodeInstance(context, nodeInstance);
+		}
+		stream.writeShort(PersisterEnums.END);
+	}
+
+	public void writeNodeInstance(MarshallerWriteContext context, NodeInstance nodeInstance) throws IOException {
+		processCommonNodes(context, nodeInstance);
+	}
+
+	protected final void processCommonNodes(MarshallerWriteContext context, NodeInstance nodeInstance)
+			throws IOException {
+		ObjectOutputStream stream = context.stream;
+		stream.writeLong(nodeInstance.getId());
+		stream.writeLong(nodeInstance.getNodeId());
+		if (nodeInstance instanceof RuleSetNodeInstance) {
+			stream.writeShort(PersisterEnums.RULE_SET_NODE_INSTANCE);
+		} else if (nodeInstance instanceof HumanTaskNodeInstance) {
+			stream.writeShort(PersisterEnums.HUMAN_TASK_NODE_INSTANCE);
+			stream.writeLong(((HumanTaskNodeInstance) nodeInstance).getWorkItem().getId());
+		} else if (nodeInstance instanceof WorkItemNodeInstance) {
+			stream.writeShort(PersisterEnums.WORK_ITEM_NODE_INSTANCE);
+			stream.writeLong(((WorkItemNodeInstance) nodeInstance).getWorkItem().getId());
+		} else if (nodeInstance instanceof SubProcessNodeInstance) {
+			stream.writeShort(PersisterEnums.SUB_PROCESS_NODE_INSTANCE);
+			stream.writeLong(((SubProcessNodeInstance) nodeInstance).getProcessInstanceId());
+		} else if (nodeInstance instanceof MilestoneNodeInstance) {
+			stream.writeShort(PersisterEnums.MILESTONE_NODE_INSTANCE);
+			List<Long> timerInstances = ((MilestoneNodeInstance) nodeInstance).getTimerInstances();
+			if (timerInstances != null) {
+				stream.writeInt(timerInstances.size());
+				for (Long id : timerInstances) {
+					stream.writeLong(id);
+				}
+			} else {
+				stream.writeInt(0);
+			}
+		} else if (nodeInstance instanceof TimerNodeInstance) {
+			stream.writeShort(PersisterEnums.TIMER_NODE_INSTANCE);
+			stream.writeLong(((TimerNodeInstance) nodeInstance).getTimerId());
+		} else if (nodeInstance instanceof JoinInstance) {
+			stream.writeShort(PersisterEnums.JOIN_NODE_INSTANCE);
+			Map<Long, Integer> triggers = ((JoinInstance) nodeInstance).getTriggers();
+			stream.writeInt(triggers.size());
+			List<Long> keys = new ArrayList<Long>(triggers.keySet());
+			Collections.sort(keys, new Comparator<Long>() {
+				public int compare(Long o1, Long o2) {
+					return o1.compareTo(o2);
+				}
+			});
+			for (Long key : keys) {
+				stream.writeLong(key);
+				stream.writeInt(triggers.get(key));
+			}
+		} else if (nodeInstance instanceof CompositeContextNodeInstance) {
+			stream.writeShort(PersisterEnums.COMPOSITE_NODE_INSTANCE);
+			CompositeContextNodeInstance compositeNodeInstance = (CompositeContextNodeInstance) nodeInstance;
+			VariableScopeInstance variableScopeInstance = (VariableScopeInstance) compositeNodeInstance
+					.getContextInstance(VariableScope.VARIABLE_SCOPE);
+			Map<String, Object> variables = variableScopeInstance.getVariables();
+			List<String> keys = new ArrayList<String>(variables.keySet());
+			Collections.sort(keys, new Comparator<String>() {
+				public int compare(String o1, String o2) {
+					return o1.compareTo(o2);
+				}
+			});
+			stream.writeInt(keys.size());
+			for (String key : keys) {
+				stream.writeUTF(key);
+				stream.writeObject(variables.get(key));
+			}
+			List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>(compositeNodeInstance.getNodeInstances());
+			Collections.sort(nodeInstances, new Comparator<NodeInstance>() {
+				public int compare(NodeInstance o1, NodeInstance o2) {
+					return (int) (o1.getId() - o2.getId());
+				}
+			});
+			for (NodeInstance subNodeInstance : nodeInstances) {
+				stream.writeShort(PersisterEnums.NODE_INSTANCE);
+				writeNodeInstance(context, subNodeInstance);
+			}
+			stream.writeShort(PersisterEnums.END);
+		} else if (nodeInstance instanceof ForEachNodeInstance) {
+			stream.writeShort(PersisterEnums.FOR_EACH_NODE_INSTANCE);
+			ForEachNodeInstance forEachNodeInstance = (ForEachNodeInstance) nodeInstance;
+			List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>(forEachNodeInstance.getNodeInstances());
+			Collections.sort(nodeInstances, new Comparator<NodeInstance>() {
+				public int compare(NodeInstance o1, NodeInstance o2) {
+					return (int) (o1.getId() - o2.getId());
+				}
+			});
+			for (NodeInstance subNodeInstance : nodeInstances) {
+				if (subNodeInstance instanceof CompositeContextNodeInstance) {
+					stream.writeShort(PersisterEnums.NODE_INSTANCE);
+					writeNodeInstance(context, subNodeInstance);
+				}
+			}
+			stream.writeShort(PersisterEnums.END);
+		} else {
+			// TODO ForEachNodeInstance
+			// TODO timer manager
+			try {
+				outputSpecificNodes(context, nodeInstance);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				throw new IllegalArgumentException("Unknown node instance type: " + nodeInstance);
+			}
+		}
+	}
+
+	protected abstract void outputSpecificNodes(MarshallerWriteContext context, NodeInstance nodeInstance)
+			throws IOException;
+
+
+	// Input methods
+	
+	public abstract ProcessInstance readProcessInstance(MarshallerReaderContext context) throws IOException;
+	
+
+	public NodeInstance readNodeInstance(MarshallerReaderContext context, NodeInstanceContainer nodeInstanceContainer,
+			WorkflowProcessInstance processInstance) throws IOException {
+		ObjectInputStream stream = context.stream;
+		NodeInstanceImpl nodeInstance = null;
+		long id = stream.readLong();
+		long nodeId = stream.readLong();
+		int nodeType = stream.readShort();
+		boolean found = inputSpecificNode(nodeInstance,nodeType,stream);
+		if (!found) {
+			switch (nodeType) {
+			case PersisterEnums.RULE_SET_NODE_INSTANCE:
+				nodeInstance = new RuleSetNodeInstance();
+				break;
+			case PersisterEnums.HUMAN_TASK_NODE_INSTANCE:
+				nodeInstance = new HumanTaskNodeInstance();
+				((HumanTaskNodeInstance) nodeInstance).internalSetWorkItemId(stream.readLong());
+				break;
+			case PersisterEnums.WORK_ITEM_NODE_INSTANCE:
+				nodeInstance = new WorkItemNodeInstance();
+				((WorkItemNodeInstance) nodeInstance).internalSetWorkItemId(stream.readLong());
+				break;
+			case PersisterEnums.SUB_PROCESS_NODE_INSTANCE:
+				nodeInstance = new SubProcessNodeInstance();
+				((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId(stream.readLong());
+				break;
+			case PersisterEnums.MILESTONE_NODE_INSTANCE:
+				nodeInstance = new MilestoneNodeInstance();
+				int nbTimerInstances = stream.readInt();
+				if (nbTimerInstances > 0) {
+					List<Long> timerInstances = new ArrayList<Long>();
+					for (int i = 0; i < nbTimerInstances; i++) {
+						timerInstances.add(stream.readLong());
+					}
+					((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
+				}
+				break;
+			case PersisterEnums.TIMER_NODE_INSTANCE:
+				nodeInstance = new TimerNodeInstance();
+				((TimerNodeInstance) nodeInstance).internalSetTimerId(stream.readLong());
+				break;
+			case PersisterEnums.JOIN_NODE_INSTANCE:
+				nodeInstance = new JoinInstance();
+				int number = stream.readInt();
+				if (number > 0) {
+					Map<Long, Integer> triggers = new HashMap<Long, Integer>();
+					for (int i = 0; i < number; i++) {
+						long l = stream.readLong();
+						int count = stream.readInt();
+						triggers.put(l, count);
+					}
+					((JoinInstance) nodeInstance).internalSetTriggers(triggers);
+				}
+				break;
+			case PersisterEnums.COMPOSITE_NODE_INSTANCE:
+				nodeInstance = new CompositeContextNodeInstance();
+				break;
+			case PersisterEnums.FOR_EACH_NODE_INSTANCE:
+				nodeInstance = new ForEachNodeInstance();
+				break;
+			default:
+				throw new IllegalArgumentException("Unknown node type: " + nodeType);
+			}
+			nodeInstance.setNodeId(nodeId);
+			nodeInstance.setNodeInstanceContainer(nodeInstanceContainer);
+			nodeInstance.setProcessInstance(processInstance);
+			nodeInstance.setId(id);
+			switch (nodeType) {
+			case PersisterEnums.COMPOSITE_NODE_INSTANCE:
+				int nbVariables = stream.readInt();
+				if (nbVariables > 0) {
+					VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance)
+							.getContextInstance(VariableScope.VARIABLE_SCOPE);
+					for (int i = 0; i < nbVariables; i++) {
+						String name = stream.readUTF();
+						try {
+							Object value = stream.readObject();
+							variableScopeInstance.setVariable(name, value);
+						} catch (ClassNotFoundException e) {
+							throw new IllegalArgumentException("Could not reload variable " + name);
+						}
+					}
+				}
+				while (stream.readShort() == PersisterEnums.NODE_INSTANCE) {
+					readNodeInstance(context, (CompositeContextNodeInstance) nodeInstance, processInstance);
+				}
+				break;
+			case PersisterEnums.FOR_EACH_NODE_INSTANCE:
+				while (stream.readShort() == PersisterEnums.NODE_INSTANCE) {
+					readNodeInstance(context, (ForEachNodeInstance) nodeInstance, processInstance);
+				}
+				break;
+			default:
+				// do nothing
+			}
+		}
+		return nodeInstance;
+	}
+}

Modified: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -770,167 +770,180 @@
     }
 
     public static void readProcessInstances(MarshallerReaderContext context) throws IOException {
-        ObjectInputStream stream = context.stream;
+    	ObjectInputStream stream = context.stream;
+        ProcessMarshaller marshaller = getMarshaller(context);
         while ( stream.readShort() == PersisterEnums.PROCESS_INSTANCE ) {
-            readProcessInstance( context );
+            marshaller.readProcessInstance( context );
         }
     }
-
-    public static ProcessInstance readProcessInstance(MarshallerReaderContext context) throws IOException {
-        ObjectInputStream stream = context.stream;
-        InternalRuleBase ruleBase = context.ruleBase;
-        InternalWorkingMemory wm = context.wm;
-
-        RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
-        processInstance.setId( stream.readLong() );
-        String processId = stream.readUTF();
-        processInstance.setProcessId( processId );
-        if ( ruleBase != null ) {
-            processInstance.setProcess( ruleBase.getProcess( processId ) );
-        }
-        processInstance.setState( stream.readInt() );
-        long nodeInstanceCounter = stream.readLong();
-        processInstance.setWorkingMemory( wm );
-
-        int nbVariables = stream.readInt();
-        if ( nbVariables > 0 ) {
-            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
-            for ( int i = 0; i < nbVariables; i++ ) {
-                String name = stream.readUTF();
-                try {
-                    Object value = stream.readObject();
-                    variableScopeInstance.setVariable( name,
-                                                       value );
-                } catch ( ClassNotFoundException e ) {
-                    throw new IllegalArgumentException( "Could not reload variable " + name );
-                }
-            }
-        }
-
-        int nbSwimlanes = stream.readInt();
-        if ( nbSwimlanes > 0 ) {
-            SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) processInstance.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
-            for ( int i = 0; i < nbSwimlanes; i++ ) {
-                String name = stream.readUTF();
-                String value = stream.readUTF();
-                swimlaneContextInstance.setActorId( name,
-                                                    value );
-            }
-        }
-
-        while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
-            readNodeInstance( context,
-                              processInstance,
-                              processInstance );
-        }
-
-        processInstance.internalSetNodeInstanceCounter( nodeInstanceCounter );
-        if ( wm != null ) {
-            processInstance.reconnect();
-        }
-        return processInstance;
+    
+    public static ProcessMarshaller getMarshaller (MarshallerReaderContext context) throws IOException {
+    	ObjectInputStream stream = context.stream;
+        Class clazz = null;
+        try {
+			clazz = (Class)stream.readObject();
+		} catch (ClassNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        return ProcessMarshallerRegistry.INSTANCE.getMarshaller(clazz);
     }
 
-    public static NodeInstance readNodeInstance(MarshallerReaderContext context,
-                                                NodeInstanceContainer nodeInstanceContainer,
-                                                RuleFlowProcessInstance processInstance) throws IOException {
-        ObjectInputStream stream = context.stream;
-        NodeInstanceImpl nodeInstance = null;
-        long id = stream.readLong();
-        long nodeId = stream.readLong();
-        int nodeType = stream.readShort();
-        switch ( nodeType ) {
-            case PersisterEnums.RULE_SET_NODE_INSTANCE :
-                nodeInstance = new RuleSetNodeInstance();
-                break;
-            case PersisterEnums.HUMAN_TASK_NODE_INSTANCE :
-                nodeInstance = new HumanTaskNodeInstance();
-                ((HumanTaskNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
-                break;
-            case PersisterEnums.WORK_ITEM_NODE_INSTANCE :
-                nodeInstance = new WorkItemNodeInstance();
-                ((WorkItemNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
-                break;
-            case PersisterEnums.SUB_PROCESS_NODE_INSTANCE :
-                nodeInstance = new SubProcessNodeInstance();
-                ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId( stream.readLong() );
-                break;
-            case PersisterEnums.MILESTONE_NODE_INSTANCE :
-                nodeInstance = new MilestoneNodeInstance();
-                int nbTimerInstances = stream.readInt();
-                if (nbTimerInstances > 0) {
-                	List<Long> timerInstances = new ArrayList<Long>();
-                	for (int i = 0; i < nbTimerInstances; i++) {
-                		timerInstances.add(stream.readLong());
-                	}
-                	((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
-                }
-                break;
-            case PersisterEnums.TIMER_NODE_INSTANCE :
-                nodeInstance = new TimerNodeInstance();
-                ((TimerNodeInstance) nodeInstance).internalSetTimerId( stream.readLong() );
-                break;
-            case PersisterEnums.JOIN_NODE_INSTANCE :
-                nodeInstance = new JoinInstance();
-                int number = stream.readInt();
-                if ( number > 0 ) {
-                    Map<Long, Integer> triggers = new HashMap<Long, Integer>();
-                    for ( int i = 0; i < number; i++ ) {
-                        long l = stream.readLong();
-                        int count = stream.readInt();
-                        triggers.put( l,
-                                      count );
-                    }
-                    ((JoinInstance) nodeInstance).internalSetTriggers( triggers );
-                }
-                break;
-            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
-                nodeInstance = new CompositeContextNodeInstance();
-                break;
-            case PersisterEnums.FOR_EACH_NODE_INSTANCE :
-                nodeInstance = new ForEachNodeInstance();
-                break;
-            default :
-                throw new IllegalArgumentException( "Unknown node type: " + nodeType );
-        }
-        nodeInstance.setNodeId( nodeId );
-        nodeInstance.setNodeInstanceContainer( nodeInstanceContainer );
-        nodeInstance.setProcessInstance( processInstance );
-        nodeInstance.setId( id );
-        switch ( nodeType ) {
-            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
-                int nbVariables = stream.readInt();
-                if ( nbVariables > 0 ) {
-                    VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance).getContextInstance( VariableScope.VARIABLE_SCOPE );
-                    for ( int i = 0; i < nbVariables; i++ ) {
-                        String name = stream.readUTF();
-                        try {
-                            Object value = stream.readObject();
-                            variableScopeInstance.setVariable( name,
-                                                               value );
-                        } catch ( ClassNotFoundException e ) {
-                            throw new IllegalArgumentException( "Could not reload variable " + name );
-                        }
-                    }
-                }
-                while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
-                    readNodeInstance( context,
-                                      (CompositeContextNodeInstance) nodeInstance,
-                                      processInstance );
-                }
-                break;
-            case PersisterEnums.FOR_EACH_NODE_INSTANCE :
-                while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
-                    readNodeInstance( context,
-                                      (ForEachNodeInstance) nodeInstance,
-                                      processInstance );
-                }
-                break;
-            default :
-                // do nothing
-        }
-        return nodeInstance;
-    }
+//    public static ProcessInstance readProcessInstance(MarshallerReaderContext context) throws IOException {
+//        ObjectInputStream stream = context.stream;
+//        InternalRuleBase ruleBase = context.ruleBase;
+//        InternalWorkingMemory wm = context.wm;
+//
+//        RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
+//        processInstance.setId( stream.readLong() );
+//        String processId = stream.readUTF();
+//        processInstance.setProcessId( processId );
+//        if ( ruleBase != null ) {
+//            processInstance.setProcess( ruleBase.getProcess( processId ) );
+//        }
+//        processInstance.setState( stream.readInt() );
+//        long nodeInstanceCounter = stream.readLong();
+//        processInstance.setWorkingMemory( wm );
+//
+//        int nbVariables = stream.readInt();
+//        if ( nbVariables > 0 ) {
+//            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
+//            for ( int i = 0; i < nbVariables; i++ ) {
+//                String name = stream.readUTF();
+//                try {
+//                    Object value = stream.readObject();
+//                    variableScopeInstance.setVariable( name,
+//                                                       value );
+//                } catch ( ClassNotFoundException e ) {
+//                    throw new IllegalArgumentException( "Could not reload variable " + name );
+//                }
+//            }
+//        }
+//
+//        int nbSwimlanes = stream.readInt();
+//        if ( nbSwimlanes > 0 ) {
+//            SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) processInstance.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
+//            for ( int i = 0; i < nbSwimlanes; i++ ) {
+//                String name = stream.readUTF();
+//                String value = stream.readUTF();
+//                swimlaneContextInstance.setActorId( name,
+//                                                    value );
+//            }
+//        }
+//
+//        while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
+//            readNodeInstance( context,
+//                              processInstance,
+//                              processInstance );
+//        }
+//
+//        processInstance.internalSetNodeInstanceCounter( nodeInstanceCounter );
+//        if ( wm != null ) {
+//            processInstance.reconnect();
+//        }
+//        return processInstance;
+//    }
+//
+//    public static NodeInstance readNodeInstance(MarshallerReaderContext context,
+//                                                NodeInstanceContainer nodeInstanceContainer,
+//                                                RuleFlowProcessInstance processInstance) throws IOException {
+//        ObjectInputStream stream = context.stream;
+//        NodeInstanceImpl nodeInstance = null;
+//        long id = stream.readLong();
+//        long nodeId = stream.readLong();
+//        int nodeType = stream.readShort();
+//        switch ( nodeType ) {
+//            case PersisterEnums.RULE_SET_NODE_INSTANCE :
+//                nodeInstance = new RuleSetNodeInstance();
+//                break;
+//            case PersisterEnums.HUMAN_TASK_NODE_INSTANCE :
+//                nodeInstance = new HumanTaskNodeInstance();
+//                ((HumanTaskNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
+//                break;
+//            case PersisterEnums.WORK_ITEM_NODE_INSTANCE :
+//                nodeInstance = new WorkItemNodeInstance();
+//                ((WorkItemNodeInstance) nodeInstance).internalSetWorkItemId( stream.readLong() );
+//                break;
+//            case PersisterEnums.SUB_PROCESS_NODE_INSTANCE :
+//                nodeInstance = new SubProcessNodeInstance();
+//                ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId( stream.readLong() );
+//                break;
+//            case PersisterEnums.MILESTONE_NODE_INSTANCE :
+//                nodeInstance = new MilestoneNodeInstance();
+//                int nbTimerInstances = stream.readInt();
+//                if (nbTimerInstances > 0) {
+//                	List<Long> timerInstances = new ArrayList<Long>();
+//                	for (int i = 0; i < nbTimerInstances; i++) {
+//                		timerInstances.add(stream.readLong());
+//                	}
+//                	((MilestoneNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
+//                }
+//                break;
+//            case PersisterEnums.TIMER_NODE_INSTANCE :
+//                nodeInstance = new TimerNodeInstance();
+//                ((TimerNodeInstance) nodeInstance).internalSetTimerId( stream.readLong() );
+//                break;
+//            case PersisterEnums.JOIN_NODE_INSTANCE :
+//                nodeInstance = new JoinInstance();
+//                int number = stream.readInt();
+//                if ( number > 0 ) {
+//                    Map<Long, Integer> triggers = new HashMap<Long, Integer>();
+//                    for ( int i = 0; i < number; i++ ) {
+//                        long l = stream.readLong();
+//                        int count = stream.readInt();
+//                        triggers.put( l,
+//                                      count );
+//                    }
+//                    ((JoinInstance) nodeInstance).internalSetTriggers( triggers );
+//                }
+//                break;
+//            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
+//                nodeInstance = new CompositeContextNodeInstance();
+//                break;
+//            case PersisterEnums.FOR_EACH_NODE_INSTANCE :
+//                nodeInstance = new ForEachNodeInstance();
+//                break;
+//            default :
+//                throw new IllegalArgumentException( "Unknown node type: " + nodeType );
+//        }
+//        nodeInstance.setNodeId( nodeId );
+//        nodeInstance.setNodeInstanceContainer( nodeInstanceContainer );
+//        nodeInstance.setProcessInstance( processInstance );
+//        nodeInstance.setId( id );
+//        switch ( nodeType ) {
+//            case PersisterEnums.COMPOSITE_NODE_INSTANCE :
+//                int nbVariables = stream.readInt();
+//                if ( nbVariables > 0 ) {
+//                    VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((CompositeContextNodeInstance) nodeInstance).getContextInstance( VariableScope.VARIABLE_SCOPE );
+//                    for ( int i = 0; i < nbVariables; i++ ) {
+//                        String name = stream.readUTF();
+//                        try {
+//                            Object value = stream.readObject();
+//                            variableScopeInstance.setVariable( name,
+//                                                               value );
+//                        } catch ( ClassNotFoundException e ) {
+//                            throw new IllegalArgumentException( "Could not reload variable " + name );
+//                        }
+//                    }
+//                }
+//                while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
+//                    readNodeInstance( context,
+//                                      (CompositeContextNodeInstance) nodeInstance,
+//                                      processInstance );
+//                }
+//                break;
+//            case PersisterEnums.FOR_EACH_NODE_INSTANCE :
+//                while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
+//                    readNodeInstance( context,
+//                                      (ForEachNodeInstance) nodeInstance,
+//                                      processInstance );
+//                }
+//                break;
+//            default :
+//                // do nothing
+//        }
+//        return nodeInstance;
+//    }
 
     public static void readWorkItems(MarshallerReaderContext context) throws IOException {
         InternalWorkingMemory wm = context.wm;

Modified: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/OutputMarshaller.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -27,11 +27,7 @@
 import org.drools.common.ObjectStore;
 import org.drools.common.RuleFlowGroupImpl;
 import org.drools.common.WorkingMemoryAction;
-import org.drools.process.core.context.swimlane.SwimlaneContext;
-import org.drools.process.core.context.variable.VariableScope;
 import org.drools.process.instance.WorkItemManager;
-import org.drools.process.instance.context.swimlane.SwimlaneContextInstance;
-import org.drools.process.instance.context.variable.VariableScopeInstance;
 import org.drools.process.instance.timer.TimerInstance;
 import org.drools.process.instance.timer.TimerManager;
 import org.drools.reteoo.BetaNode;
@@ -49,7 +45,7 @@
 import org.drools.rule.EntryPoint;
 import org.drools.rule.Rule;
 import org.drools.ruleflow.instance.RuleFlowProcessInstance;
-import org.drools.runtime.process.NodeInstance;
+import org.drools.runtime.process.ProcessInstance;
 import org.drools.runtime.process.WorkItem;
 import org.drools.spi.ActivationGroup;
 import org.drools.spi.AgendaGroup;
@@ -57,15 +53,6 @@
 import org.drools.spi.RuleFlowGroup;
 import org.drools.util.ObjectHashMap;
 import org.drools.util.ObjectHashSet;
-import org.drools.workflow.instance.node.CompositeContextNodeInstance;
-import org.drools.workflow.instance.node.ForEachNodeInstance;
-import org.drools.workflow.instance.node.HumanTaskNodeInstance;
-import org.drools.workflow.instance.node.JoinInstance;
-import org.drools.workflow.instance.node.MilestoneNodeInstance;
-import org.drools.workflow.instance.node.RuleSetNodeInstance;
-import org.drools.workflow.instance.node.SubProcessNodeInstance;
-import org.drools.workflow.instance.node.TimerNodeInstance;
-import org.drools.workflow.instance.node.WorkItemNodeInstance;
 
 public class OutputMarshaller {
     public static void writeSession(MarshallerWriteContext context) throws IOException {
@@ -743,160 +730,169 @@
         }
         stream.writeShort( PersisterEnums.END );
     }
+    
+	public static void writeProcessInstance(MarshallerWriteContext context,
+			ProcessInstance processInstance) throws IOException {
 
-    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() );
+		ProcessMarshaller marshaller = ProcessMarshallerRegistry.INSTANCE
+				.getMarshaller(processInstance.getClass());
+		marshaller.writeProcessInstance(context, processInstance);
 
-        VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
-        Map<String, Object> variables = variableScopeInstance.getVariables();
-        List<String> keys = new ArrayList<String>( variables.keySet() );
-        Collections.sort( keys,
-                          new Comparator<String>() {
-                              public int compare(String o1,
-                                                 String o2) {
-                                  return o1.compareTo( o2 );
-                              }
-                          } );
-        stream.writeInt( keys.size() );
-        for ( String key : keys ) {
-            stream.writeUTF( key );
-            stream.writeObject( variables.get( key ) );
-        }
+	}
+//
+//    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();
+//        List<String> keys = new ArrayList<String>( variables.keySet() );
+//        Collections.sort( keys,
+//                          new Comparator<String>() {
+//                              public int compare(String o1,
+//                                                 String o2) {
+//                                  return o1.compareTo( o2 );
+//                              }
+//                          } );
+//        stream.writeInt( keys.size() );
+//        for ( String key : keys ) {
+//            stream.writeUTF( key );
+//            stream.writeObject( variables.get( key ) );
+//        }
+//
+//        SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) processInstance.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
+//        Map<String, String> swimlaneActors = swimlaneContextInstance.getSwimlaneActors();
+//        stream.writeInt( swimlaneActors.size() );
+//        for ( Map.Entry<String, String> entry : swimlaneActors.entrySet() ) {
+//            stream.writeUTF( entry.getKey() );
+//            stream.writeUTF( entry.getValue() );
+//        }
+//
+//        List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>( processInstance.getNodeInstances() );
+//        Collections.sort( nodeInstances,
+//                          new Comparator<NodeInstance>() {
+//                              public int compare(NodeInstance o1,
+//                                                 NodeInstance o2) {
+//                                  return (int) (o1.getId() - o2.getId());
+//                              }
+//                          } );
+//        for ( NodeInstance nodeInstance : nodeInstances ) {
+//            stream.writeShort( PersisterEnums.NODE_INSTANCE );
+//            writeNodeInstance( context,
+//                               nodeInstance );
+//        }
+//        stream.writeShort( PersisterEnums.END );
+//    }
+//
+//    public static void writeNodeInstance(MarshallerWriteContext context,
+//                                         NodeInstance nodeInstance) throws IOException {
+//        ObjectOutputStream stream = context.stream;
+//        stream.writeLong( nodeInstance.getId() );
+//        stream.writeLong( nodeInstance.getNodeId() );
+//        if ( nodeInstance instanceof RuleSetNodeInstance ) {
+//            stream.writeShort( PersisterEnums.RULE_SET_NODE_INSTANCE );
+//        } else if ( nodeInstance instanceof HumanTaskNodeInstance ) {
+//            stream.writeShort( PersisterEnums.HUMAN_TASK_NODE_INSTANCE );
+//            stream.writeLong( ((HumanTaskNodeInstance) nodeInstance).getWorkItem().getId() );
+//        } else if ( nodeInstance instanceof WorkItemNodeInstance ) {
+//            stream.writeShort( PersisterEnums.WORK_ITEM_NODE_INSTANCE );
+//            stream.writeLong( ((WorkItemNodeInstance) nodeInstance).getWorkItem().getId() );
+//        } else if ( nodeInstance instanceof SubProcessNodeInstance ) {
+//            stream.writeShort( PersisterEnums.SUB_PROCESS_NODE_INSTANCE );
+//            stream.writeLong( ((SubProcessNodeInstance) nodeInstance).getProcessInstanceId() );
+//        } else if ( nodeInstance instanceof MilestoneNodeInstance ) {
+//            stream.writeShort( PersisterEnums.MILESTONE_NODE_INSTANCE );
+//            List<Long> timerInstances = 
+//            	((MilestoneNodeInstance) nodeInstance).getTimerInstances();
+//            if (timerInstances != null) {
+//            	stream.writeInt(timerInstances.size());
+//            	for (Long id: timerInstances) {
+//            		stream.writeLong(id);
+//            	}
+//            } else {
+//            	stream.writeInt(0);
+//            }
+//        } else if ( nodeInstance instanceof TimerNodeInstance ) {
+//            stream.writeShort( PersisterEnums.TIMER_NODE_INSTANCE );
+//            stream.writeLong( ((TimerNodeInstance) nodeInstance).getTimerId() );
+//        } else if ( nodeInstance instanceof JoinInstance ) {
+//            stream.writeShort( PersisterEnums.JOIN_NODE_INSTANCE );
+//            Map<Long, Integer> triggers = ((JoinInstance) nodeInstance).getTriggers();
+//            stream.writeInt( triggers.size() );
+//            List<Long> keys = new ArrayList<Long>( triggers.keySet() );
+//            Collections.sort( keys,
+//                              new Comparator<Long>() {
+//                                  public int compare(Long o1,
+//                                                     Long o2) {
+//                                      return o1.compareTo( o2 );
+//                                  }
+//                              } );
+//            for ( Long key : keys ) {
+//                stream.writeLong( key );
+//                stream.writeInt( triggers.get( key ) );
+//            }
+//        } else if ( nodeInstance instanceof CompositeContextNodeInstance ) {
+//            stream.writeShort( PersisterEnums.COMPOSITE_NODE_INSTANCE );
+//            CompositeContextNodeInstance compositeNodeInstance = (CompositeContextNodeInstance) nodeInstance;
+//            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) compositeNodeInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
+//            Map<String, Object> variables = variableScopeInstance.getVariables();
+//            List<String> keys = new ArrayList<String>( variables.keySet() );
+//            Collections.sort( keys,
+//                              new Comparator<String>() {
+//                                  public int compare(String o1,
+//                                                     String o2) {
+//                                      return o1.compareTo( o2 );
+//                                  }
+//                              } );
+//            stream.writeInt( keys.size() );
+//            for ( String key : keys ) {
+//                stream.writeUTF( key );
+//                stream.writeObject( variables.get( key ) );
+//            }
+//            List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>( compositeNodeInstance.getNodeInstances() );
+//            Collections.sort( nodeInstances,
+//                              new Comparator<NodeInstance>() {
+//                                  public int compare(NodeInstance o1,
+//                                                     NodeInstance o2) {
+//                                      return (int) (o1.getId() - o2.getId());
+//                                  }
+//                              } );
+//            for ( NodeInstance subNodeInstance : nodeInstances ) {
+//                stream.writeShort( PersisterEnums.NODE_INSTANCE );
+//                writeNodeInstance( context,
+//                                   subNodeInstance );
+//            }
+//            stream.writeShort( PersisterEnums.END );
+//        } else if ( nodeInstance instanceof ForEachNodeInstance ) {
+//            stream.writeShort( PersisterEnums.FOR_EACH_NODE_INSTANCE );
+//            ForEachNodeInstance forEachNodeInstance = (ForEachNodeInstance) nodeInstance;
+//            List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>( forEachNodeInstance.getNodeInstances() );
+//            Collections.sort( nodeInstances,
+//                              new Comparator<NodeInstance>() {
+//                                  public int compare(NodeInstance o1,
+//                                                     NodeInstance o2) {
+//                                      return (int) (o1.getId() - o2.getId());
+//                                  }
+//                              } );
+//            for ( NodeInstance subNodeInstance : nodeInstances ) {
+//                if ( subNodeInstance instanceof CompositeContextNodeInstance ) {
+//                    stream.writeShort( PersisterEnums.NODE_INSTANCE );
+//                    writeNodeInstance( context,
+//                                       subNodeInstance );
+//                }
+//            }
+//            stream.writeShort( PersisterEnums.END );
+//        } else {
+//            // TODO ForEachNodeInstance
+//            // TODO timer manager
+//            throw new IllegalArgumentException( "Unknown node instance type: " + nodeInstance );
+//        }
+//    }
 
-        SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) processInstance.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
-        Map<String, String> swimlaneActors = swimlaneContextInstance.getSwimlaneActors();
-        stream.writeInt( swimlaneActors.size() );
-        for ( Map.Entry<String, String> entry : swimlaneActors.entrySet() ) {
-            stream.writeUTF( entry.getKey() );
-            stream.writeUTF( entry.getValue() );
-        }
-
-        List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>( processInstance.getNodeInstances() );
-        Collections.sort( nodeInstances,
-                          new Comparator<NodeInstance>() {
-                              public int compare(NodeInstance o1,
-                                                 NodeInstance o2) {
-                                  return (int) (o1.getId() - o2.getId());
-                              }
-                          } );
-        for ( NodeInstance nodeInstance : nodeInstances ) {
-            stream.writeShort( PersisterEnums.NODE_INSTANCE );
-            writeNodeInstance( context,
-                               nodeInstance );
-        }
-        stream.writeShort( PersisterEnums.END );
-    }
-
-    public static void writeNodeInstance(MarshallerWriteContext context,
-                                         NodeInstance nodeInstance) throws IOException {
-        ObjectOutputStream stream = context.stream;
-        stream.writeLong( nodeInstance.getId() );
-        stream.writeLong( nodeInstance.getNodeId() );
-        if ( nodeInstance instanceof RuleSetNodeInstance ) {
-            stream.writeShort( PersisterEnums.RULE_SET_NODE_INSTANCE );
-        } else if ( nodeInstance instanceof HumanTaskNodeInstance ) {
-            stream.writeShort( PersisterEnums.HUMAN_TASK_NODE_INSTANCE );
-            stream.writeLong( ((HumanTaskNodeInstance) nodeInstance).getWorkItem().getId() );
-        } else if ( nodeInstance instanceof WorkItemNodeInstance ) {
-            stream.writeShort( PersisterEnums.WORK_ITEM_NODE_INSTANCE );
-            stream.writeLong( ((WorkItemNodeInstance) nodeInstance).getWorkItem().getId() );
-        } else if ( nodeInstance instanceof SubProcessNodeInstance ) {
-            stream.writeShort( PersisterEnums.SUB_PROCESS_NODE_INSTANCE );
-            stream.writeLong( ((SubProcessNodeInstance) nodeInstance).getProcessInstanceId() );
-        } else if ( nodeInstance instanceof MilestoneNodeInstance ) {
-            stream.writeShort( PersisterEnums.MILESTONE_NODE_INSTANCE );
-            List<Long> timerInstances = 
-            	((MilestoneNodeInstance) nodeInstance).getTimerInstances();
-            if (timerInstances != null) {
-            	stream.writeInt(timerInstances.size());
-            	for (Long id: timerInstances) {
-            		stream.writeLong(id);
-            	}
-            } else {
-            	stream.writeInt(0);
-            }
-        } else if ( nodeInstance instanceof TimerNodeInstance ) {
-            stream.writeShort( PersisterEnums.TIMER_NODE_INSTANCE );
-            stream.writeLong( ((TimerNodeInstance) nodeInstance).getTimerId() );
-        } else if ( nodeInstance instanceof JoinInstance ) {
-            stream.writeShort( PersisterEnums.JOIN_NODE_INSTANCE );
-            Map<Long, Integer> triggers = ((JoinInstance) nodeInstance).getTriggers();
-            stream.writeInt( triggers.size() );
-            List<Long> keys = new ArrayList<Long>( triggers.keySet() );
-            Collections.sort( keys,
-                              new Comparator<Long>() {
-                                  public int compare(Long o1,
-                                                     Long o2) {
-                                      return o1.compareTo( o2 );
-                                  }
-                              } );
-            for ( Long key : keys ) {
-                stream.writeLong( key );
-                stream.writeInt( triggers.get( key ) );
-            }
-        } else if ( nodeInstance instanceof CompositeContextNodeInstance ) {
-            stream.writeShort( PersisterEnums.COMPOSITE_NODE_INSTANCE );
-            CompositeContextNodeInstance compositeNodeInstance = (CompositeContextNodeInstance) nodeInstance;
-            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) compositeNodeInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
-            Map<String, Object> variables = variableScopeInstance.getVariables();
-            List<String> keys = new ArrayList<String>( variables.keySet() );
-            Collections.sort( keys,
-                              new Comparator<String>() {
-                                  public int compare(String o1,
-                                                     String o2) {
-                                      return o1.compareTo( o2 );
-                                  }
-                              } );
-            stream.writeInt( keys.size() );
-            for ( String key : keys ) {
-                stream.writeUTF( key );
-                stream.writeObject( variables.get( key ) );
-            }
-            List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>( compositeNodeInstance.getNodeInstances() );
-            Collections.sort( nodeInstances,
-                              new Comparator<NodeInstance>() {
-                                  public int compare(NodeInstance o1,
-                                                     NodeInstance o2) {
-                                      return (int) (o1.getId() - o2.getId());
-                                  }
-                              } );
-            for ( NodeInstance subNodeInstance : nodeInstances ) {
-                stream.writeShort( PersisterEnums.NODE_INSTANCE );
-                writeNodeInstance( context,
-                                   subNodeInstance );
-            }
-            stream.writeShort( PersisterEnums.END );
-        } else if ( nodeInstance instanceof ForEachNodeInstance ) {
-            stream.writeShort( PersisterEnums.FOR_EACH_NODE_INSTANCE );
-            ForEachNodeInstance forEachNodeInstance = (ForEachNodeInstance) nodeInstance;
-            List<NodeInstance> nodeInstances = new ArrayList<NodeInstance>( forEachNodeInstance.getNodeInstances() );
-            Collections.sort( nodeInstances,
-                              new Comparator<NodeInstance>() {
-                                  public int compare(NodeInstance o1,
-                                                     NodeInstance o2) {
-                                      return (int) (o1.getId() - o2.getId());
-                                  }
-                              } );
-            for ( NodeInstance subNodeInstance : nodeInstances ) {
-                if ( subNodeInstance instanceof CompositeContextNodeInstance ) {
-                    stream.writeShort( PersisterEnums.NODE_INSTANCE );
-                    writeNodeInstance( context,
-                                       subNodeInstance );
-                }
-            }
-            stream.writeShort( PersisterEnums.END );
-        } else {
-            // TODO ForEachNodeInstance
-            // TODO timer manager
-            throw new IllegalArgumentException( "Unknown node instance type: " + nodeInstance );
-        }
-    }
-
     public static void writeWorkItems(MarshallerWriteContext context) throws IOException {
         ObjectOutputStream stream = context.stream;
 

Modified: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/PersisterEnums.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/PersisterEnums.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/PersisterEnums.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -39,5 +39,5 @@
     public static final short HUMAN_TASK_NODE_INSTANCE  = 27;
     public static final short FOR_EACH_NODE_INSTANCE    = 28;
     public static final short TIMER                     = 29;
-
+    public static final short STEP_NODE_INSTANCE		= 30;
 }

Added: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshaller.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshaller.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,31 @@
+package org.drools.marshalling;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+import org.drools.runtime.process.NodeInstance;
+import org.drools.runtime.process.ProcessInstance;
+import org.drools.workflow.instance.impl.NodeInstanceImpl;
+
+/**
+* A ProcessMarshaller must contain all the write/read logic for nodes of a specific ProcessInstance.
+* It colaborates with OutputMarshaller and InputMarshaller, that delegates in ProcessMarshaller to 
+* stream in/out runtime information.
+* 
+* @see 	OutPutMarshaller
+* @see 	InputMarshaller
+* @see  ProcessMarshallerRegistry
+* 
+* @author mfossati
+*/
+
+public interface ProcessMarshaller {
+
+	public void writeProcessInstance(MarshallerWriteContext context, ProcessInstance processInstance) throws IOException;
+
+	public void writeNodeInstance(MarshallerWriteContext context, NodeInstance nodeInstance) throws IOException;
+
+	public ProcessInstance readProcessInstance(MarshallerReaderContext context) throws IOException;
+	
+	public boolean inputSpecificNode (NodeInstanceImpl nodeInstance,int nodeType,ObjectInputStream stream) throws IOException;
+}

Added: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/ProcessMarshallerRegistry.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,37 @@
+package org.drools.marshalling;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.process.instance.impl.ProcessInstanceImpl;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+
+/**
+* Registry for ProcessInstance/ProcessMarshaller
+*/
+public class ProcessMarshallerRegistry {
+
+	public static ProcessMarshallerRegistry INSTANCE = new ProcessMarshallerRegistry();
+
+	private Map<Class<? extends ProcessInstanceImpl> , ProcessMarshaller> registry;
+
+	private ProcessMarshallerRegistry() {
+		 this.registry = new HashMap<Class< ? extends ProcessInstanceImpl>, ProcessMarshaller >();
+
+	        // default logic that used to be in OutPutMarshaller:
+	        register( RuleFlowProcessInstance.class,
+	                  RuleFlowProcessInstanceMarshaller.INSTANCE );
+	}
+
+	public void register(Class<? extends ProcessInstanceImpl> cls,
+			ProcessMarshaller marchaller) {
+		this.registry.put(cls, marchaller);
+	}
+	
+	@SuppressWarnings("unchecked")
+	public ProcessMarshaller getMarshaller(Class clazz) {
+		return this.registry.get(clazz);
+	}
+	
+
+}

Added: labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/RuleFlowProcessInstanceMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/RuleFlowProcessInstanceMarshaller.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-core/src/main/java/org/drools/marshalling/RuleFlowProcessInstanceMarshaller.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,99 @@
+package org.drools.marshalling;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+
+import org.drools.common.InternalRuleBase;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.process.core.context.swimlane.SwimlaneContext;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.process.instance.context.swimlane.SwimlaneContextInstance;
+import org.drools.process.instance.context.variable.VariableScopeInstance;
+import org.drools.ruleflow.instance.RuleFlowProcessInstance;
+import org.drools.runtime.process.NodeInstance;
+import org.drools.runtime.process.ProcessInstance;
+import org.drools.workflow.instance.impl.NodeInstanceImpl;
+
+/**
+* Marshaller class for RuleFlowProcessInstances
+*
+* @author mfossati
+*/
+
+public class RuleFlowProcessInstanceMarshaller extends
+		AbstractProcessInstanceMarshaller {
+
+	public static RuleFlowProcessInstanceMarshaller INSTANCE = new RuleFlowProcessInstanceMarshaller();
+
+	private RuleFlowProcessInstanceMarshaller() {
+	}
+
+	@Override
+	protected void outputSpecificNodes(MarshallerWriteContext context,
+			NodeInstance nodeInstance) throws IOException {
+		// nothing to do, so every instance is handled by processCommonsNode in
+		// superclass
+
+	}
+
+	public ProcessInstance readProcessInstance(MarshallerReaderContext context) throws IOException {
+        ObjectInputStream stream = context.stream;
+        InternalRuleBase ruleBase = context.ruleBase;
+        InternalWorkingMemory wm = context.wm;
+
+        RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance();
+        processInstance.setId( stream.readLong() );
+        String processId = stream.readUTF();
+        processInstance.setProcessId( processId );
+        if ( ruleBase != null ) {
+            processInstance.setProcess( ruleBase.getProcess( processId ) );
+        }
+        processInstance.setState( stream.readInt() );
+        long nodeInstanceCounter = stream.readLong();
+        processInstance.setWorkingMemory( wm );
+
+        int nbVariables = stream.readInt();
+        if ( nbVariables > 0 ) {
+            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
+            for ( int i = 0; i < nbVariables; i++ ) {
+                String name = stream.readUTF();
+                try {
+                    Object value = stream.readObject();
+                    variableScopeInstance.setVariable( name,
+                                                       value );
+                } catch ( ClassNotFoundException e ) {
+                    throw new IllegalArgumentException( "Could not reload variable " + name );
+                }
+            }
+        }
+
+        int nbSwimlanes = stream.readInt();
+        if ( nbSwimlanes > 0 ) {
+            SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) processInstance.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
+            for ( int i = 0; i < nbSwimlanes; i++ ) {
+                String name = stream.readUTF();
+                String value = stream.readUTF();
+                swimlaneContextInstance.setActorId( name,
+                                                    value );
+            }
+        }
+
+        while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
+            readNodeInstance( context,
+                              processInstance,
+                              processInstance );
+        }
+
+        processInstance.internalSetNodeInstanceCounter( nodeInstanceCounter );
+        if ( wm != null ) {
+            processInstance.reconnect();
+        }
+        return processInstance;
+    }
+
+	public boolean inputSpecificNode(NodeInstanceImpl nodeInstance, int nodeType, ObjectInputStream stream)
+			throws IOException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+}

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/.classpath
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/.classpath	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/.classpath	2008-12-15 18:45:28 UTC (rev 24383)
@@ -1,28 +1,29 @@
-<classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" including="**" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/bsh/bsh/1.2b7/bsh-1.2b7.jar"/>
-  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
-  <classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/opensymphony/oscore/2.2.5/oscore-2.2.5.jar"/>
-  <classpathentry kind="var" path="M2_REPO/opensymphony/osworkflow/2.8.0/osworkflow-2.8.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/opensymphony/propertyset/1.4/propertyset-1.4.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/drools/drools-api/5.0.0.SNAPSHOT/drools-api-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-api/5.0.0.SNAPSHOT/drools-api-5.0.0.SNAPSHOT-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/drools/drools-core/5.0.0.SNAPSHOT/drools-core-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-core/5.0.0.SNAPSHOT/drools-core-5.0.0.SNAPSHOT-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/mvel/mvel2/2.0.1-SNAPSHOT/mvel2-2.0.1-SNAPSHOT.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.4.2.v_883_R34x/core-3.4.2.v_883_R34x.jar"/>
-  <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.15/janino-2.5.15.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.0.1/jmock-2.5.0.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
-</classpath>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**/*.java" including="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="M2_REPO/bsh/bsh/1.2b7/bsh-1.2b7.jar"/>
+	<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
+	<classpathentry kind="var" path="M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/opensymphony/oscore/2.2.5/oscore-2.2.5.jar"/>
+	<classpathentry kind="var" path="M2_REPO/opensymphony/osworkflow/2.8.0/osworkflow-2.8.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/opensymphony/propertyset/1.4/propertyset-1.4.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/drools/drools-api/5.0.0.SNAPSHOT/drools-api-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-api/5.0.0.SNAPSHOT/drools-api-5.0.0.SNAPSHOT-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/mvel/mvel2/2.0.1-SNAPSHOT/mvel2-2.0.1-SNAPSHOT.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.4.2.v_883_R34x/core-3.4.2.v_883_R34x.jar"/>
+	<classpathentry kind="var" path="M2_REPO/janino/janino/2.5.15/janino-2.5.15.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.0.1/jmock-2.5.0.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/drools-process-enterprise"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/DroolsWorkflow.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/DroolsWorkflow.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/DroolsWorkflow.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -79,7 +79,7 @@
 	}
 	
 	public int[] getAvailableActions(long id) {
-	    return getAvailableActions(id, null);
+	    return getAvailableActions(id, null);   
 	}
 
 	public int[] getAvailableActions(long id, Map inputs) {

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/persistence/marshaller/OSWorkflowMarshaller.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,115 @@
+package org.drools.osworkflow.persistence.marshaller;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.drools.common.InternalRuleBase;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.marshalling.AbstractProcessInstanceMarshaller;
+import org.drools.marshalling.MarshallerReaderContext;
+import org.drools.marshalling.MarshallerWriteContext;
+import org.drools.marshalling.PersisterEnums;
+import org.drools.osworkflow.instance.OSWorkflowProcessInstance;
+import org.drools.osworkflow.instance.node.StepNodeInstance;
+import org.drools.process.core.context.variable.VariableScope;
+import org.drools.process.instance.context.variable.VariableScopeInstance;
+import org.drools.runtime.process.NodeInstance;
+import org.drools.runtime.process.ProcessInstance;
+import org.drools.workflow.instance.impl.NodeInstanceImpl;
+
+public class OSWorkflowMarshaller extends AbstractProcessInstanceMarshaller {
+	
+	public static OSWorkflowMarshaller INSTANCE = new OSWorkflowMarshaller();
+	
+	private OSWorkflowMarshaller() {
+		
+	}
+
+	public void writeNodeInstance(MarshallerWriteContext context,
+			NodeInstance nodeInstance) throws IOException {
+		
+	}
+
+	@Override
+	protected void outputSpecificNodes(MarshallerWriteContext context,
+			NodeInstance nodeInstance) throws IOException {
+		// Handles StepNodeInstances
+		ObjectOutputStream stream = context.stream;
+		if (nodeInstance instanceof StepNodeInstance) {
+			stream.writeShort(PersisterEnums.STEP_NODE_INSTANCE);
+			stream.writeLong(((StepNodeInstance) nodeInstance).getEntryId());
+			stream.writeChars(((StepNodeInstance) nodeInstance).getOwner());
+		}
+		
+	}
+
+	@Override
+	public ProcessInstance readProcessInstance(MarshallerReaderContext context) throws IOException {
+        ObjectInputStream stream = context.stream;
+        InternalRuleBase ruleBase = context.ruleBase;
+        InternalWorkingMemory wm = context.wm;
+
+        OSWorkflowProcessInstance processInstance = new OSWorkflowProcessInstance();
+        processInstance.setId( stream.readLong() );
+        String processId = stream.readUTF();
+        processInstance.setProcessId( processId );
+        if ( ruleBase != null ) {
+            processInstance.setProcess( ruleBase.getProcess( processId ) );
+        }
+        processInstance.setState( stream.readInt() );
+        long nodeInstanceCounter = stream.readLong();
+        processInstance.setWorkingMemory( wm );
+
+        int nbVariables = stream.readInt();
+        if ( nbVariables > 0 ) {
+            VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
+            for ( int i = 0; i < nbVariables; i++ ) {
+                String name = stream.readUTF();
+                try {
+                    Object value = stream.readObject();
+                    variableScopeInstance.setVariable( name,
+                                                       value );
+                } catch ( ClassNotFoundException e ) {
+                    throw new IllegalArgumentException( "Could not reload variable " + name );
+                }
+            }
+        }
+
+//        int nbSwimlanes = stream.readInt();
+//        if ( nbSwimlanes > 0 ) {
+//            SwimlaneContextInstance swimlaneContextInstance = (SwimlaneContextInstance) processInstance.getContextInstance( SwimlaneContext.SWIMLANE_SCOPE );
+//            for ( int i = 0; i < nbSwimlanes; i++ ) {
+//                String name = stream.readUTF();
+//                String value = stream.readUTF();
+//                swimlaneContextInstance.setActorId( name,
+//                                                    value );
+//            }
+//        }
+
+        while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
+            readNodeInstance( context,
+                              processInstance,
+                              processInstance );
+        }
+
+        processInstance.internalSetNodeInstanceCounter( nodeInstanceCounter );
+        if ( wm != null ) {
+            processInstance.reconnect();
+        }
+        return processInstance;
+    }
+	
+	
+	public boolean inputSpecificNode(NodeInstanceImpl nodeInstance, int nodeType , ObjectInputStream stream) throws IOException {
+		if (nodeType == PersisterEnums.STEP_NODE_INSTANCE) {
+			nodeInstance = new StepNodeInstance();
+			StepNodeInstance stepNodeInstance = (StepNodeInstance)nodeInstance;
+			stepNodeInstance.setNodeId(stream.readLong());
+			stepNodeInstance.setOwner(stream.readUTF());
+			return true;
+		}
+		return false;
+	}
+
+}

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/xml/OSWorkflowSemanticModule.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/xml/OSWorkflowSemanticModule.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/java/org/drools/osworkflow/xml/OSWorkflowSemanticModule.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -1,6 +1,7 @@
 package org.drools.osworkflow.xml;
 
 import org.drools.xml.DefaultSemanticModule;
+import org.drools.xml.processes.ActionNodeHandler;
 import org.drools.xml.processes.CompositeNodeHandler;
 import org.drools.xml.processes.ConnectionHandler;
 import org.drools.xml.processes.ConstraintHandler;

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/orm.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/orm.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/orm.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
+               version="1.0">  
+
+</entity-mappings>
+   
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/persistence.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/persistence.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/main/resources/META-INF/persistence.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<persistence
+    version="1.0"
+    xsi:schemaLocation=
+    	"http://java.sun.com/xml/ns/persistence
+    	 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
+		 http://java.sun.com/xml/ns/persistence/orm 
+		 http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
+    xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns="http://java.sun.com/xml/ns/persistence">
+
+ <!--persistence-unit name="ProcessService">
+  <jta-data-source>java:/DefaultDS</jta-data-source>
+  <properties>
+   <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+  </properties>
+ </persistence-unit-->
+ 
+    <persistence-unit name="org.drools.persistence.jpa">
+        <provider>org.hibernate.ejb.HibernatePersistence</provider>
+        <class>org.drools.persistence.jpa.ByteArrayObject</class>
+        <class>org.drools.persistence.processinstance.ProcessInstanceInfo</class>
+        <class>org.drools.persistence.processinstance.ProcessInstanceEventInfo</class>
+        <class>org.drools.persistence.processinstance.WorkItemInfo</class>
+
+	    <properties>
+	        <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+	        <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>	        
+	        <property name="hibernate.connection.url" value="jdbc:h2:~/test" />
+	        <!--property name="hibernate.connection.url" value="jdbc:h2:file:/home/kverlaen/NotBackedUp/development/drools/drools-process/drools-process-enterprise/bin/mydb" /-->
+	        
+<!--			<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>-->
+<!--	        <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>	  	        -->
+<!--	        <property name="hibernate.connection.url" value="jdbc:postgresql://localhost/postgres"/>-->
+	        
+	        <property name="hibernate.connection.username" value="sa"/>
+	        <property name="hibernate.connection.password" value=""/>	
+	        <property name="hibernate.connection.autocommit" value="false" /> 	               
+	        <property name="hibernate.max_fetch_depth" value="3"/>
+		    <property name="hibernate.hbm2ddl.auto" value="update" />
+            <property name="hibernate.show_sql" value="true" />		    
+	    </properties>        
+    </persistence-unit>
+    
+</persistence>
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/ComplexProcessTestCase.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/ComplexProcessTestCase.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/ComplexProcessTestCase.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,70 @@
+package org.drools;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import junit.framework.TestCase;
+
+import org.drools.osworkflow.DroolsWorkflow;
+import org.drools.osworkflow.composite.CompositeWorkflow;
+
+import com.opensymphony.workflow.InvalidActionException;
+import com.opensymphony.workflow.InvalidEntryStateException;
+import com.opensymphony.workflow.InvalidInputException;
+import com.opensymphony.workflow.InvalidRoleException;
+import com.opensymphony.workflow.Workflow;
+import com.opensymphony.workflow.WorkflowException;
+import com.opensymphony.workflow.config.DefaultConfiguration;
+import com.opensymphony.workflow.spi.Step;
+
+public class ComplexProcessTestCase extends TestCase {
+	
+		public void testComplexProcess() {
+			Workflow workflow = new CompositeWorkflow();
+			DefaultConfiguration config = new DefaultConfiguration();
+			workflow.setConfiguration(config);
+			try {
+				long id = workflow.initialize("entrevista", 1, null);
+				Collection<Step> currentSteps = workflow.getCurrentSteps(id);
+	            //verify we only have one current step
+	            assertEquals("Unexpected number of current steps", 1, currentSteps.size());
+	            //verify it's step 1
+	            Step currentStep = currentSteps.iterator().next();
+	            assertEquals("Unexpected current step", 1, currentStep.getStepId());
+
+	            int[] availableActions = workflow.getAvailableActions(id, Collections.EMPTY_MAP);
+	            //verify we only have 6 available actions
+	            assertEquals("Unexpected number of available actions", 6, availableActions.length);
+	            workflow.doAction(id, 2, null);
+	            currentSteps = workflow.getCurrentSteps(id);
+	            //verify we  have two  current step
+	            assertEquals("Unexpected number of current steps", 2, currentSteps.size());
+	            //verify it's step 1
+	            currentStep = currentSteps.iterator().next();
+	            assertEquals("Unexpected current step", 1, currentStep.getStepId());
+	            
+	            availableActions = workflow.getAvailableActions(id, Collections.EMPTY_MAP);
+	            //verify we only have one available action
+	            assertEquals("Unexpected number of available actions", 1, availableActions.length);
+	            //verify it's action 3
+	            assertEquals("Unexpected available action", 3, availableActions[0]);
+				
+			} catch (InvalidActionException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (InvalidRoleException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (InvalidInputException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (InvalidEntryStateException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (WorkflowException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+
+}

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/DroolsOSWorkFlowTestCase.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/DroolsOSWorkFlowTestCase.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/DroolsOSWorkFlowTestCase.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,132 @@
+package org.drools;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.drools.osworkflow.DroolsWorkflow;
+
+import com.opensymphony.workflow.InvalidInputException;
+import com.opensymphony.workflow.Workflow;
+import com.opensymphony.workflow.WorkflowException;
+import com.opensymphony.workflow.config.DefaultConfiguration;
+import com.opensymphony.workflow.spi.Step;
+import com.opensymphony.workflow.spi.WorkflowEntry;
+
+public class DroolsOSWorkFlowTestCase extends TestCase {
+
+	private String resource;
+
+	
+	private DroolsOSWorkFlowTestCase(String xmlname) {
+		super("testPrimer");
+		this.resource = xmlname;
+	}
+	
+	public static TestSuite suite() {
+		InnerTestSuite suite = new InnerTestSuite();
+		addResources(suite);
+		return suite;
+	}
+	
+	
+	public static void addResources(InnerTestSuite suite) {
+		suite.addTestFor("simple");
+	}
+	
+	
+	/**
+	 * Testcase.
+	 */
+	public void testPrimer() {
+		Workflow workflow = new DroolsWorkflow();
+		DefaultConfiguration config = new DefaultConfiguration();
+		workflow.setConfiguration(config);
+		try {
+		    long workflowId = workflow.initialize(this.resource, 1, null);
+			
+			Collection<Step> currentSteps = workflow.getCurrentSteps(workflowId);
+            //verify we only have one current step
+            assertNumberOfCurrentSteps(1, currentSteps.size());
+            //verify it's step 1
+            Step currentStep = currentSteps.iterator().next();
+            assertCurrentStep(1,currentStep);
+            int[] availableActions = workflow.getAvailableActions(workflowId, Collections.EMPTY_MAP);
+            //verify we only have one available action
+            assertEquals("Unexpected number of available actions", 1, availableActions.length);
+            //verify it's action 2
+            assertEquals("Unexpected available action", 2, availableActions[0]);
+            
+            workflow.doAction(workflowId, 2, null);
+            currentSteps = workflow.getCurrentSteps(workflowId);
+            //verify we only have one current step
+            assertEquals("Unexpected number of current steps", 1, currentSteps.size());
+            //verify it's step 1
+            currentStep = currentSteps.iterator().next();
+            assertEquals("Unexpected current step", 1, currentStep.getStepId());
+            
+            availableActions = workflow.getAvailableActions(workflowId, Collections.EMPTY_MAP);
+            //verify we only have one available action
+            assertEquals("Unexpected number of available actions", 1, availableActions.length);
+            //verify it's action 3
+            assertEquals("Unexpected available action", 3, availableActions[0]);
+            
+            workflow.doAction(workflowId, 3, null);
+            currentSteps = workflow.getCurrentSteps(workflowId);
+            //verify we only have no more current steps
+            assertEquals("Unexpected number of current steps", 0, currentSteps.size());
+            //verify process completed
+            assertEquals("Unexpected state", WorkflowEntry.COMPLETED, workflow.getEntryState(workflowId));
+
+            availableActions = workflow.getAvailableActions(workflowId, Collections.EMPTY_MAP);
+            //verify we only have no available action
+            assertEquals("Unexpected number of available actions", 0, availableActions.length);
+		} 
+		catch (InvalidInputException e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} 
+		catch (WorkflowException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+	}
+	
+	private void assertCurrentStep (int stepIteration , long expectedStepId) {
+		assertEquals("Unexpected current step", stepIteration, expectedStepId);
+	}
+	
+	public void assertCurrentStep (int stepIteration , Step currentStep) {
+		assertCurrentStep (stepIteration, currentStep.getId());
+	}
+	
+	public void assertAvaliableActions (int stepIdIteration, int expectedAvaliableActions) {
+		assertEquals("Unexpected number of available actions", 1, expectedAvaliableActions);
+	}
+	
+	public void assertWFState (Workflow workflow, int stepId , int expectedStateId) {
+//		int wId = workflow.getHistorySteps(id)
+//		assertEquals("Unexpected state", expectedStateId, workflow.getEntryState(id))
+	}
+	
+	public void assertNumberOfCurrentSteps(int stepIteration , int expectedSteps) {
+		assertEquals("Unexpected number of current steps", stepIteration, expectedSteps);
+	}
+	
+	/**
+	 * @author ar26818347
+	 */
+	private static class InnerTestSuite extends TestSuite {
+		
+		public DroolsOSWorkFlowTestCase addTestFor(String xmlname) {
+			DroolsOSWorkFlowTestCase test = new DroolsOSWorkFlowTestCase(xmlname);
+			this.addTest(test);
+			return test;
+		}
+		
+		
+	}
+}
+

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/OSWorkFlowPersistenceTestCase.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,99 @@
+package org.drools;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Properties;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import junit.framework.TestCase;
+
+import org.drools.compiler.PackageBuilder;
+import org.drools.marshalling.ProcessMarshallerRegistry;
+import org.drools.osworkflow.DroolsWorkflow;
+import org.drools.osworkflow.instance.OSWorkflowProcessInstance;
+import org.drools.osworkflow.persistence.marshaller.OSWorkflowMarshaller;
+import org.drools.persistence.session.SingleSessionCommandService;
+import org.drools.persistence.session.TestWorkItemHandler;
+import org.drools.process.command.CompleteWorkItemCommand;
+import org.drools.process.command.GetProcessInstanceCommand;
+import org.drools.process.command.StartProcessCommand;
+import org.drools.rule.Package;
+import org.drools.runtime.process.ProcessInstance;
+import org.drools.runtime.process.WorkItem;
+
+import com.opensymphony.workflow.Workflow;
+
+public class OSWorkFlowPersistenceTestCase extends TestCase {
+
+	private EntityManagerFactory emf;
+
+	protected void setUp() {
+		emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
+	}
+
+	protected void tearDown() {
+		emf.close();
+	}
+
+	public void testSave() {
+		setup();
+		Properties properties = new Properties();
+		properties.put("processInstanceManagerFactory",
+				"org.drools.persistence.processinstance.JPAProcessInstanceManagerFactory");
+		properties.put("workItemManagerFactory", "org.drools.persistence.processinstance.JPAWorkItemManagerFactory");
+		properties.put("processSignalManagerFactory", "org.drools.persistence.processinstance.JPASignalManagerFactory");
+		RuleBaseConfiguration conf = new RuleBaseConfiguration(properties);
+
+		// load the process
+		RuleBase ruleBase = createKnowledgeBase(conf);
+
+		SingleSessionCommandService service = new SingleSessionCommandService(ruleBase);
+		StartProcessCommand startProcessCommand = new StartProcessCommand();
+		startProcessCommand.setProcessId("simple");
+		ProcessInstance processInstance = (ProcessInstance) service.execute(startProcessCommand);
+		System.out.println("Started process instance " + processInstance.getId());
+
+		service = new SingleSessionCommandService(ruleBase);
+        GetProcessInstanceCommand getProcessInstanceCommand = new GetProcessInstanceCommand();
+        getProcessInstanceCommand.setProcessInstanceId(processInstance.getId());
+        processInstance = (ProcessInstance) service.execute(getProcessInstanceCommand);
+        assertNotNull(processInstance);
+        
+//        service = new SingleSessionCommandService(ruleBase);
+//        CompleteWorkItemCommand completeWorkItemCommand = new CompleteWorkItemCommand();
+//        completeWorkItemCommand.setWorkItemId(workItem.getId());
+//        service.execute(completeWorkItemCommand);
+        
+	}
+
+	/**
+	 * Process definition.
+	 */
+	private static RuleBase createKnowledgeBase(RuleBaseConfiguration conf) {
+		try {
+			// create a builder
+			PackageBuilder builder = new PackageBuilder();
+			// load the process
+			Reader source = new InputStreamReader(OSWorkFlowPersistenceTestCase.class
+					.getResourceAsStream("/simplerf.rf"));
+			builder.addProcessFromXml(source);
+			// create the knowledge base
+			Package pkg = builder.getPackage();
+			RuleBase ruleBase = RuleBaseFactory.newRuleBase(conf);
+			ruleBase.addPackage(pkg);
+			return ruleBase;
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			fail(e.getMessage());
+			return null;
+		}
+	}
+
+	private void setup() {
+		ProcessMarshallerRegistry.INSTANCE.register(OSWorkflowProcessInstance.class, OSWorkflowMarshaller.INSTANCE);
+	}
+
+}

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple2ProcessTest.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -10,6 +10,7 @@
 
 import org.drools.osworkflow.DroolsWorkflow;
 import org.drools.osworkflow.OSWorkflowParser;
+import org.drools.osworkflow.composite.CompositeWorkflow;
 import org.drools.osworkflow.core.OSWorkflowProcess;
 import org.drools.osworkflow.xml.OSWorkflowSemanticModule;
 import org.drools.osworkflow.xml.XmlOSWorkflowProcessDumper;
@@ -27,7 +28,7 @@
 public class Simple2ProcessTest extends TestCase {
 	
 	public void testSimpleProcess() {
-		Workflow workflow = new DroolsWorkflow();
+		Workflow workflow = new CompositeWorkflow();
 		DefaultConfiguration config = new DefaultConfiguration();
 		workflow.setConfiguration(config);
 		try {

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple3ProcessTest.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple3ProcessTest.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/Simple3ProcessTest.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,55 @@
+package org.drools;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.osworkflow.DroolsWorkflow;
+import org.drools.osworkflow.OSWorkflowParser;
+import org.drools.osworkflow.core.OSWorkflowProcess;
+import org.drools.osworkflow.xml.OSWorkflowSemanticModule;
+import org.drools.osworkflow.xml.XmlOSWorkflowProcessDumper;
+import org.drools.xml.SemanticModules;
+import org.drools.xml.XmlProcessReader;
+
+import com.opensymphony.workflow.InvalidInputException;
+import com.opensymphony.workflow.Workflow;
+import com.opensymphony.workflow.WorkflowException;
+import com.opensymphony.workflow.config.DefaultConfiguration;
+import com.opensymphony.workflow.loader.WorkflowDescriptor;
+import com.opensymphony.workflow.spi.Step;
+import com.opensymphony.workflow.spi.WorkflowEntry;
+
+public class Simple3ProcessTest extends TestCase {
+	
+	public void testSimpleProcess() {
+		Workflow workflow = new DroolsWorkflow();
+		DefaultConfiguration config = new DefaultConfiguration();
+		workflow.setConfiguration(config);
+		try {
+			long workflowId = workflow.initialize("holiday2", 100, null);
+			Collection<Step> currentSteps = workflow.getCurrentSteps(workflowId);
+			//verify it's step 1
+			Step currentStep = currentSteps.iterator().next();
+			assertEquals("Unexpected current step", 1, currentStep.getStepId());
+
+			int[] availableActions = workflow.getAvailableActions(workflowId, Collections.EMPTY_MAP);
+			//verify we only have one available action
+			assertEquals("Unexpected number of available actions", 1, availableActions.length);
+			//verify it's action 1
+			assertEquals("Unexpected available action", 1, availableActions[0]);
+			
+			
+		}
+		catch (Exception e) {
+			int a = 1;
+		}
+		
+	}
+	
+	
+}

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleDroolsFlowTestCase.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleDroolsFlowTestCase.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleDroolsFlowTestCase.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,40 @@
+package org.drools;
+
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import junit.framework.TestCase;
+
+import org.drools.compiler.PackageBuilder;
+import org.drools.rule.Package;
+ 
+public class SimpleDroolsFlowTestCase extends TestCase {
+ 
+	public void testSimple() {
+		try {
+			// load the process
+			RuleBase ruleBase = createKnowledgeBase();
+			// create a new session
+			StatefulSession session = ruleBase.newStatefulSession();
+			// start a new process instance
+			session.startProcess("simple");
+		} catch (Throwable t) {
+			t.printStackTrace();
+		}
+	}
+
+	private RuleBase createKnowledgeBase() throws Exception {
+		// create a builder
+		PackageBuilder builder = new PackageBuilder();
+		// load the process
+		Reader source = new InputStreamReader(SimpleDroolsFlowTestCase.class
+				.getResourceAsStream("/simple.rf"));
+		builder.addProcessFromXml(source);
+		// create the knowledge base
+		Package pkg = builder.getPackage();
+		RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+		ruleBase.addPackage(pkg);
+		return ruleBase;
+	}
+
+}

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleProcessTest.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleProcessTest.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/SimpleProcessTest.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -9,10 +9,9 @@
 import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.osworkflow.DroolsWorkflow;
 import org.drools.osworkflow.OSWorkflowParser;
+import org.drools.osworkflow.composite.CompositeWorkflow;
 import org.drools.osworkflow.core.OSWorkflowProcess;
-import org.drools.osworkflow.xml.OSWorkflowSemanticModule;
 import org.drools.osworkflow.xml.XmlOSWorkflowProcessDumper;
-import org.drools.xml.SemanticModules;
 import org.drools.xml.XmlProcessReader;
 
 import com.opensymphony.workflow.InvalidInputException;

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/composite/CompositeWorkflow.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/composite/CompositeWorkflow.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/composite/CompositeWorkflow.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,210 @@
+package org.drools.osworkflow.composite;
+
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.drools.osworkflow.DroolsWorkflow;
+import org.drools.util.ArrayUtils;
+
+import com.opensymphony.module.propertyset.PropertySet;
+import com.opensymphony.workflow.FactoryException;
+import com.opensymphony.workflow.InvalidActionException;
+import com.opensymphony.workflow.InvalidEntryStateException;
+import com.opensymphony.workflow.InvalidInputException;
+import com.opensymphony.workflow.InvalidRoleException;
+import com.opensymphony.workflow.Workflow;
+import com.opensymphony.workflow.WorkflowException;
+import com.opensymphony.workflow.basic.BasicWorkflow;
+import com.opensymphony.workflow.config.Configuration;
+import com.opensymphony.workflow.loader.WorkflowDescriptor;
+import com.opensymphony.workflow.query.WorkflowExpressionQuery;
+import com.opensymphony.workflow.query.WorkflowQuery;
+
+/**
+ * Composite class that includes one instance of OSWorkflows and one of
+ * DroolsWorkflow. It delegates all its behaviour in both instances, making
+ * assertions over the results.
+ * 
+ * @author Miguel Fossati
+ * 
+ */
+public class CompositeWorkflow implements Workflow {
+
+	private Workflow osWorkflow;
+	private Workflow droolsWorkflow;
+
+	public CompositeWorkflow() {
+		this.osWorkflow = new BasicWorkflow("test");
+		this.droolsWorkflow = new DroolsWorkflow();
+	}
+
+	// public CompositeWorkflow(Workflow osWorkFlowinstance , Workflow
+	// droolsWorkflowInstance) {
+	// this.osWorkflow = osWorkFlowinstance;
+	// this.droolsWorkflow = droolsWorkflowInstance;
+	// }
+
+	public boolean canInitialize(String workflowName, int initialStep) {
+		boolean aux1 = this.osWorkflow.canInitialize(workflowName, initialStep);
+		boolean aux2 = this.droolsWorkflow.canInitialize(workflowName,
+				initialStep);
+		Assert.assertEquals(aux1, aux2);
+		return (aux1);
+	}
+
+	public boolean canInitialize(String workflowName, int initialAction,
+			Map inputs) {
+		boolean aux1 = this.osWorkflow.canInitialize(workflowName,
+				initialAction, inputs);
+		boolean aux2 = this.droolsWorkflow.canInitialize(workflowName,
+				initialAction, inputs);
+		Assert.assertEquals(aux1, aux2);
+		return (aux1);
+	}
+
+	public boolean canModifyEntryState(long id, int newState) {
+		boolean aux1 = this.osWorkflow.canModifyEntryState(id, newState);
+		boolean aux2 = this.droolsWorkflow.canModifyEntryState(id, newState);
+		Assert.assertEquals(aux1, aux2);
+		return (aux1);
+	}
+
+	public void changeEntryState(long id, int newState)
+			throws WorkflowException {
+		this.osWorkflow.changeEntryState(id, newState);
+		this.droolsWorkflow.changeEntryState(id, newState);
+
+	}
+
+	public void doAction(long id, int actionId, Map inputs)
+			throws InvalidInputException, WorkflowException {
+		this.osWorkflow.doAction(id, actionId, inputs);
+		this.droolsWorkflow.doAction(id, actionId, inputs);
+
+	}
+
+	public void executeTriggerFunction(long id, int triggerId)
+			throws WorkflowException {
+		this.osWorkflow.changeEntryState(id, triggerId);
+		this.droolsWorkflow.changeEntryState(id, triggerId);
+
+	}
+
+	public int[] getAvailableActions(long id) {
+		return this.getAvailableActions(id, null);
+	}
+
+	public int[] getAvailableActions(long id, Map inputs) {
+		int[] aux1 = this.osWorkflow.getAvailableActions(id, inputs);
+		int[] aux2 = this.droolsWorkflow.getAvailableActions(id, inputs);
+//		Assert.assertTrue(ArrayUtils.equals(aux1, aux2));
+		return aux1;
+	}
+
+	public List getCurrentSteps(long id) {
+		List aux1 = this.osWorkflow.getCurrentSteps(id);
+		List aux2 = this.droolsWorkflow.getCurrentSteps(id);
+		// TODO add assertion
+		return aux1;
+	}
+
+	public int getEntryState(long id) {
+		int aux1 = this.osWorkflow.getEntryState(id);
+		int aux2 = this.droolsWorkflow.getEntryState(id);
+		Assert.assertEquals(aux1, aux2);
+		return aux1;
+	}
+
+	public List getHistorySteps(long id) {
+		List aux1 = this.osWorkflow.getHistorySteps(id);
+		List aux2 = this.droolsWorkflow.getHistorySteps(id);
+		// TODO add assertion
+		return aux1;
+	}
+
+	public PropertySet getPropertySet(long id) {
+		PropertySet aux1 = this.osWorkflow.getPropertySet(id);
+		PropertySet aux2 = this.droolsWorkflow.getPropertySet(id);
+		// TODO add assertion
+		return aux1;
+	}
+
+	public List getSecurityPermissions(long id) {
+		return this.getSecurityPermissions(id, null);
+	}
+
+	public List getSecurityPermissions(long id, Map inputs) {
+		List aux1 = this.osWorkflow.getSecurityPermissions(id, inputs);
+		List aux2 = this.droolsWorkflow.getSecurityPermissions(id, inputs);
+		// TODO add assertion
+		return aux1;
+	}
+
+	public WorkflowDescriptor getWorkflowDescriptor(String workflowName) {
+		WorkflowDescriptor wf = this.osWorkflow
+				.getWorkflowDescriptor(workflowName);
+		return wf;
+	}
+
+	public String getWorkflowName(long id) {
+		String wfName = this.osWorkflow.getWorkflowName(id);
+		return wfName;
+	}
+
+	public String[] getWorkflowNames() {
+		String[] wfName = this.osWorkflow.getWorkflowNames();
+		return wfName;
+	}
+
+	public long initialize(String workflowName, int initialAction, Map inputs)
+			throws InvalidRoleException, InvalidInputException,
+			WorkflowException, InvalidEntryStateException,
+			InvalidActionException {
+		long id1 = this.osWorkflow.initialize(workflowName, initialAction,
+				inputs);
+		long id2 = this.droolsWorkflow.initialize(workflowName, initialAction,
+				inputs);
+		Assert.assertEquals(id1, id2);
+		return id1;
+	}
+
+	public List query(WorkflowQuery query) throws WorkflowException {
+		List l1 = this.osWorkflow.query(query);
+		List l2 = this.droolsWorkflow.query(query);
+		return l1;
+	}
+
+	public List query(WorkflowExpressionQuery query) throws WorkflowException {
+		List l1 = this.osWorkflow.query(query);
+		List l2 = this.droolsWorkflow.query(query);
+		return l1;
+	}
+
+	public boolean removeWorkflowDescriptor(String workflowName)
+			throws FactoryException {
+		boolean bool1 = this.osWorkflow.removeWorkflowDescriptor(workflowName);
+		boolean bool2 = this.droolsWorkflow
+				.removeWorkflowDescriptor(workflowName);
+		Assert.assertEquals(bool1, bool2);
+		return false;
+	}
+
+	public boolean saveWorkflowDescriptor(String workflowName,
+			WorkflowDescriptor descriptor, boolean replace)
+			throws FactoryException {
+		boolean bool1 = this.osWorkflow.saveWorkflowDescriptor(workflowName,
+				descriptor, replace);
+		boolean bool2 = this.droolsWorkflow.saveWorkflowDescriptor(
+				workflowName, descriptor, replace);
+		Assert.assertEquals(bool1, bool2);
+		return false;
+	}
+
+	public void setConfiguration(Configuration configuration) {
+		this.osWorkflow.setConfiguration(configuration);
+		this.droolsWorkflow.setConfiguration(configuration);
+	}
+
+}

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyCondition.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyCondition.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyCondition.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,28 @@
+package org.drools.osworkflow.dummy;
+
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.opensymphony.module.propertyset.PropertySet;
+import com.opensymphony.workflow.Condition;
+
+/**
+ * Dummy Condition for testing purposes only
+ * 
+ * @author Miguel Fossati
+ *
+ */
+public class DummyCondition implements Condition {
+
+	private Log logger = LogFactory.getLog(DummyCondition.class);
+	
+	public boolean passesCondition(Map arg0, Map arg1, PropertySet arg2) {
+		String name = (String)arg0.get("name");
+		String message = (String)arg0.get("message");
+		logger.info("Condition" +name+ "called with message: " + message);
+		return true;
+	}
+
+}

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyFunctionProvider.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyFunctionProvider.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/osworkflow/dummy/DummyFunctionProvider.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,30 @@
+package org.drools.osworkflow.dummy;
+
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.opensymphony.module.propertyset.PropertySet;
+import com.opensymphony.workflow.FunctionProvider;
+
+/**
+ * FunctionProvider that do nothing but logging a custom message, just for testing purposes.
+ * 
+ * @param name: name of the function
+ * @param message: message to log
+ * 
+ * @author Miguel Fossati
+ *
+ */
+public class DummyFunctionProvider implements FunctionProvider {
+	
+	private Log logger = LogFactory.getLog(DummyFunctionProvider.class);
+
+	public void execute(Map transientVars, Map args, PropertySet ps){
+		String name = (String)args.get("name");
+		String message = (String)args.get("message");
+		logger.info("Function" +name+ "called with message: " + message);
+	}
+
+}

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/suite/SimpleTestSuite.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/suite/SimpleTestSuite.java	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/java/org/drools/suite/SimpleTestSuite.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,19 @@
+package org.drools.suite;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.drools.Simple2ProcessTest;
+import org.drools.SimpleProcessTest;
+
+public class SimpleTestSuite extends TestCase {
+	
+	public static TestSuite suite()
+    {
+        TestSuite suite = new TestSuite();       
+        suite.addTestSuite(SimpleProcessTest.class);
+        suite.addTestSuite(Simple2ProcessTest.class);
+        return suite;
+    }
+
+}

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/CV.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/CV.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/CV.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,817 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<workflow>
+   <initial-actions>
+      <action id="1" name="Curriculum Vitae Ingresado">
+         <pre-functions>
+            <function type="class">
+               <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+               <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+               <arg name="variableName">filialTramite</arg>
+            </function>
+         </pre-functions>
+         <results>
+            <unconditional-result old-status="Finished" status="Curriculum Vitae Ingresado" step="1" owner="JA-FILIAL-${filialTramite}"/>
+         </results>
+      </action>
+   </initial-actions>
+   <steps>
+
+      <step id="1" name="A evaluar por Servicios">
+         <actions>
+
+			<action id="3" name="Pasar a Auditor Medico">
+			<pre-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+					<arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+					<arg name="variableName">filialTramite</arg>
+				</function>
+			</pre-functions>
+				<restrict-to>
+					<conditions type="AND">
+					<condition type="beanshell">
+					<arg name="script">true</arg>
+					</condition>
+					<condition type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					<arg name="GROUP_KEY">JA</arg>
+					</condition>
+					</conditions>
+				</restrict-to>
+					<results>
+					<unconditional-result old-status="CV derivado por Jefe de auditores" status="CV a analizar por Auditoria Medica" step="2" owner="AM-FILIAL-${filialTramite}"/>
+					</results>
+				<post-functions>
+					<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					<arg name="variableName">nothing</arg>
+					</function>
+				</post-functions>		
+			</action>
+
+
+            <action id="7" name="Rechazar">
+		         <pre-functions>
+			          <function type="class">
+				      <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+					  <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+					  <arg name="variableName">filialTramite</arg>
+						</function>
+				  </pre-functions>
+				  <restrict-to>
+						<conditions type="AND">
+						<condition type="beanshell">
+					    <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					    <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					    <arg name="GROUP_KEY">JA</arg>
+						</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Pedido de Rechazo Jefe de Auditores" status="A Evaluar por Servicios" step="1" owner="JA-FILIAL-${filialTramite}"/>
+					</results>
+						 	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+
+			<action id="20" name="Confirmar Rechazo">
+					<restrict-to>
+						<conditions type="AND">
+						<condition type="beanshell">
+						<arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					    <arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+					    <arg name="PRINCIPAL">GEN at CVP</arg>
+						</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+						<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+						<arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+						<arg name="variableName">filialTramite</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Confirma Rechaza Jefe de Auditores" status="Rechazado por Servicios, Carta no impresa" step="25" owner="AM-FILIAL-${filialTramite}"/>
+					</results>
+					<post-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+							<arg name="propertyName">nothing</arg>
+							<arg name="variableName">nothing</arg>
+						</function>
+					</post-functions>	
+				</action>
+
+            <action id="12" name="Rechazar y excepcionar">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">JA</arg>
+						</condition>
+					</conditions>
+				</restrict-to>
+				<results>
+                  <unconditional-result old-status="Pedido de Rechazo y excepcion por Jefe de Auditores" status="A Evaluar por Servicios" step="1" owner="JA-FILIAL-${filialTramite}"/>
+				</results>
+					 	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+
+
+            <action id="9" name="Aprobar">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">JA</arg>
+						</condition>
+					</conditions>
+				</restrict-to>
+               <results>
+                  <unconditional-result old-status="Aprobado por Jefe de Auditores" status="Esperando Auditoria Tecnica/Calidad" step="27" owner="AM-FILIAL-${filialTramite}"/>
+               </results>
+			   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+				</post-functions>	
+		     </action>
+
+			<action id="21" name="Confirmar Aprobacion">
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+					</condition>
+						 <condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+					       <arg name="PRINCIPAL">GEN at CVP</arg>
+					</condition>
+					</conditions>
+				</restrict-to>
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+			   <results>
+                  <unconditional-result old-status="Confirma Aprobacion Jefe de Auditores" status="Esperando Auditoria Tecnica/Calidad" step="27" owner="AM-FILIAL-${filialTramite}"/>
+               </results>
+			   <post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+				</post-functions>	
+            </action>
+	 		 
+            <action id="11" name="Aprobar y excepcionar">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">JA</arg>
+						</condition>
+					</conditions>
+				</restrict-to>
+		           <results>
+			          <unconditional-result old-status="Pedido de aprobacion y excepcion por Jefe de Auditores" status="A Evaluar por Servicios" step="1" owner="JA-FILIAL-${filialTramite}"/>
+				   </results>
+				   	 	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+			 </action>
+
+         <action id="24" name="Finalizar ya es Prestador">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">JA</arg>
+						</condition>
+					</conditions>
+				</restrict-to>
+               <results>
+                  <unconditional-result old-status="Finalizado es prestador" status="Finalizado es prestador" step="4" owner="AE-FILIAL-${filialTramite}"/>
+               </results>
+				<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>		
+			</action>
+         </actions>
+   	  </step>
+      
+	  <step id="2" name="A evaluar por Auditor Medico">
+         <pre-functions>
+            <function type="class">
+               <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+               <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+               <arg name="variableName">filialTramite</arg>
+            </function>
+         </pre-functions>
+
+         <actions>
+       
+			<action id="14" name="Aprobar por Auditoria Medica">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AM</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+               <results>
+                  <unconditional-result old-status="Aprueba Auditor Medico" status="Aprobado por Auditoria Medica" step="1" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+			   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+            
+		
+			<action id="15" name="Rechazar auditor Medico">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AM</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+               <results>
+                  <unconditional-result old-status="Rechaza Auditor Medico" status="En evaluacion por Auditoria medica" step="2" owner="AM-FILIAL-${filialTramite}"/>
+               </results>
+			   	 	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+			</action>
+            
+			<action id="23" name="Confirmacion Rechazo auditor Medico">
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+					</condition>
+						 <condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+					       <arg name="PRINCIPAL">GEN at CVP</arg>
+					</condition>
+					</conditions>
+				</restrict-to>
+				<pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+				<results>
+                  <unconditional-result old-status="Confirma rechazo Auditor Medico" status="Rechazado por Auditoria  Medica" step="1" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+			   	   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+
+			<action id="13" name="Cambiar filial">
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+					</condition>
+						 <condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+					       <arg name="PRINCIPAL">GEN at CVP</arg>
+					</condition>
+					</conditions>
+				</restrict-to>  
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+               <results>
+                  <unconditional-result old-status="Cambio Filial de consultorio" status="Cambio Filial de consultorio" step="1" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+			   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+
+		 </actions>
+   	  </step>
+   
+	  
+	  <!-- ESTE PASO NO LO EJECUTA UN USUARIO -->
+      <step id="4" name="Rechazado">
+         <actions>
+
+            <action id="8" name="Cambio de filial">
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+					</condition>
+					<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+					       <arg name="PRINCIPAL">GEN at CVP</arg>
+					</condition>
+					</conditions>
+				</restrict-to> 
+				<pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+               <results>
+                  <unconditional-result old-status="Cambio Filial de consultorio" status="Cambio Filial de consultorio" step="1" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+			   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+
+
+            <action id="10" name="Postulante modifica el CV">
+		       <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+               <results>
+                  <unconditional-result old-status="Rechazado" status="Postulante modifica CV" step="1" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+			   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+          
+
+			<action id="19" name="Anular rechazo">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+					<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AE</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+
+		       <results>
+                  <unconditional-result old-status="Rechazado" status="Reversion de rechazo" step="1" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+			   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+    			 
+		 </actions>
+      </step>
+      
+	  
+
+	  <step id="5" name="Esperando Alta de Prestador">
+         <actions>
+          
+		<action id="16" name="Ingresar numero de Prestador">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AA</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+			   <results>
+                  <unconditional-result old-status="Pedido de Ingreso numero de prestador" status="Esperando Alta de Prestador" step="05" owner="AA-FILIAL-${filialTramite}"/>
+               </results>
+		 	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+			   
+		<action id="22" name="Confirmacion Ingresar numero">
+				<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+					</condition>
+						 <condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+					       <arg name="PRINCIPAL">GEN at CVP</arg>
+					</condition>
+					</conditions>
+				</restrict-to>
+		          <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+                <results>
+                  <unconditional-result old-status="Ingresa numero de prestador" status="Postulante ingresado" step="17" owner=""/>
+               </results>
+			   	   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+      
+	
+         </actions>
+      </step>
+
+
+
+<step id="25" name="Pendiente Imprimir Rechazo">
+         <actions>
+            
+			<action id="26" name="Imprimir Carta Rechazo">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+      
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AM</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+			   
+			   <results>
+                  <unconditional-result old-status="Imprimir Carta de Rechazo" status="Rechazado,Carta de rechazo Impresa" step="04" owner="AE-FILIAL-${filialTramite}"/>
+               </results>
+
+					<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+           </action>
+
+		<action id="32" name="Anular Rechazo">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+        
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AM</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+			   
+			   <results>
+                  <unconditional-result old-status="Rechazo Anulado" status="Rechazo Anulado" step="01" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+
+					<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+
+            </action>
+
+	
+         </actions>
+      </step>
+
+
+
+
+<step id="27" name="Auditoria de Calidad / Tecnica">
+         <actions>
+            
+			<action id="28" name="Aceptar Auditoria de Calidad / Tecnica">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+        
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AM</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+			   
+			   <results>
+                  <unconditional-result old-status="Auditoria de Calidad/Tecnica realizada" status="Auditoria de Calidad / Tecnica Aprobada" step="30" owner="AA-FILIAL-${filialTramite}"/>
+               </results>
+
+					<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+
+            </action>
+	
+	<action id="29" name="Rechazar Auditoria de Calidad / Tecnica">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+        
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AM</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+			   
+			   <results>
+                  <unconditional-result old-status="Auditoria de Calidad/Tecnica rechazada" status="Auditoria de Calidad / Tecnica Rechazada" step="01" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+
+					<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+
+            </action>
+
+
+         </actions>
+      </step>
+
+
+<step id="30" name="Nota de Alta pendiente">
+         <actions>
+            
+			<action id="31" name="Emitir nota de alta">
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+        
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AA</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+			   
+			   <results>
+                  <unconditional-result old-status="Nota de Alta realizada" status="Nota de Alta realizada - Esperando Alta" step="05" owner="AA-FILIAL-${filialTramite}"/>
+               </results>
+
+					<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+
+            </action>
+
+
+		<action id="18" name="Anular Alta">
+		
+               <pre-functions>
+                  <function type="class">
+                     <arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+                     <arg name="propertyName">CUV.DatosConsultorio.FilialConsultorio</arg>
+                     <arg name="variableName">filialTramite</arg>
+                  </function>
+               </pre-functions>
+
+			<restrict-to>
+					<conditions type="AND">
+						<condition type="beanshell">
+					       <arg name="script">true</arg>
+						</condition>
+						<condition type="class">
+					       <arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       <arg name="GROUP_KEY">AA</arg>
+						</condition>
+					</conditions>
+			</restrict-to>
+			   
+			   <results>
+                  <unconditional-result old-status="" status="Anulacion de Alta" step="01" owner="JA-FILIAL-${filialTramite}"/>
+               </results>
+			   	<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					 <arg name="variableName">nothing</arg>
+				 </function>
+			</post-functions>	
+            </action>
+	
+         </actions>
+      </step>
+
+
+
+      <step id="17" name="Finalizado"/>
+   </steps>
+</workflow>
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/RDA.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/RDA.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/RDA.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,491 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.7//EN" "http://www.opensymphony.com/osworkflow/workflow_2_7.dtd">
+<workflow>
+
+	<initial-actions>
+
+		<action id="1" name="Cargar">
+			<!-- Derivo el WG al grupo Lider / Jefe -->
+			<results>
+				<unconditional-result old-status="Cargada" status="Pend. de Confirmacion por LJ" step="1" owner="LJ"/>
+			</results>
+			<post-functions>
+				<function type="class">
+					<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+					<arg name="propertyName">nothing</arg>
+					<arg name="variableName">nothing</arg>
+				</function>
+			</post-functions>
+		</action>
+
+	</initial-actions>
+
+	<steps>
+
+		<step id="1" name="Autorizacion_Lider_Jefe">
+
+			<actions>
+
+				<action id="101" name="Confirmar">
+					<!-- Restrinjo el acceso a esta accion al grupo/rol LiderJefe o al GEN at RDA. -->
+					<restrict-to>
+						<conditions type="OR">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">LJ</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at RDA</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<!-- Obtengo el RDA_RESPONSABLE_USUARIO. -->
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+							<arg name="propertyName">RDA.RDA_RESPONSABLE_USUARIO</arg>
+							<arg name="variableName">rdaResponsableUsuario</arg>
+						</function>
+						<!-- Obtengo el RDA_RESPONSABLE_GRUPO. -->
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+							<arg name="propertyName">RDA.RDA_RESPONSABLE_GRUPO</arg>
+							<arg name="variableName">rdaResponsableGrupo</arg>
+						</function>
+						<!-- Obtengo el RDA_HAY_GRUPO. -->
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+							<arg name="propertyName">RDA.RDA_HAY_GRUPO</arg>
+							<arg name="variableName">rdaHayGrupo</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<!-- Los resultados se ordenan desde la condicion mas restrictiva a la menos restrictiva -->
+						<!-- por que el primer resultado que se de... es el camino que se sigue. -->
+						<!-- Primero: Si hay grupo y el usuario es GEN at RDA (osea la ejecucion se hizo desde la aplicacion) -->
+						<!-- se deriva el WG al grupo en cuestion. -->
+						<result old-status="Confirmada" status="Pendiente de Confirmacion" step="2" owner="${rdaResponsableGrupo}">
+							<conditions type="AND">
+								<condition type="beanshell">
+       								<arg name="script">"${rdaHayGrupo}".equalsIgnoreCase("SI");</arg>
+								</condition>
+								<condition type="class">
+									<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+									<arg name="PRINCIPAL">GEN at RDA</arg>
+								</condition>
+							</conditions>
+						</result>
+						<!-- Segundo: Si NO hay grupo (por que no se dio la condicion anterior) y el usuario es GEN at RDA -->
+						<!-- se deriva el WG a Compras. -->
+						<result old-status="Confirmada" status="Pendiente de Contratacion" step="3" owner="ACM">
+							<conditions type="AND">
+								<condition type="class">
+									<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+									<arg name="PRINCIPAL">GEN at RDA</arg>
+								</condition>
+							</conditions>
+						</result>
+						<!-- Tercero: Si NO se dio ninguna de las otras opciones se deja el WG en el mismo estado en el que estaba. -->
+						<!-- En este caso el owner es el usuario responsable del RDA. -->
+						<unconditional-result old-status="Cargada" status="Pend. de Confirmacion por LJ" step="1" owner="${rdaResponsableUsuario}"/>
+					</results>
+					<post-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+							<arg name="propertyName">nothing</arg>
+							<arg name="variableName">nothing</arg>
+						</function>
+					</post-functions>
+				</action>
+
+				<action id="102" name="Rechazar">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">LJ</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Rechazada" status="Rechazada" step="5"/>
+					</results>
+					<post-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+							<arg name="propertyName">nothing</arg>
+							<arg name="variableName">nothing</arg>
+						</function>
+					</post-functions>
+				</action>
+
+			</actions>
+
+		</step>
+
+		<step id="2" name="Autorizacion_Nivel_Autorizante">
+
+			<actions>
+
+				<action id="201" name="Verificar: Informacion Incompleta">
+					<restrict-to>
+						<conditions type="OR">
+							<condition type="beanshell">
+								<arg name="script">
+									ar.com.osde.wf.workflow.WorkFlowDocument doc = (ar.com.osde.wf.workflow.WorkFlowDocument)transientVars.get("WORKFLOW_DOCUMENT");
+
+									ar.com.osde.wf.entity.GenericEntity entity = doc.getGenericEntity();
+
+									String rdaRespGrp = entity.getField("RDA_RESPONSABLE_GRUPO").getValue();
+									
+									ar.com.osde.wf.groups.WorkFlowPrincipal p = (ar.com.osde.wf.groups.WorkFlowPrincipal) transientVars.get("WORKFLOW_PRINCIPAL");
+
+									String wfCode = (String)transientVars.get("WORKFLOW_CODE");
+									/*
+									System.out.println("Info Incompleta------------------------" + rdaRespGrp +  "--- " + wfCode);
+									System.out.println(p.hasGroupMembership(rdaRespGrp, wfCode));
+									*/
+									return p.hasGroupMembership(rdaRespGrp, wfCode);
+								</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at RDA</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<!-- Obtengo el RDA_RESPONSABLE_GRUPO. -->
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+							<arg name="propertyName">RDA.RDA_RESPONSABLE_GRUPO</arg>
+							<arg name="variableName">rdaResponsableGrupo</arg>
+						</function>
+					</pre-functions>
+					<!-- Derivo el WG al grupo que recupere. -->
+					<results>
+						<unconditional-result old-status="Verificado Informacion Incompleta" status="Pend. de Verificacion de Informacion Incompleta" step="2" owner="${rdaResponsableGrupo}"/>
+					</results>
+				</action>
+
+				<action id="202" name="Analizar">
+					<restrict-to>
+						<conditions type="OR">
+							<condition type="beanshell">
+								<arg name="script">
+									ar.com.osde.wf.workflow.WorkFlowDocument doc = (ar.com.osde.wf.workflow.WorkFlowDocument)transientVars.get("WORKFLOW_DOCUMENT");
+
+									ar.com.osde.wf.entity.GenericEntity entity = doc.getGenericEntity();
+
+									String rdaRespGrp = entity.getField("RDA_RESPONSABLE_GRUPO").getValue();
+
+									ar.com.osde.wf.groups.WorkFlowPrincipal p = (ar.com.osde.wf.groups.WorkFlowPrincipal) transientVars.get("WORKFLOW_PRINCIPAL");
+
+									String wfCode = (String)transientVars.get("WORKFLOW_CODE");
+
+									/*
+									System.out.println("Analizar------------------------" + rdaRespGrp +  "--- " + wfCode);
+									System.out.println(p.hasGroupMembership(rdaRespGrp, wfCode));
+									*/
+
+									return p.hasGroupMembership(rdaRespGrp, wfCode);
+								</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at RDA</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<!-- Obtengo el RDA_RESPONSABLE_GRUPO. -->
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+							<arg name="propertyName">RDA.RDA_RESPONSABLE_GRUPO</arg>
+							<arg name="variableName">rdaResponsableGrupo</arg>
+						</function>
+					</pre-functions>
+					<!-- Derivo el WG al grupo que recupere. -->
+					<results>
+						<unconditional-result old-status="Analizada" status="Pendiente de Analisis" step="2" owner="${rdaResponsableGrupo}"/>
+					</results>
+				</action>
+
+				<action id="203" name="Confirmar">
+					<restrict-to>
+						<conditions type="OR">
+							<condition type="beanshell">
+								<arg name="script">
+									ar.com.osde.wf.workflow.WorkFlowDocument doc = (ar.com.osde.wf.workflow.WorkFlowDocument)transientVars.get("WORKFLOW_DOCUMENT");
+
+									ar.com.osde.wf.entity.GenericEntity entity = doc.getGenericEntity();
+
+									String rdaRespGrp = entity.getField("RDA_RESPONSABLE_GRUPO").getValue();
+
+									ar.com.osde.wf.groups.WorkFlowPrincipal p = (ar.com.osde.wf.groups.WorkFlowPrincipal) transientVars.get("WORKFLOW_PRINCIPAL");
+
+									String wfCode = (String)transientVars.get("WORKFLOW_CODE");
+									/*
+									System.out.println("Confirmar------------------------" + rdaRespGrp +  "--- " + wfCode);
+									System.out.println(p.hasGroupMembership(rdaRespGrp, wfCode));
+									*/
+									return p.hasGroupMembership(rdaRespGrp, wfCode);
+								</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at RDA</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<!-- Obtengo el RDA_RESPONSABLE_GRUPO. -->
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+							<arg name="propertyName">RDA.RDA_RESPONSABLE_GRUPO</arg>
+							<arg name="variableName">rdaResponsableGrupo</arg>
+						</function>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider</arg>
+							<arg name="propertyName">RDA.RDA_HAY_GRUPO</arg>
+							<arg name="variableName">rdaHayGrupo</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<!-- Los resultados se ordenan desde la condicion mas restrictiva a la menos restrictiva -->
+						<!-- por que el primer resultado que se de... es el camino que se sigue. -->
+						<!-- Primero: Si hay grupo y el usuario es GEN at RDA (osea la ejecucion se hizo desde la aplicacion) -->
+						<!-- se deriva el WG al grupo en cuestion. -->
+						<result old-status="Confirmada" status="Pendiente de Confirmacion" step="2" owner="${rdaResponsableGrupo}">
+							<conditions type="AND">
+								<condition type="beanshell">
+       								<arg name="script">"${rdaHayGrupo}".equalsIgnoreCase("SI");</arg>
+								</condition>
+								<condition type="class">
+									<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+									<arg name="PRINCIPAL">GEN at RDA</arg>
+								</condition>
+							</conditions>
+						</result>
+						<!-- Segundo: Si NO hay grupo (por que no se dio la condicion anterior) y el usuario es GEN at RDA -->
+						<!-- se deriva el WG a Compras. -->
+						<result old-status="Confirmada" status="Pendiente de Contratacion" step="3" owner="ACM">
+							<conditions type="AND">
+								<condition type="class">
+									<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+									<arg name="PRINCIPAL">GEN at RDA</arg>
+								</condition>
+							</conditions>
+						</result>
+						<!-- Tercero: Si NO se dio ninguna de las otras opciones se deja el WG en el mismo estado en el que estaba. -->
+						<!-- En este caso el owner es el usuario responsable del RDA. -->
+						<unconditional-result old-status="Confirmada" status="Pendiente de Confirmacion" step="2" owner="${rdaResponsableGrupo}"/>
+					</results>
+					<post-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+							<arg name="propertyName">nothing</arg>
+							<arg name="variableName">nothing</arg>
+						</function>
+					</post-functions>
+				</action>
+
+				<action id="204" name="Rechazar">
+					<restrict-to>
+						<conditions type="OR">
+							<condition type="beanshell">
+								<arg name="script">
+									ar.com.osde.wf.workflow.WorkFlowDocument doc = (ar.com.osde.wf.workflow.WorkFlowDocument)transientVars.get("WORKFLOW_DOCUMENT");
+
+									ar.com.osde.wf.entity.GenericEntity entity = doc.getGenericEntity();
+
+									String rdaRespGrp = entity.getField("RDA_RESPONSABLE_GRUPO").getValue();
+
+									ar.com.osde.wf.groups.WorkFlowPrincipal p = (ar.com.osde.wf.groups.WorkFlowPrincipal) transientVars.get("WORKFLOW_PRINCIPAL");
+
+									String wfCode = (String)transientVars.get("WORKFLOW_CODE");
+
+									/*
+									System.out.println("Rechazar------------------------" + rdaRespGrp +  "--- " + wfCode);
+									System.out.println(p.hasGroupMembership(rdaRespGrp, wfCode));
+									*/
+									return p.hasGroupMembership(rdaRespGrp, wfCode);
+								</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at RDA</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Rechazada" status="Rechazada" step="5"/>
+					</results>
+					<post-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+							<arg name="propertyName">nothing</arg>
+							<arg name="variableName">nothing</arg>
+						</function>
+					</post-functions>
+				</action>
+
+			</actions>
+
+		</step>
+
+		<step id="3" name="Autorizacion_Compras">
+
+			<actions>
+
+				<action id="301" name="Verificar: Informacion incompleta">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Verificado Informacion Incompleta" status="Pend. de Verificacion de Informacion Incompleta" step="3" owner="ACM"/>
+					</results>
+				</action>
+
+				<action id="302" name="Analizar">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Analizada" status="Pendiente de Analisis" step="3" owner="ACM"/>
+					</results>
+				</action>
+
+				<action id="303" name="Contratar">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Contratada" status="Contratada" step="4"/>
+					</results>
+					<post-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+							<arg name="propertyName">nothing</arg>
+							<arg name="variableName">nothing</arg>
+						</function>
+					</post-functions>
+				</action>
+
+				<action id="304" name="Rechazar">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Rechazada" status="Rechazada" step="5"/>
+					</results>
+					<post-functions>
+						<function type="class">
+							<arg name="class.name">ar.com.osde.wf.workflow.functions.AutomaticReleaseFunctionProvider</arg>
+							<arg name="propertyName">nothing</arg>
+							<arg name="variableName">nothing</arg>
+						</function>
+					</post-functions>
+				</action>
+
+				<action id="305" name="Esperar Cotizacion del Proveedor">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Cotizada" status="En Espera de Cotizacion del Proveedor" step="3" owner="ACM"/>
+					</results>
+				</action>
+
+				<action id="306" name="Esperar Tarifa del Proveedor">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Tarifa recibida" status="En Espera de Tarifa del Proveedor" step="3" owner="ACM"/>
+					</results>
+				</action>
+
+				<action id="307" name="Esperar Documentacion del Proveedor">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Documentacion recibida" status="En Espera de Documentacion del Proveedor" step="3" owner="ACM"/>
+					</results>
+				</action>
+
+				<action id="308" name="Esperar Respuesta de Sistemas">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Respuesta recibida" status="En Espera de Respuesta de Sistemas" step="3" owner="ACM"/>
+					</results>
+				</action>
+
+				<action id="309" name="Gestionar Suministros">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+					       		<arg name="class.name">ar.com.osde.wf.workflow.functions.GroupMembershipCondition</arg>
+					       		<arg name="GROUP_KEY">ACM</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Suministros Gestionados" status="Pend. de Gestion de Suministros" step="3" owner="ACM"/>
+					</results>
+				</action>
+			</actions>
+
+		</step>
+
+		<step id="4" name="Solicitud_Contratada"/>
+
+		<step id="5" name="Solicitud_Rechazada"/>
+
+	</steps>
+
+</workflow>
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista-orig.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista-orig.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista-orig.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,242 @@
+<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_6.dtd">
+<workflow>
+	<initial-actions>
+		<action id="1" name="Crear Entrevista">
+			<pre-functions>
+				<function type="class">
+					<arg name="class.name">
+						ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+					</arg>
+					<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+					<arg name="variableName">filialAsignada</arg>
+				</function>
+			</pre-functions>
+			<results>
+				<unconditional-result old-status="Entrevista Pendiente" status="Entrevista Pendiente" step="1" owner="AO-FILIAL-${filialAsignada}"/>
+			</results>
+		</action>
+	</initial-actions>
+	<steps>
+		<step id="1" name="Esperar Afiliado">
+			<actions>
+				<action id="9" name="Cerrar Entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada" status="Entrevista Cerrada" step="3" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="2" name="Postergar Llamado">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Pendiente 1er Contacto con Afiliado" status="Pendiente 1er Contacto con Afiliado" step="2" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="3" name="Replanificar Entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente" status="Entrevista Pendiente" step="1" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="10" name="Cerrar sin entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Cerrada sin Entrevista" status="Cerrada sin Entrevista" step="3" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="11" name="Confirmar Replanificacion Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente" status="Entrevista Pendiente" step="1"/>
+					</results>
+				</action>
+				<action id="12" name="Confirmar Cierre de Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada" status="Entrevista Cerrada" step="3"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="2" name="Esperar 2do Contacto">
+			<actions>
+				<action id="4" name="Cerrar Entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada" status="Entrevista Cerrada" step="3" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="5" name="Replanificar">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente" status="Entrevista Pendiente" step="1" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="6" name="Cerrar sin entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Cerrada sin Entrevista" status="Cerrada sin Entrevista" step="3" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="7" name="Cerrar sin contacto">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Cerrada sin Contacto" status="Cerrada sin Contacto" step="3" owner="AO-FILIAL-${filialAsignada}"/>
+					</results>
+				</action>
+				<action id="13" name="Confirmar Replanificacion Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente" status="Entrevista Pendiente" step="1"/>
+					</results>
+				</action>
+				<action id="14" name="Confirmar Cierre de Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">ar.com.osde.wf.workflow.functions.CallerPrincipalCondition</arg>
+								<arg name="PRINCIPAL">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								ar.com.osde.wf.workflow.functions.EntityPropertyFunctionProvider
+							</arg>
+							<arg name="propertyName">EntrevistaSUBA.IdFilial</arg>
+							<arg name="variableName">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada" status="Entrevista Cerrada" step="3"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="3" name="Cerrado"/>
+	</steps>
+</workflow>
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/entrevista.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,227 @@
+<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_6.dtd">
+<workflow>
+	<initial-actions>
+		<action id="1" name="Crear Entrevista">
+			<pre-functions>
+				<function type="class">
+					<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+					<arg name="name">EntrevistaSUBA.IdFilial</arg>
+					<arg name="message">filialAsignada</arg>
+				</function>
+			</pre-functions>
+			<results>
+				<unconditional-result old-status="Entrevista Pendiente"
+					status="Entrevista Pendiente" step="1" owner="AO-FILIAL-${filialAsignada}" />
+			</results>
+		</action>
+	</initial-actions>
+	<steps>
+		<step id="1" name="Esperar Afiliado">
+			<actions>
+				<action id="9" name="Cerrar Entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada"
+							status="Entrevista Cerrada" step="3" owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="2" name="Postergar Llamado">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Pendiente 1er Contacto con Afiliado"
+							status="Pendiente 1er Contacto con Afiliado" step="2"
+							owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="3" name="Replanificar Entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente" status="Entrevista Pendiente" step="1" owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="10" name="Cerrar sin entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Cerrada sin Entrevista" status="Cerrada sin Entrevista" step="3" owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="11" name="Confirmar Replanificacion Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">org.drools.osworkflow.dummy.DummyCondition</arg>
+								<arg name="message">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente"	status="Entrevista Pendiente" step="1" />
+					</results>
+				</action>
+				<action id="12" name="Confirmar Cierre de Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">org.drools.osworkflow.dummy.DummyCondition</arg>
+								<arg name="message">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada" status="Entrevista Cerrada" step="3" />
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="2" name="Esperar 2do Contacto">
+			<actions>
+				<action id="4" name="Cerrar Entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada"
+							status="Entrevista Cerrada" step="3" owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="5" name="Replanificar">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente"
+							status="Entrevista Pendiente" step="1" owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="6" name="Cerrar sin entrevista">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Cerrada sin Entrevista"
+							status="Cerrada sin Entrevista" step="3"
+							owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="7" name="Cerrar sin contacto">
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Cerrada sin Contacto"
+							status="Cerrada sin Contacto" step="3" owner="AO-FILIAL-${filialAsignada}" />
+					</results>
+				</action>
+				<action id="13" name="Confirmar Replanificacion Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">org.drools.osworkflow.dummy.DummyCondition</arg>
+								<arg name="message">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Pendiente"
+							status="Entrevista Pendiente" step="1" />
+					</results>
+				</action>
+				<action id="14" name="Confirmar Cierre de Entrevista">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">org.drools.osworkflow.dummy.DummyCondition</arg>
+								<arg name="message">GEN at SUB</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">org.drools.osworkflow.dummy.DummyFunctionProvider</arg>
+							<arg name="name">EntrevistaSUBA.IdFilial</arg>
+							<arg name="message">filialAsignada</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Entrevista Cerrada"
+							status="Entrevista Cerrada" step="3" />
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="3" name="Cerrado" />
+	</steps>
+</workflow>
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/example.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/example.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/example.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,480 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
+<workflow>
+	<initial-actions>
+		<action id="100" name="Start Workflow">
+		<!--
+			<restrict-to>
+				<conditions type="AND">
+					<condition type="beanshell">
+						<arg name="script">true</arg>
+					</condition>
+					<condition type="class">
+						<arg name="class.name">com.opensymphony.workflow.util.OSUserGroupCondition</arg>
+						<arg name="group">foos</arg>
+					</condition>
+				</conditions>
+			</restrict-to> 
+			
+			<validators>
+			 <validator type="beanshell" >
+			  <arg name="script">System.out.println("Validator BEANSHELL");</arg>
+			 </validator>
+			</validators>  -->
+			<pre-functions>
+				<function type="class">
+					<arg name="class.name">com.opensymphony.workflow.util.Caller</arg>
+				</function>
+			</pre-functions>
+			<results>
+				<unconditional-result old-status="Finished" status="Underway" step="1" owner="${caller}"/>
+			</results>
+		</action>
+	</initial-actions>
+	<steps>
+		<step id="1" name="First Draft">
+			<external-permissions>
+				<permission name="permA">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+				</permission>
+			</external-permissions>
+			<actions>
+				<action id="1" name="Finish First Draft">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="beanshell">
+								<arg name="script">true</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<!--   <condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition> -->
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="beanshell">
+							<arg name="script">
+                                String caller = context.getCaller();
+                                propertySet.setString("caller", caller);
+                                boolean test = true;
+                                String yuck = null;
+                                String blah = "987654321";
+                                System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
+                            </arg>
+						</function>
+					</pre-functions>
+					<results>
+						<result old-status="Finished" split="1">
+							<conditions type="AND">
+								<condition type="beanshell">
+									<arg name="script">
+									System.out.println(propertySet.getString("caller"));
+									true;
+									</arg>
+								</condition>
+							</conditions>
+							<post-functions>
+								<function type="beanshell">
+									<arg name="script">
+                                        System.out.println("11111111111111");
+                                    </arg>
+								</function>
+							</post-functions>
+						</result>
+						<unconditional-result old-status="Finished" split="2" owner="${caller}"/>
+					</results>
+					<post-functions>
+						<function type="beanshell">
+							<arg name="script">
+                                System.out.println("22222222222222");
+                            </arg>
+						</function>
+                        <!--
+                        <function type="class">
+                            <arg name="class.name">com.opensymphony.workflow.util.ScheduleJob</arg>
+                            <arg name="triggerId">1</arg>
+                            <arg name="jobName">testJob</arg>
+                            <arg name="triggerName">testTrigger</arg>
+                            <arg name="groupName">test</arg>
+
+                            <arg name="repeat">10</arg>
+                            <arg name="repeatDelay">2000</arg>
+                            <arg name="cronExpression">0,5,10,15,20,25,30,35,40,45,50,55 * * * * ?</arg>
+
+                            <arg name="username">test</arg>
+                            <arg name="password">test</arg>
+
+                            <arg name="local">true</arg>
+                            <arg name="schedulerStart">true</arg>
+                        </function>
+                        -->
+					</post-functions>
+				</action>
+			</actions>
+		</step>
+		<step id="2" name="Edit Doc">
+			<external-permissions>
+				<permission name="permB">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+
+				</permission>
+			</external-permissions>
+			<actions>
+				<action id="2" name="Sign Up For Editing">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Queued</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.OSUserGroupCondition</arg>
+								<arg name="group">bars</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">com.opensymphony.workflow.util.Caller</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished" status="Underway" step="2" owner="${caller}"/>
+					</results>
+				</action>
+				<action id="3" name="Finish Editing">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">com.opensymphony.workflow.util.MostRecentOwner</arg>
+							<arg name="stepId">1</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished" status="Underway" step="3" owner="${mostRecentOwner}"/>
+					</results>
+				</action>
+				<action id="4" name="Requeue Editing">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Finished" status="Queued" step="2"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="3" name="Review Doc">
+			<external-permissions>
+				<permission name="permA">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+				</permission>
+			</external-permissions>
+			<actions>
+				<action id="5" name="More Edits">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">com.opensymphony.workflow.util.MostRecentOwner</arg>
+							<arg name="stepId">2</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished" status="Underway" step="2" owner="${mostRecentOwner}"/>
+					</results>
+				</action>
+				<action id="6" name="Peer Review">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Finished" status="Queued" step="4"/>
+					</results>
+				</action>
+				<action id="7" name="Publish Doc">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">com.opensymphony.workflow.util.MostRecentOwner</arg>
+							<arg name="stepId">2</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished" status="Underway" step="5" owner="${mostRecentOwner}"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="4" name="Second Review">
+			<external-permissions>
+				<permission name="permC">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+				</permission>
+			</external-permissions>
+			<actions>
+				<action id="8" name="Finish Second Review">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">com.opensymphony.workflow.util.MostRecentOwner</arg>
+							<arg name="stepId">3</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished" status="Underway" step="3" owner="${mostRecentOwner}"/>
+					</results>
+				</action>
+				<action id="9" name="Sign Up For Second Review">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Queued</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.OSUserGroupCondition</arg>
+								<arg name="group">bazs</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">com.opensymphony.workflow.util.Caller</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished" status="Underway" step="4" owner="${caller}"/>
+					</results>
+				</action>
+				<action id="10" name="Queue Second Review">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Finished" status="Queued" step="4"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="5" name="Publish Doc">
+			<actions>
+				<action id="11" name="Publish Document">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">com.opensymphony.workflow.util.Caller</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished" status="Finished" step="5" owner="${caller}"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="6" name="Foo">
+			<actions>
+				<action name="Finish Foo" id="12">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+								<arg name="stepId">6</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+								<arg name="stepId">6</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Finished" join="1"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="7" name="Bar">
+			<actions>
+				<action name="Finish Bar" id="13">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+								<arg name="stepId">7</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+								<arg name="stepId">7</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Finished" owner="test" status="Underway" step="8"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="8" name="Baz">
+			<actions>
+				<action name="Finish Baz" id="14">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.StatusCondition</arg>
+								<arg name="status">Underway</arg>
+								<arg name="stepId">8</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">com.opensymphony.workflow.util.AllowOwnerOnlyCondition</arg>
+								<arg name="stepId">8</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Finished" join="1"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+	</steps>
+	<splits>
+		<split id="1">
+			<unconditional-result old-status="Finished" status="Underway" owner="test" step="6"/>
+			<unconditional-result old-status="Finished" status="Underway" owner="test" step="7"/>
+		</split>
+		<split id="2">
+			<unconditional-result old-status="Finished" status="Queued" step="2"/>
+		</split>
+	</splits>
+	<joins>
+		<join id="1">
+			<conditions type="AND">
+				<condition type="beanshell">
+					<arg name="script"><![CDATA[
+					"Finished".equals(jn.getStep(6).getStatus()) && "Finished".equals(jn.getStep(8).getStatus())
+					]]></arg>
+				</condition>
+			</conditions>
+			<unconditional-result old-status="Finished" status="Underway" owner="test" step="2"/>
+		</join>
+	</joins>
+</workflow>
+

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/holiday2.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/holiday2.xml	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/holiday2.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
+<workflow>
+	<initial-actions>
+		<action id="100" name="Start Workflow">
+			<results>
+				<unconditional-result old-status="Finished" status="Underway" step="1"/>
+			</results>
+		</action>
+	</initial-actions>
+	<steps>
+		<step id="1" name="Employee request">
+			<actions>
+				<action id="1" name="Request holidays">
+					<results>
+						<unconditional-result old-status="Finished" split="1" status="Requested"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="2" name="Line Manager revision">
+			<actions>
+				<action id="2" name="Approve" >
+					<results>
+						<unconditional-result old-status="Line aproved" status="joining" join="1" />
+					</results>
+				</action>
+				<action id="3" name="Deny" >
+					<results>
+						<unconditional-result old-status="Line denied" status="joining" join="1"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="3" name="HR Manager revision">
+			<actions>
+				<action id="4" name="HR Approve" >
+					<results>
+						<unconditional-result old-status="HR aproved" status="joining" join="1"/>
+					</results>
+				</action>
+				<action id="5" name="HR Deny" >
+					<results>
+						<unconditional-result old-status="HR denied" status="joining" join="1"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="4" name="Notify employee">
+			<actions>
+				<action id="6" name="Notify"  finish="TRUE" >
+					<results>
+						<unconditional-result old-status="Finished" status="Line approval"  step="-1"/>
+					</results>
+				</action>
+			</actions>
+		</step>
+	</steps>
+	<splits>
+		<split id="1">
+			<unconditional-result old-status="Finished" status="Underway" step="2"/>
+			<unconditional-result old-status="Finished" status="Underway" step="3"/>
+		</split>
+	</splits>
+	<joins>
+		<join id="1">
+			<conditions type="AND">
+				<condition type="beanshell">
+					<arg name="script"><![CDATA[
+					propertySet.setString("result", "denied");
+					if(jn.getStep(2).getStatus().endsWith("aproved") && jn.getStep(3).getStatus().endsWith("aproved")){
+					propertySet.setString("result", "aproved");
+					}
+					 !("Underway".equals(jn.getStep(2).getStatus())) && !("Underway".equals(jn.getStep(3).getStatus()))					]]></arg>
+				</condition>
+			</conditions>
+			<unconditional-result old-status="JoinFinished" status="${result}" step="4"/>
+		</join>
+	</joins>
+</workflow>
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/log4j.properties
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/log4j.properties	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/log4j.properties	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,11 @@
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootCategory=info, CONSOLE
+
+# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
+com.opensymphony.workflow.util.beanshell.BeanShellCondition= debug, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
\ No newline at end of file

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simple.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simple.xml	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simple.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -3,61 +3,68 @@
                  "-//OpenSymphony Group//DTD OSWorkflow 2.8//EN"
                  "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
 <workflow>
-  <initial-actions>
-    <action id="1" name="Start Workflow">
-      <results>
-        <unconditional-result old-status="Finished" status="Queued" step="1"/>
-      </results>
-    </action>
-  </initial-actions>
-  <steps>
-    <step id="1" name="First Draft">
-      <actions>
-        <action id="2" name="Start First Draft">
-          <restrict-to>
-            <conditions>
-              <condition type="class">
-                <arg name="class.name">
-                   com.opensymphony.workflow.util.StatusCondition
-                </arg>
-                <arg name="status">Queued</arg>
-              </condition>
-            </conditions>
-          </restrict-to>
-          <pre-functions>
-            <function type="class">
-              <arg name="class.name">
-                 com.opensymphony.workflow.util.Caller
-              </arg>
-            </function>
-          </pre-functions>
-          <results>
-            <unconditional-result old-status="Finished" status="Underway" 
-                                           step="1"  owner="${caller}"/>
-          </results>
-        </action>
-        <action id="3" name="Finish First Draft">
-          <restrict-to>
-            <conditions type="AND">
-              <condition type="class">
-                <arg name="class.name">
-                    com.opensymphony.workflow.util.StatusCondition
-                </arg>
-                <arg name="status">Underway</arg>
-              </condition>
-              <condition type="class">
-                <arg name="class.name">
-                  com.opensymphony.workflow.util.AllowOwnerOnlyCondition
-                </arg>
-              </condition>
-            </conditions>
-          </restrict-to>
-          <results>
-            <unconditional-result old-status="Finished" status="Queued" step="2"/>
-          </results>
-        </action>
-      </actions>
-    </step>
-    <step id="2" name="finished" />
-  </steps>
+	<initial-actions>
+		<action id="1" name="Start Workflow">
+			<results>
+				<unconditional-result old-status="Finished"
+					status="Queued" step="1" />
+			</results>
+		</action>
+	</initial-actions>
+	<steps>
+		<step id="1" name="First Draft">
+			<actions>
+				<action id="2" name="Start First Draft">
+					<restrict-to>
+						<conditions>
+							<condition type="class">
+								<arg name="class.name">
+									com.opensymphony.workflow.util.StatusCondition
+								</arg>
+								<arg name="status">Queued</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<pre-functions>
+						<function type="class">
+							<arg name="class.name">
+								com.opensymphony.workflow.util.Caller
+							</arg>
+						</function>
+						<function type="beanshell">
+							<arg name="script">
+								System.out.println("Antes de ejecutar el actionId 2");
+							</arg>
+						</function>
+					</pre-functions>
+					<results>
+						<unconditional-result old-status="Finished"
+							status="Underway" step="1" owner="${caller}" />
+					</results>
+				</action>
+				<action id="3" name="Finish First Draft">
+					<restrict-to>
+						<conditions type="AND">
+							<condition type="class">
+								<arg name="class.name">
+									com.opensymphony.workflow.util.StatusCondition
+								</arg>
+								<arg name="status">Underway</arg>
+							</condition>
+							<condition type="class">
+								<arg name="class.name">
+									com.opensymphony.workflow.util.AllowOwnerOnlyCondition
+								</arg>
+							</condition>
+						</conditions>
+					</restrict-to>
+					<results>
+						<unconditional-result old-status="Finished"
+							status="Queued" step="2" />
+					</results>
+				</action>
+			</actions>
+		</step>
+		<step id="2" name="finished" />
+	</steps>
 </workflow>
\ No newline at end of file

Added: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simplerf.rf
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simplerf.rf	                        (rev 0)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/simplerf.rf	2008-12-15 18:45:28 UTC (rev 24383)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<process xmlns="http://drools.org/drools-4.0/osworkflow"
+         xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+         xs:schemaLocation="http://drools.org/drools-4.0/osworkflow drools-osworkflow-4.0.xsd"
+         type="OSWorkflow" name="simple" id="simple" package-name="org.drools.osworkflow" >
+
+  <header>
+  </header>
+
+  <nodes>
+    <step id="2" name="finished" >
+    </step>
+    <step id="1" name="First Draft" >
+      <action id="2" name="Start First Draft">
+        <restrict-to>
+          <conditions>
+            <condition type="class">
+              <arg name="class.name">
+									com.opensymphony.workflow.util.StatusCondition
+								</arg>
+              <arg name="status">Queued</arg>
+            </condition>
+          </conditions>
+        </restrict-to>
+        <pre-functions>
+          <function type="class">
+            <arg name="class.name">
+								com.opensymphony.workflow.util.Caller
+							</arg>
+          </function>
+          <function type="beanshell">
+            <arg name="script"><![CDATA[
+								System.out.println("Antes de ejecutar el actionId 2");
+							]]></arg>
+          </function>
+        </pre-functions>
+        <results>
+          <unconditional-result old-status="Finished" status="Underway" step="1" owner="${caller}"/>
+        </results>
+      </action>
+      <action id="3" name="Finish First Draft">
+        <restrict-to>
+          <conditions type="AND">
+            <condition type="class">
+              <arg name="class.name">
+									com.opensymphony.workflow.util.StatusCondition
+								</arg>
+              <arg name="status">Underway</arg>
+            </condition>
+            <condition type="class">
+              <arg name="class.name">
+									com.opensymphony.workflow.util.AllowOwnerOnlyCondition
+								</arg>
+            </condition>
+          </conditions>
+        </restrict-to>
+        <results>
+          <unconditional-result old-status="Finished" status="Queued" step="2"/>
+        </results>
+      </action>
+    </step>
+  </nodes>
+
+  <connections>
+    <connection from="1" fromType="3" to="2" toType="Queued" />
+  </connections>
+
+</process>

Modified: labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/workflows.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/workflows.xml	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-osworkflow/src/test/resources/workflows.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -1,4 +1,6 @@
 <workflows>
   <workflow name="simple" type="resource" location="simple.xml"/>
   <workflow name="simple2" type="resource" location="simple2.xml"/>
+  <workflow name="holiday2" type="resource" location="holiday2.xml"/>
+  <workflow name="entrevista" type="resource" location="entrevista.xml"/>
 </workflows>
\ No newline at end of file

Modified: labs/jbossrules/branches/mfossati/drools-process-enterprise/.classpath
===================================================================
--- labs/jbossrules/branches/mfossati/drools-process-enterprise/.classpath	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-process-enterprise/.classpath	2008-12-15 18:45:28 UTC (rev 24383)
@@ -1,35 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" including="**" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.1.1/antlr-runtime-3.1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.4.2.v_883_R34x/core-3.4.2.v_883_R34x.jar"/>
-  <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
-  <classpathentry kind="src" path="/drools-api"/>
-  <classpathentry kind="src" path="/drools-compiler"/>
-  <classpathentry kind="src" path="/drools-core"/>
-  <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/com/h2database/h2/1.0.77/h2-1.0.77.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.1.0.GA/hibernate-commons-annotations-3.1.0.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/3.3.0.SP1/hibernate-core-3.3.0.SP1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/3.4.0.GA/hibernate-entitymanager-3.4.0.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/janino/janino/2.5.15/janino-2.5.15.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.0.1/jmock-2.5.0.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/joda-time/joda-time/1.5.2/joda-time-1.5.2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/mvel/mvel2/2.0.4-SNAPSHOT/mvel2-2.0.4-SNAPSHOT.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.2/slf4j-api-1.5.2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-jdk14/1.5.2/slf4j-jdk14-1.5.2.jar"/>
-  <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/2.0.2/xml-apis-2.0.2.jar"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**/*.java" including="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.1.1/antlr-runtime-3.1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.4.2.v_883_R34x/core-3.4.2.v_883_R34x.jar"/>
+	<classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
+	<classpathentry kind="src" path="/drools-api"/>
+	<classpathentry exported="true" kind="src" path="/drools-core"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/com/h2database/h2/1.0.77/h2-1.0.77.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.1.0.GA/hibernate-commons-annotations-3.1.0.GA.jar"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-core/3.3.0.SP1/hibernate-core-3.3.0.SP1.jar"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/3.4.0.GA/hibernate-entitymanager-3.4.0.GA.jar"/>
+	<classpathentry kind="var" path="M2_REPO/janino/janino/2.5.15/janino-2.5.15.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.0.1/jmock-2.5.0.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/joda-time/joda-time/1.5.2/joda-time-1.5.2.jar"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/mvel/mvel2/2.0.4-SNAPSHOT/mvel2-2.0.4-SNAPSHOT.jar"/>
+	<classpathentry exported="true" kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.2/slf4j-api-1.5.2.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-jdk14/1.5.2/slf4j-jdk14-1.5.2.jar"/>
+	<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/2.0.2/xml-apis-2.0.2.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT.jar" sourcepath="M2_REPO/org/drools/drools-compiler/5.0.0.SNAPSHOT/drools-compiler-5.0.0.SNAPSHOT-sources.jar"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: labs/jbossrules/branches/mfossati/drools-process-enterprise/.project
===================================================================
--- labs/jbossrules/branches/mfossati/drools-process-enterprise/.project	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-process-enterprise/.project	2008-12-15 18:45:28 UTC (rev 24383)
@@ -1,11 +1,7 @@
 <projectDescription>
   <name>drools-process-enterprise</name>
   <comment>A rule production system</comment>
-  <projects>
-    <project>drools-api</project>
-    <project>drools-compiler</project>
-    <project>drools-core</project>
-  </projects>
+  <projects/>
   <buildSpec>
     <buildCommand>
       <name>org.eclipse.jdt.core.javabuilder</name>

Modified: labs/jbossrules/branches/mfossati/drools-process-enterprise/pom.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-process-enterprise/pom.xml	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-process-enterprise/pom.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -1,107 +1,106 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <artifactId>drools</artifactId>
-    <groupId>org.drools</groupId>
-    <version>5.0.0.SNAPSHOT</version>
-  </parent>
-
-  <artifactId>drools-process-enterprise</artifactId>
-  <packaging>jar</packaging>
-  <name>Drools :: Process :: Enterprise</name> 
-    
-      <dependencies> 	       
-    	<dependency>
-    		<groupId>org.drools</groupId>
-    		<artifactId>drools-api</artifactId>
-    	</dependency>         		  
-       
-    	<dependency>
-    		<groupId>org.drools</groupId>
-    		<artifactId>drools-core</artifactId>
-    	</dependency>         		  
-       
-    	<dependency>
-    		<groupId>org.drools</groupId>
-    		<artifactId>drools-compiler</artifactId>
-    	</dependency>         		  
-       
-    	<dependency>
-    		<groupId>org.slf4j</groupId>
-    		<artifactId>slf4j-jdk14</artifactId>
-    		<version>1.5.2</version>
-    	</dependency>     	       	
-
-    	<dependency>
-    		<groupId>org.slf4j</groupId>
-    		<artifactId>slf4j-api</artifactId>
-    		<version>1.5.2</version>
-    	</dependency>          	 
-   	
-    	<!-- Hibernate -->
-    	<dependency>
-    		<groupId>org.hibernate</groupId>
-    		<artifactId>hibernate-entitymanager</artifactId>
-    		<version>3.4.0.GA</version>
-    	</dependency>
-
-    	<dependency>
-    		<groupId>org.hibernate</groupId>
-    		<artifactId>hibernate-annotations</artifactId>
-    		<version>3.4.0.GA</version>
-    	</dependency>
-
-    	<dependency>
-    		<groupId>org.hibernate</groupId>
-    		<artifactId>hibernate-commons-annotations</artifactId>
-    		<version>3.1.0.GA</version>
-    	</dependency>
-
-    	<dependency>
-    		<groupId>org.hibernate</groupId>
-    		<artifactId>hibernate-core</artifactId>
-    		<version>3.3.0.SP1</version>
-    	</dependency>
-
-    	<!-- HSQLDB -->
-    	<dependency>
-    		<groupId>com.h2database</groupId>
-    		<artifactId>h2</artifactId>
-    		<version>1.0.77</version>
-    	</dependency>
-    	
-    	<dependency>
-    		<groupId>javax.persistence</groupId>
-    		<artifactId>persistence-api</artifactId>
-    		<version>1.0</version>
-    	</dependency>
-
-    	<dependency>
-    		<groupId>dom4j</groupId>
-    		<artifactId>dom4j</artifactId>
-    		<version>1.6.1</version>
-    	</dependency>
-
-    	<dependency>
-    		<groupId>javassist</groupId>
-    		<artifactId>javassist</artifactId>
-    		<version>3.4.GA</version>
-    	</dependency>
-
-     	<dependency>
-    		<groupId>commons-collections</groupId>
-    		<artifactId>commons-collections</artifactId>
-    		<version>3.2</version>
-    	</dependency>
-
-    	<dependency>
-    		<groupId>javax.transaction</groupId>
-    		<artifactId>jta</artifactId>
-    		<version>1.0.1B</version>
-    	</dependency>
-
-      </dependencies>              
-                  
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<artifactId>drools</artifactId>
+		<groupId>org.drools</groupId>
+		<version>5.0.0.SNAPSHOT</version>
+	</parent>
+	<artifactId>drools-process-enterprise</artifactId>
+	<packaging>jar</packaging>
+	<name>Drools :: Process :: Enterprise</name>
+	<repositories>
+		<repository>
+			<id>snapshots.jboss.org</id>
+			<url>http://snapshots.jboss.org/maven2</url>
+		</repository>
+		<repository>
+			<id>repository.jboss.org</id>
+			<url>http://repository.jboss.org/maven2</url>
+		</repository>
+		<repository>
+			<id>opensimphony</id>
+			<url>http://repo1.maven.org/maven2/</url>
+		</repository>
+		<repository>
+			<id>codehaus</id>
+	 		<url>http://repository.codehaus.org/</url>
+		</repository>
+	</repositories>
+	<dependencies>
+		<dependency>
+			<groupId>org.drools</groupId>
+			<artifactId>drools-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.drools</groupId>
+			<artifactId>drools-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.drools</groupId>
+			<artifactId>drools-compiler</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-jdk14</artifactId>
+			<version>1.5.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.5.2</version>
+		</dependency>
+		<!-- Hibernate -->
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-entitymanager</artifactId>
+			<version>3.4.0.GA</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-annotations</artifactId>
+			<version>3.4.0.GA</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-commons-annotations</artifactId>
+			<version>3.1.0.GA</version>
+		</dependency>
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-core</artifactId>
+			<version>3.3.0.SP1</version>
+		</dependency>
+		<!-- HSQLDB -->
+		<dependency>
+			<groupId>com.h2database</groupId>
+			<artifactId>h2</artifactId>
+			<version>1.0.77</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.persistence</groupId>
+			<artifactId>persistence-api</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>dom4j</groupId>
+			<artifactId>dom4j</artifactId>
+			<version>1.6.1</version>
+		</dependency>
+		<dependency>
+			<groupId>javassist</groupId>
+			<artifactId>javassist</artifactId>
+			<version>3.4.GA</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-collections</groupId>
+			<artifactId>commons-collections</artifactId>
+			<version>3.2</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.transaction</groupId>
+			<artifactId>jta</artifactId>
+			<version>1.0.1B</version>
+		</dependency>
+	</dependencies>
+</project>

Modified: labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/java/org/drools/persistence/processinstance/ProcessInstanceInfo.java
===================================================================
--- labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/java/org/drools/persistence/processinstance/ProcessInstanceInfo.java	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/java/org/drools/persistence/processinstance/ProcessInstanceInfo.java	2008-12-15 18:45:28 UTC (rev 24383)
@@ -20,6 +20,7 @@
 import org.drools.marshalling.MarshallerReaderContext;
 import org.drools.marshalling.MarshallerWriteContext;
 import org.drools.marshalling.OutputMarshaller;
+import org.drools.marshalling.ProcessMarshaller;
 import org.drools.ruleflow.instance.RuleFlowProcessInstance;
 import org.drools.runtime.process.ProcessInstance;
 import org.hibernate.annotations.CollectionOfElements;
@@ -82,7 +83,8 @@
 			try {
 				ByteArrayInputStream bais = new ByteArrayInputStream(processInstanceByteArray);
 				MarshallerReaderContext context = new MarshallerReaderContext(bais, null, null, null);
-				processInstance = InputMarshaller.readProcessInstance(context);
+				ProcessMarshaller marshaller = InputMarshaller.getMarshaller(context);
+				processInstance = marshaller.readProcessInstance(context);
 				context.close();
 			} catch (IOException e) {
 				e.printStackTrace();
@@ -98,7 +100,7 @@
 		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 		try {
 			MarshallerWriteContext context = new MarshallerWriteContext(baos, null, null, null, null);
-			OutputMarshaller.writeProcessInstance(context, (RuleFlowProcessInstance) processInstance);
+			OutputMarshaller.writeProcessInstance(context, processInstance);
 			context.close();
 		} catch (IOException e) {
 			throw new IllegalArgumentException(

Modified: labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/resources/META-INF/persistence.xml
===================================================================
--- labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/resources/META-INF/persistence.xml	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-process-enterprise/src/main/resources/META-INF/persistence.xml	2008-12-15 18:45:28 UTC (rev 24383)
@@ -20,11 +20,12 @@
     <persistence-unit name="org.drools.persistence.jpa">
         <provider>org.hibernate.ejb.HibernatePersistence</provider>
         <class>org.drools.persistence.jpa.ByteArrayObject</class>
-
+        
+ 
 	    <properties>
 	        <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
 	        <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>	        
-	        <property name="hibernate.connection.url" value="jdbc:h2:mem:mydb" />
+	        <property name="hibernate.connection.url" value="jdbc:h2:~/test" />
 	        <!--property name="hibernate.connection.url" value="jdbc:h2:file:/home/kverlaen/NotBackedUp/development/drools/drools-process/drools-process-enterprise/bin/mydb" /-->
 	        
 <!--			<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>-->
@@ -32,7 +33,7 @@
 <!--	        <property name="hibernate.connection.url" value="jdbc:postgresql://localhost/postgres"/>-->
 	        
 	        <property name="hibernate.connection.username" value="sa"/>
-	        <property name="hibernate.connection.password" value="sasa"/>	
+	        <property name="hibernate.connection.password" value=""/>	
 	        <property name="hibernate.connection.autocommit" value="false" /> 	               
 	        <property name="hibernate.max_fetch_depth" value="3"/>
 		    <property name="hibernate.hbm2ddl.auto" value="update" />
@@ -40,4 +41,4 @@
 	    </properties>        
     </persistence-unit>
     
-</persistence>
\ No newline at end of file
+</persistence>

Modified: labs/jbossrules/branches/mfossati/drools-process-enterprise/src/test/resources/META-INF/MyWorkItemHandlers.conf
===================================================================
--- labs/jbossrules/branches/mfossati/drools-process-enterprise/src/test/resources/META-INF/MyWorkItemHandlers.conf	2008-12-15 17:44:49 UTC (rev 24382)
+++ labs/jbossrules/branches/mfossati/drools-process-enterprise/src/test/resources/META-INF/MyWorkItemHandlers.conf	2008-12-15 18:45:28 UTC (rev 24383)
@@ -6,6 +6,6 @@
 
 [
 
-  "MyWork" : TestWorkItemHandler.getInstance()
+  "simple" : TestWorkItemHandler.getInstance()
       
 ]
\ No newline at end of file




More information about the jboss-svn-commits mailing list