Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1154008

Summary: Output Data Mapping of User Task discards used process variable
Product: [Retired] JBoss BPMS Platform 6 Reporter: Jozef Marko <jomarko>
Component: jBPM CoreAssignee: Maciej Swiderski <mswiders>
Status: CLOSED NOTABUG QA Contact: Jozef Marko <jomarko>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-17 09:36:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
source and screenshots none

Description Jozef Marko 2014-10-17 09:18:59 UTC
I have created some simple BPM process in JBDSIS-8.0.0.Alpha2. I have attached source xml of my process and some important screenshots.

I am trying to run modeled proces in way of:
...
...
...
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
Map<String, Object> data = new HashMap<String, Object>();
data.put("test", "testValue");
ProcessInstance process = ksession.startProcess("UserTaskProcess", data);
...
...
...

'handler' is simple instance of custom 'WorkItemHandler' which overrides executeWorkItem in this way:

public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
        manager.completeWorkItem(workItem.getId(), null);
}

I have debugged quite a lot of time, and I checked out this. I am accessing process variable 'test' in this way:

(WorkflowProcessInstance) process.getVariable("test");

The code above returns value of variable test, but only before 'User Task' is completed. After User Task is completed, code above returns null.

If I remove from my model Data Output Mapping on User Task node, (WorkflowProcessInstance) process.getVariable("test"); returns correct value whenever I call it.

Data Output Mapping I have set up according this User Guide, section 6.3.3. User Task - Result mapping, where is mention about 'ActorId' variable.

Comment 1 Jozef Marko 2014-10-17 09:19:29 UTC
Created attachment 947840 [details]
source and screenshots

Comment 2 Maciej Swiderski 2014-10-17 09:24:48 UTC
problm is that you ask process engine to map a value to a variable but you don't provide the value when completing your work item.

manager.completeWorkItem(workItem.getId(), null);

You need to pass the value that you want to map to process variable. In your case it must be:

Map<String, Object> result = new HashMap<String, Object>();
result.put("ActorId", "my value from handler");

manager.completeWorkItem(workItem.getId(), result);

with that process engine will have a value to set, otherwise you explicitly ask to rest your data output mapping variables.

Once confirmed, please close the issue.

Comment 3 Jozef Marko 2014-10-17 09:36:07 UTC
Maciej, you are great. Thanks a lot and sorry.