[jboss-user] [JBoss jBPM] - Persistance

maxip do-not-reply at jboss.com
Tue Aug 1 05:46:41 EDT 2006


Hi,

i want to save a process instance (seems to work) and to get back a saved instance.

But the fetched list is empty

heres my code:

whats wrong?

in the log i can see that my process is started and saved...



  | 
  | import java.util.List;
  | 
  | import org.jbpm.JbpmConfiguration;
  | import org.jbpm.JbpmContext;
  | import org.jbpm.graph.def.ProcessDefinition;
  | import org.jbpm.graph.exe.ProcessInstance;
  | import org.jbpm.identity.Entity;
  | import org.jbpm.identity.xml.IdentityXmlParser;
  | 
  | public class TestClass {
  | 
  | 	/**
  | 	 * @param args
  | 	 */
  | 	public static void main(String[] args) {
  | 		JbpmConfiguration.getInstance().createSchema();
  | 		JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
  | 		
  | 		try { 
  | 			//jbpmContext.setActorId("1");
  | 			deployProcessDefinition();
  | 			
  | 			ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate( "SimpleDefinition1" );
  | 			System.out.println( "definition: " + processInstance.getProcessDefinition().getName());
  | 			processInstance.signal();
  | 			jbpmContext.save(processInstance);
  | 			
  | 			
  | 			List mylist = jbpmContext.getTaskList("1");
  | 			processInstance = (ProcessInstance) mylist.get(0);
  | 			
  | 			System.out.println( "definition: " + processInstance.getProcessDefinition().getName());
  | 		}
  | 		finally {
  | 			jbpmContext.close();
  | 		}
  | 	}
  | 
  | 	public static void deployProcessDefinition() {
  | 		ProcessDefinition processDefinition = ProcessDefinition
  | 				.parseXmlString( "<process-definition name='SimpleDefinition1'>" 
  | 						+ "  <start-state name='start'>"
  | 						+ "    <transition to='s' />" 
  | 						+ "  </start-state>" 
  | 						+ "  <state name='s'>"
  | 						+ "    <transition to='end' />" 
  | 						+ "  </state>" 
  | 						+ "  <end-state name='end' />"
  | 						+ "</process-definition>" );
  | 
  | 		JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
  | 		try {
  | 			jbpmContext.deployProcessDefinition( processDefinition );
  | 		}
  | 		finally {
  | 			jbpmContext.close();
  | 		}
  | 	}
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962100#3962100

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962100



More information about the jboss-user mailing list