anonymous wrote : Oops - please ignore my earlier message - I didn't read 
carefully. 

I mean the manual of course, so I will answer here to my questions maybe 
somebody will find it useful, but I do not believe so :)

1. In the JBPM manual stands:
anonymous wrote : Start state: supported event types: {node-leave}
So, there is no miracle, why I could not invoke my action on "node-enter" event 
:)

2. The second question related how to start process instance in generic way and 
to cover the situations, when your start-state is either Task-node or some wait 
state, can be solved with additional method in JBPMTemplate (I am using 
springmodules-0.7)

/**
  |    * Create and start process instance
  |    *
  |    * @author agaton
  |    * @param definitionId.
  |    *          The definitionId to be started.
  |    * @return ProcessInstance that is created
  |    */
  |   public ProcessInstance createStartProcessInstance(final long 
definitionId) {
  |     return (ProcessInstance)execute(new JbpmCallback() {
  |       public Object doInJbpm(JbpmContext context) {
  |         ProcessInstance processInstance = null;
  |         ProcessDefinition processDef = context.getGraphSession()
  |                 .getProcessDefinition(definitionId);
  |         if(processDef != null) {
  |           processInstance = (ProcessInstance)processDef.createInstance();
  |           if(processInstance != null) {
  |             if(processInstance.getTaskMgmtInstance()
  |                     .getTaskMgmtDefinition().getStartTask()!=null){
  |                     processInstance.getTaskMgmtInstance()
  |                     .createStartTaskInstance();
  |             }
  |             else{
  |               processInstance.getRootToken().signal();
  |             }
  |             context.save(processInstance);
  |           }
  |         }
  |         return processInstance;
  |       }
  |     });
  |   }

So, if start-state has task (startTask!=null)  createStartTaskInstance() is 
invoked. If opposite, rootToken is signaled.

Thank you for ignoring my questions, apart for Mr Staub, whom I am thankful as 
a polite and nice person, since it helped me to realize how stupid my question 
was.

Cheers
Milan

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012099
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to