Vijay,
 
I've taken a look and you are correct, the work item object should not be reset on completion as that way, listeners or on-exit actions might not have access to it anymore.  I've used another approach to solve the issue that resulted in me adding this reset to -1.  Let me know if this works for you using the latest trunk (r34218, JBRULES-2598).
 
Kris
 
----- Original Message -----
From: Vijay K Pandey
To: Rules Users List
Sent: Wednesday, July 21, 2010 5:28 PM
Subject: [rules-users] FW: Drools 5.1.0.M2 - WorkItemNodeInstance --Listeners can't get hold of WorkItem object

Hi @Salaboy,

 

Did you get a chance to look into this?

 

Thanks

Vijay

 

From: Vijay K Pandey
Sent: Thursday, July 15, 2010 1:26 PM
To: 'rules-users@lists.jboss.org'
Subject: FW: [rules-users] Drools 5.1.0.M2 - WorkItemNodeInstance --Listeners can't get hold of WorkItem object

 

Hi @Salaboy,

 

I am not sure if you received the email below.  Thanks for looking into this.

 

Vijay

From: Vijay K Pandey
Sent: Tuesday, July 13, 2010 8:53 AM
To: 'Mauricio Salatino'
Subject: RE: [rules-users] Drools 5.1.0.M2 - WorkItemNodeInstance --Listeners can't get hold of WorkItem object

 

Thanks for a quick response. I added the Transaction Manager piece of code but the problem still persists. Also it uses the attached persistence.xml file which is placed under META-INF directory that has the correct transaction manager look up class. 

 

Thanks

Vijay

 

 

From: Mauricio Salatino [mailto:salaboy@gmail.com]
Sent: Tuesday, July 13, 2010 6:40 AM
To: Vijay K Pandey
Subject: Re: [rules-users] Drools 5.1.0.M2 - WorkItemNodeInstance --Listeners can't get hold of WorkItem object

 

I've just take a quick look to your file and I notice (without running it) that you didn't set the TransactionManager property to your Environment:

env.set( EnvironmentName.TRANSACTION_MANAGER,



 




 
 
         TransactionManagerServices.getTransactionManager() );

You also need to have the reference to bitronix inside your persistence.xml file:

<property name="hibernate.transaction.manager_lookup_class"



 




 
 
                value="org.hibernate.transaction.BTMTransactionManagerLookup"/>


Can you try this and let me know if it fix your problem?
Greetings

On Tue, Jul 13, 2010 at 12:43 AM, Vijay K Pandey <VPandey@mdes.ms.gov> wrote:

Thanks Salaboy for looking into this.

 

Here is the Junit Test case(java file attached) I created for this problem.

 

Line # 129 fails.

 

Please do let me know if I am doing something wrong or the fix has some issues or maybe there is some other way out to get hold of the “WorkItem” object in the process event listener.

 

Thanks

Vijay

From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Salaboy
Sent: Friday, July 09, 2010 11:11 AM
To: Rules Users List
Subject: Re: [rules-users] Drools 5.1.0.M2 - WorkItemNodeInstance -- Listeners can't get hold of WorkItem object

 

I would like to take a look on this issue. Can you provide me a test case that show the problem? 

- Co-Founder @ http://www.jbug.com.ar

- Mauricio "Salaboy" Salatino -


On Jul 9, 2010, at 12:43, Vijay K Pandey <VPandey@mdes.ms.gov> wrote:

I guess this problem was due to a fix done in WorkItemNodeInstance? Is this the correct behavior? If yes how do we get hold of “WorkItem” instance in the attached listeners?

 

http://fisheye.jboss.org/browse/JBossRules/trunk/drools-core/src/main/java/org/drools/workflow/instance/node/WorkItemNodeInstance.java?r1=32801&r2=

 

Thanks

Vijay

From: Vijay K Pandey
Sent: Tuesday, June 15, 2010 9:20 AM
To: 'Rules Users List'
Subject: RE: Drools 5.1.0.M2 - WorkItemNodeInstance -- Listeners can't get hold of WorkItem object

 

Any one on this issue? Any Drools Flow expert?

 

Appreciate your time for taking a look at it.

 

Thanks

Vijay

From: Vijay K Pandey
Sent: Thursday, June 10, 2010 12:03 PM
To: 'Rules Users List'
Subject: RE: Drools 5.1.0.M2 - WorkItemNodeInstance -- Listeners can't get hold of WorkItem object

 

Should I log this as a JIRA ticket.

 

Thanks

Vijay

From: Vijay K Pandey
Sent: Wednesday, June 09, 2010 9:57 AM
To: 'Rules Users List'
Subject: Drools 5.1.0.M2 - WorkItemNodeInstance -- Listeners can't get hold of WorkItem object

 

Hi,

 

There is a change done in Drools 5.1.0.M2 - org.drools.workflow.instance.node.WorkItemNodeInstance class in the method

 

public void triggerCompleted(WorkItem workItem)     at line 196  which is setting the workItemId as -1

 

this.workItemId = -1;

 

Due to the above change the listeners which are attached to the  “complete” event of the work item – such as the method below

 

public void beforeNodeLeft(ProcessNodeLeftEvent event)  are not able to get hold of the associated workitem object as it returns null.

 

Is there any specific reason that workItemId is set to -1 even before the associated listeners get triggered or is this a bug?

 

If it was an intended change then how do I get hold of the “WorkItem” object in the attached listeners.

 

Thanks

Vijay

p.s This change was not there in the snapshot of 18th April 2010 which I was earlier working on. Above is the only change in this class from the snapshot of 18th April and 5.1.0.M2

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 - CTO @ http://www.plugtree.com 
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar
 
 - Salatino "Salaboy" Mauricio -


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm for more information.