cancel
Showing results for 
Search instead for 
Did you mean: 

Query for completed task and display them on page

pylady
Champ in-the-making
Champ in-the-making
Hello,

I want to get completed  tasks between two dates, so I have a query that looks like this one:


HistoryService historyService = processEngine.getHistoryService();
NativeHistoricTaskInstanceQuery taskQuery = historyService.createNativeHistoricTaskInstanceQuery();
ManagementService managementService = processEngine.getManagementService();
taskQuery.sql("SELECT * FROM " + managementService.getTableName(HistoricTaskInstance.class) + " WHERE start_time_>=#{startTime} AND end_time_<=#{endTime}");
taskQuery.parameter("startTime", startTime).parameter("endTime", endTime);
List<HistoricTaskInstance> tasksCompleted = taskQuery.list();

I'm using Alfresco 4.2d and I want to display this list of historicTaskInstances, with its parameters like "type" or "completionDate", on my jsp page.
Can anybody give me a suggestion on how to do this?

I'm a newbie and I would appreciate any help!
Thanks in advance,
Jana
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Hi,

Why are you using a native query for this?
You can do this directly via the HistoricTaskInstanceQuery API.
Is your question how to implement that in JSP?

Best regards,

pylady
Champ in-the-making
Champ in-the-making
I'm using native query because I want to query completed tasks by filtering on the completion date. I think that there's nothing like startedAfter/startedBefore and finishedAfter/finishedBefore methods in the HistoricTaskInstanceQuery class. Please correct me If I'm wrong and you think that I can do this in easier way.
Yes, my question is how to implement that in JSP.

Thank you very much for your answer and for answering my question so quickly!
Best regards,
Jana

trademak
Star Contributor
Star Contributor
Ok, we added this functionality in the current master and it will be part of the Activiti 5.14 release. How you could implement this in JSP is something not really related to Activiti. Activiti doesn't impose any additional requirements on JSP implementations.

Best regards,