[jboss-user] [JBoss jBPM] - Task variables

wytten do-not-reply at jboss.com
Fri Jan 30 15:09:11 EST 2009


Hi, 

I'm new to jBPM, and for better or worse I'm diving in at the jBPM 4.0.0 alpha1 end of the pool.

To begin with I've defined a trivial jpdl with start and end nodes, and one task in between.  Then I wrote a bit of code to create process instances and complete the related tasks.  I'm either doing something wrong or something isn't implemented yet, because the documentId is always null at the time when I mark the task complete.  

I'm using alpha1 jars downloaded from http://repository.jboss.com/maven2, together with jbpm.cfg.xml and hibernate.properties copied from the examples/src folder of the jbpm-4.0.0-Alpha1 distribution zip.

I'm pleased with how smoothly this is all working, with the exception of the null documentId.  I'd like to stick with jBPM v4 if possible, but would I be better off cutting my teeth on v3?

Thanks.



  | 	public void run() {
  | 		ProcessEngine processEngine = new Configuration().buildProcessEngine();
  | 
  | 		// define the wf 
  | 		ProcessService processService = processEngine.getProcessService();
  | 		processService.createDeployment().addResource("review.jpdl.xml")
  | 				.deploy();
  | 		
  | 		// create 3 wf process instances
  | 		ExecutionService executionService = processEngine.getExecutionService();
  | 		for (int i=1; i<=3; i++) {
  | 			Map<String,Object> variables = new HashMap<String,Object>();
  | 			variables.put(DOCUMENT_ID, "doc"+i);
  | 			Execution execution = executionService.startExecutionByKey("review", variables);
  | 			LOG.debug("documentId: " + executionService.getVariable(execution.getId(), DOCUMENT_ID));
  | 		}
  | 		
  | 		// retrieve tasks, and mark them complete
  | 		TaskService taskService = processEngine.getTaskService();
  | 		
  | 		List<Task> tasks = taskService.getPersonalTaskList("operator", 0, 10);
  | 		for (Task task : tasks) {
  | 			LOG.debug("task name: " + task.getName());
  | 			
  | 			// TODO: Why aren't Variables in Task interface?
  | 			Map<String,Object> variables = ((TaskImpl) task).getVariables();
  | 			String documentId = (String) variables.get(DOCUMENT_ID);
  | 
  | 			LOG.debug("I'm supposed to review documentId: " + documentId);
  | 			// TODO: Why is documentId always null here?
  | 
  | 			// mark task complete
  | 			taskService.submitTask(task.getId());
  | 		}
  | 		
  | 	}
  | 

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

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



More information about the jboss-user mailing list