cancel
Showing results for 
Search instead for 
Did you mean: 

Incomplete/Incorrect TaskEntity from ActivitiEntityEventImpl?

kingsheldor
Champ in-the-making
Champ in-the-making
I created an extension of your BaseEntityEventListener and am overriding the onCreate() method.  When I have a new task, it is correctly sending me the ActivitiEntityEvent, from which I am getting the TaskEntity.  However the TaskEntity is not fully populated.  For example it has a null assignee, processInstanceId, name, etc.

Furthermore, when I use the TaskService to get the fully-populated task (using the processInstanceId from the ActivitiEntityEvent), I found that they have different ids.  Why does the TaskEntity from the TaskService query have an id of 308 while the TaskEntity from the event have an id of 502?  Which one is correct?
14 REPLIES 14

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi, (Your Majesty)

However the TaskEntity is not fully populated.
I created pull request with TASK_CREATED event (this event contains fully populated task).
https://github.com/Activiti/Activiti/pull/268
In case of task entity create or initialized events are fired too early.

I found that they have different ids.
That's strange. Could you elaborate it more and create jUnit test for it please?
http://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin

kingsheldor
Champ in-the-making
Champ in-the-making
Your TASK_CREATED event fixed the issue.  Any ideas on when the pull will be merged and when 5.16 will be released?

Also, the different ID's were due to the raw creation event being fired prior to the new task being made the assigned step of the workflow.  Not sure how I missed this before, but the first id was that of the task being completed and the second id was the newly created incomplete task.

Thanks for the help!

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

merge date:
soon. 🙂

release date:
5.16 18/Jun/14

Regards,
Martin

How are things looking for the June 18, 2014 release date?

mrbean
Champ in-the-making
Champ in-the-making
Facing the same problem (using 5.15.1)
When EntityCreated is fired, the TaskEntity object has many empty fields. (I was looking for name and assignee).
The same TaskEntity object (based on the task Id) comes back during EntityDeleted event and has all the information I need.

I imagine the fix will be available in 5.16. Is there another way to get the fix?

Thanks

kingsheldor
Champ in-the-making
Champ in-the-making
I just downloaded the source, applied his pull request patch, and am developing against that.  That fixed the issue, and I'm waiting for the 5.16 release for the official fix.

mrbean
Champ in-the-making
Champ in-the-making
downloaded the source, copied over those three files from commit 93c7bb and rebuilt. Copied the activiti-engine.jar but I don't see any change in the behavior Smiley Sad I must be doing something wrong since it worked for you KingSheldor. June 18 is tomorrow, so may be I can just wait for one more day (if the release is on schedule)
or can I get access to a preview build?

Or may be I will just build the master branch, which should be 5.16 for all practical purposes right?

Built master branch - It builds 5.16-SNAPSHOT. Lets see if that works

So 5.16-SNAPSHOT doesn't seem to fix the problem
Here is the code
<code>
       switch (activitiEvent.getType()) {

            case ENTITY_CREATED:
                Object entityObject = ((ActivitiEntityEvent) activitiEvent).getEntity();
                if (entityObject.getClass().equals(TaskEntity.class))
                    LOGGER.info("Entity Event for " + ((TaskEntity)entityObject).toString());
                LOGGER.info("Entity was created");
                break;
</code>
And the output I am getting is
<code>
12:02:31.851 [main] INFO  r.f.a.event.RFActivitiEventListener - Entity Event for Task[id=11, name=null]
12:02:31.852 [main] INFO  r.f.a.event.RFActivitiEventListener - Entity was created
</code>

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I have checked it once more (TaskEventsTest). Task name is present in the event's task.
I do not know what is the cause of your issue.

Regards
Martin

mrbean
Champ in-the-making
Champ in-the-making
Martin, Thanks for pointer to your test.
  I changed my test similar to yours and the task name was present in all the events. However, when I switch back to the test as I had written it, the task name was null after ENTITY_CREATED and ENTITY_INITIALIZED, however, it did have name after the event TASK_CREATED. TASK_CREATED was not available in 5.15 (and thus not documented), but available in 5.16. So at the moment, I am planning to use that instead of ENTITY_CREATED.
Here is the difference in our tests.
Your test collects the events and then interrogates those after small amount of time. (I suspect that this is allowing the task to be fully filled in when you look at it?)
I am writing out the task as soon as the event is triggered.
Your test is creating the listener in the test and using API to set it up on the processEngine
I am using spring configuration to register the listener and the listener is created as part of the process engine configuration.

Do you have any test that creates the listener in process engine configuration and reports on the event entity as soon as the event is fired?

Thanks