[JBoss jBPM] - TaskQuery w/ ProcessInstanceId possible?
by hrworx
I've tried everything I can think of to query tasks by ProcessInstanceId but no matter what, if you put a ProcessInstanceId on a TaskQuery, you get back zero results. The test below runs fine until the last line, when the assertion fails. I have tried substituting different ids in the query, including processInstance.getProcessInstance.getId(), processInstance.getExecutions() and iterating over all the executions and using their ids, and various other attempts without success.
Is it even possible? If anybody can do it, how about pasting a code snippet?
| @Test
| public void testTaskQueryByProcessInstanceId()
| {
|
| TaskQuery taskQueryBefore = getTaskService().createTaskQuery();
| List<Task> taskListBefore = taskQueryBefore.list();
| Assert.assertEquals(0, taskListBefore.size());
|
| ProcessInstance processInstance = createProcessInstance();
| TaskQuery taskQuery = getTaskService().createTaskQuery();
|
| List<Task> taskList = taskQuery.list();
| Assert.assertEquals(2, taskList.size());
|
| TaskQuery taskQuery2 = getTaskService().createTaskQuery();
| taskQuery2.processInstanceId(processInstance.getId());
| List<Task> taskList2 = taskQuery2.list();
|
| Assert.assertEquals(2, taskList2.size());
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4247700#4247700
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4247700
16 years, 8 months
[JBoss jBPM] - Re: taskform in the start activity - form vars dont get pers
by lalitjava
looks like I didnt save the process snippet with the right escapes- sorry! Hope this does the trick :)
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process name="GTRIHelpRequest" xmlns="http://jbpm.org/4.0/jpdl">
|
| <on event="start">
| <event-listener class="gtri.jbpm.pilot.LogListener">
| <field name="msg"><string value="starting the process GTRIHelpRequest"/></field>
| </event-listener>
| </on>
|
|
| <start form="gtri/jbpm/pilot/demo/request_help.ftl" g="0,0,80,40" name="start">
| <on event="start">
| <event-listener class="gtri.jbpm.pilot.LogListener">
| <field name="msg"><string value="In the start activity - start event - of GTRIHelpRequest process"/></field>
| </event-listener>
| </on>
| <transition to="debug_variables"/>
| </start>
|
| <script expr="Just dumping process variables" g="66,10,80,40" name="debug_variables" var="processVarABC">
| <on event="start">
| <event-listener class="gtri.jbpm.pilot.LogListener">
| <field name="msg"><string value="In the debug variables activity - start event - of GTRIHelpRequest process"/></field>
| </event-listener>
| </on>
| <transition to="manager_approval"/>
| </script>
|
| <task candidate-users="peter,mary" form="gtri/jbpm/pilot/demo/manager_approval.ftl" g="163,10,131,40" name="manager_approval">
| <on event="start">
| <event-listener class="gtri.jbpm.pilot.LogListener">
| <field name="msg"><string value="In the manager_approval_test activity - start event - of GTRIHelpRequest process"/></field>
| </event-listener>
| </on>
| <notification/>
| <transition g="-38,-18" name="Allowed" to="is_lab_approval_needed"/>
| <transition g="-38,-18" name="Sorry" to="request_rejected"/>
| </task>
|
|
|
| <decision g="354,85,80,40" name="is_lab_approval_needed">
| <on event="start">
| <event-listener class="gtri.jbpm.pilot.LogListener">
| <field name="msg"><string value="In the is_lab_approval activity - start event - of GTRIHelpRequest process"/></field>
| </event-listener>
| </on>
| <transition to="in_lab_approval_email">
| <condition expr="#{(hr_subcategory=='newhire') || (hr_subcategory=='newconst') || (hr_subcategory=='badge') }"/>
| </transition>
| <transition to="in_request_handling_email"/>
| </decision>
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4247663#4247663
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4247663
16 years, 8 months
[JBoss jBPM] - taskform in the start activity - form vars dont get persiste
by lalitjava
We are using JBPM v4 for a pilot at one of our institute labs.
Since it's a pilot, we are not creating a separate UI to access the TaskService etc. We are instead leveraging the taskforms capability and using FTL templates for forms at different points in the workflow.
One issue that we have run into is that if we have a form associated with the start activity, then none of the form params ( posted via HTTP when the workflow is started through the console) are being persisted into the JBPM4_VAR table till we introduce a halt in the workflow via a task associated with a user/group.
Net effect of this seems to be that if you try to reference any of the form params before this task in the workflow, we get nulls.
After the task (any task with a halt), the form params become available as process instance variables and can be used in the workflow..
Is this an issue that others have run into? Or maybe we are doing something wrong?
Here's the jpd.xml snippet..
This works ..(note the halt we introduce via a manager_approval before we try to reference the hr_subcategory form variable in the is_lab_approval_needed decision activity).
Trying to directly go from start to is_lab_approval_activity fails since hr_subcategory is resolved to null (we get a NPE).
Also, one more quick question - we noticed that the JBPM4_HIST_VAR table never gets populated. The JBPM4_VAR table stores the process variables only as long as the process is active..If we dont want to create our own audit repo and leverage what JBPM4 provides out of the box, where do we see the process variables (we need some of these for an audit trail)?
Regards,
Lalit
<?xml version="1.0" encoding="UTF-8"?>
<event-listener class="gtri.jbpm.pilot.LogListener">
</event-listener>
<event-listener class="gtri.jbpm.pilot.LogListener">
</event-listener>
<event-listener class="gtri.jbpm.pilot.LogListener">
</event-listener>
<task candidate-users="peter,mary" form="gtri/jbpm/pilot/demo/manager_approval.ftl" g="163,10,131,40" name="manager_approval">
<event-listener class="gtri.jbpm.pilot.LogListener">
</event-listener>
<event-listener class="gtri.jbpm.pilot.LogListener">
</event-listener>
<condition expr="#{(hr_subcategory=='newhire') || (hr_subcategory=='newconst') || (hr_subcategory=='badge') }"/>
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4247661#4247661
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4247661
16 years, 8 months