[jboss-user] [JBoss Seam] - Dynamic creation of JBPM processes

chawax do-not-reply at jboss.com
Mon Dec 3 05:06:40 EST 2007


I need to start a JBPM process, but in some cases I can't use the @CreateProcess annotation since the process I need to start depends on an runtime value. I also need to outject variables to the business process. But I can't find how to do this ...

What I did :

- I injected businessProcess component in my class :

@org.jboss.seam.annotations.In(create = true)
  | protected org.jboss.seam.bpm.BusinessProcess businessProcess;

- I used @Out annotation to outject the variables in my business process :

@org.jboss.seam.annotations.Out(required = false, scope = org.jboss.seam.ScopeType.BUSINESS_PROCESS)
  | protected java.lang.Long idDemandeAbsence;
  | @org.jboss.seam.annotations.Out(required = false, scope = org.jboss.seam.ScopeType.BUSINESS_PROCESS)
  | protected java.lang.String codeMotifAbsence;

- Then I set these variables and call BusinessProcess.createProcess method :

protected void handleValider() throws java.lang.Exception {
  |     this.idDemandeAbsence = this.demandeAbsence.getId();
  |     this.codeMotifAbsence = this.ligneDemandeAbsence.getMotif();
  |     this.businessProcess.createProcess("validationDemandeAbsence");
  | }

It looks like the business process starts, but the outjection of variables in the business process does not seem to work ... What I understand is that the outjection is made by Seam after the handleValider() method is called. But the business process starts on the createProcess() method call, so it looks obvious that variables have not been injected yet ... 

Any idea how I should do this ?

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

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

More information about the jboss-user mailing list