[jboss-user] [JBoss jBPM] - Re: Starting a Process Through API

dhanushgopinath do-not-reply at jboss.com
Fri Oct 31 10:47:26 EDT 2008


That also gives the same error. And the process def is for sure deployed. Other wise it wont create an instance of process def

I was looking into some stuff of code like this. 

BpelGraphSession graphSession = BpelGraphSession
  | 					.getContextInstance(jbpmContext);
  | 
  | 			BpelProcessDefinition bpelProcDef = graphSession
  | 					.findLatestProcessDefinition(procDEfPOJO.getProcessName(),
  | 							procDEfPOJO.getProcessTargetNamespace().getUri());
  | //
  | //			ProcessInstance procInstance = bpelProcDef.createProcessInstance();
  | //			Token startToken = procInstance.getRootToken();
  | //			startToken.signal();
  | 			List listNodes = bpelProcDef.getNodes();
  | 			Map mapNodes = bpelProcDef.getNodesMap();
  | 			
  | 			Set mapKey = mapNodes.keySet();
  | 			Iterator keyIterator = mapKey.iterator();
  | 			while(keyIterator.hasNext())
  | 			{
  | 				Object key = keyIterator.next();
  | 				Scope obj = (Scope) mapNodes.get(key);
  | 				List listNodes2 = obj.getNodes();
  | 				
  | 				for(int i=0;i<listNodes2.size();i++)
  | 				{
  | 					org.jbpm.graph.def.Node node2 = (org.jbpm.graph.def.Node) listNodes2.get(i);
  | 					System.out.println(((Activity)node2).isInitial()); - PRINTS TRUE HERE
  | 					if(node2 instanceof Receive)
  | 					{
  | 						Receive recieve = (Receive) node2;
  | 						System.out.println(recieve.getName());
  | 					}
  | 				}
  | 			}


And then 
			ProcessInstance procInstance = jbpmContext.newProcessInstance("Workflow1");
  | 			procInstance.getRootToken().setNode(node2);
  | 			procInstance.signal();


But the object node2 I am getting is a type of Sequence.

My Receive Task is inside a Sequence.

This much i am able to do.. so i think if i can get the receive activity Node and then set it on the root token it should work. This is just a guess though.



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

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



More information about the jboss-user mailing list