[jboss-user] [JBoss jBPM] - Re: JBPM IDentity

cheets do-not-reply at jboss.com
Tue Jul 31 02:07:50 EDT 2007


hi OM, 
in order to use ur own tables for user mgmnt,
u need to implement AssignmentHandler urself, and use it as:

<task-node name="TASK1">
  | <task name="TASK1">
  | <assignment class="a.b.c.d.TaskAssignmentHandler"/>
  | </task>
  | <transition name="" to="NEXT_NODE"></transition>
  | </task-node>


the class itself would be something like this:

  | public class TaskAssignmentHandler implements AssignmentHandler{
  | 		
  | 	private static final long serialVersionUID = 1L;
  | 	
  | public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception {
  | String taskName  = executionContext.getTaskInstance().getTask().getName();
  | long id = executionContext.getProcessInstance().getId();	
  | 		
  | 	//GET POOLED ACTORS AS STRING[] HERE AND ASSIGN.
  | String pooledActors = util.getPooledActorsForTask(taskName); 
  | //util is a class i have created to
  | //interact with my tables, and return the pooled actors for the given taskname.
  | //it contains a mapping for taskname-user role, and based on user role,
  | //it returns a comma-separated string of all users in that role.		
  | if( pooledActors != null ){
  | log.debug(" Assigning task ="+taskName+" to group ="+pooledActors);
  | assignable.setPooledActors(pooledActors.split(","));
  | 		}	
  | else{
  | System.out.println("COULD NOT ASSIGN POOL TO TASK");			
  | 		}
  | //u can also set the actorId here explicitly, i am doing it in another class as:
  | /*TaskInstance task = jbpmContext.getTaskInstanceForUpdate
  | (taskId.longValue());
  | 	task.setActorId(actorId);
  | 	jbpmContext.save(task); */
  | 	}
  | }
  | 
that's it, u r ready to use ur user tables with jbpm now! :)
(at least, this works for me ;)  )
HTH..
:)

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

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



More information about the jboss-user mailing list