jerryfiunam (61) [Avatar] Offline
#1
Hi,

I took a look in Activiti Explorer and I realized that there is a list on the right side of the TaskList called "Events" where all the movements related to the task and even my own comments are deplayed. According to what I have reviwed in the activiti-engine API and DB, these movements and comments are stored in ACT_HI_COMMENT table, is this correct? I wonder if there are methods in the java API I can use in order to store my own coments and events. I realized that in TaskService exist the following methods:

* addComment(String taskId, String processInstanceId, String message)
* getProcessInstanceComments(String processInstanceId)
* getTaskComments(String taskId)
* getTaskEvents(String taskId)

The first question is : Comment and Event are the same? Which table is represented by a Comment and which one by an Event? Which is the purpose of each one?

I guess addComment(String taskId, String processInstanceId, String message) stores a comment in the ACT_HI_COMMENT but how can I specify the UserId, Action and Type on that table? This is beacuse when I change the owner of the task, the comment was stored as "event" type, but when I add a coment by hand, the comment is soted as "comment" type, so I guess there is a way to specify this smilie.

Next question is How can I specify comments in a Process Instance? Because there is not a similar method in RuntimeService.

I wonder if exist specific methods to perform what I have said above in the Java API beacuse I just have detected the previous methods and I would like to know the corrects ones to manage my comments and events.

Thanks a lot smilie

Jerry
tijs.rademakers (494) [Avatar] Offline
#2
Re: ACT_HI_COMMENT , how can I feed this table with Activiti API?
Hi Jerry,

The events mechanism has never been fully implemented yet. What you currently see in the Activiti Explorer is therefore only a demo of what's possible. Comments are a full class citizen of the task entity, but events are not. Comments are stored in the ACT_HI_COMMENT table as you would expect, but events are also stored there. You can only specify comments on tasks. The only method available in the public api is the addComment method and that one statically sets the type to 'comment'. You can't change this via the public api. When you want to store events yourself at the moment you would need to use the non-public api and use internal classes.

Best regards,

Tijs
jerryfiunam (61) [Avatar] Offline
#3
Re: ACT_HI_COMMENT , how can I feed this table with Activiti API?
Thanks a lot for your reply Tijs smilie.

I just wonder what do you mean by "the non-public API and internal clases"?

I wanna coment to you that I have reviewed (not in detail) the source-code of Activiti Explorer but I could not find how the the register of EVENTS is implemented when, for instance, you add a new participant in a task. I hope you can provide to me some help with this, I just would like to see that in order to implement something similar in my webapp because I want to take advantage of that in order to register diferent "types" of COMMENTS for TASKS and PROCESS INSTANCES, not just "event" and "comment" types.

Thanks again for your support Tijs.

Cheers,

JERRY
tijs.rademakers (494) [Avatar] Offline
#4
Re: ACT_HI_COMMENT , how can I feed this table with Activiti API?
Hi Jerry,

In the HistoryManager class there's a good example of how you could implement this. In the createAttachmentComment method you can see that a new CommentEntity is created and filled with values you can easily define yourself. But as I said, this is not part of the public API.

Best regards,

Tijs
jerryfiunam (61) [Avatar] Offline
#5
Re: ACT_HI_COMMENT , how can I feed this table with Activiti API?
Thanks a lot Tijs, this will be very helpful to me.

Regards,

Jerry