I guess the first "jBPM4" should have been a "jBPM3" in your question.
In jBPM4 the timers are in the JBPM4_JOB table, there is no foreign key to link the entries there to the JBPM4_TASK table so I don't think it is possible to retrieve timers for a specific task. However you can get the timers for an execution or for a process instance since there are fields for that in the JBPM4_TASK table.
Yes, you're right JBPM3.
You've confirmed what I'd pretty much concluded. Unfortunately this doesn't help for standalone tasks. I was looking for a solution that would work for all tasks
Can you explain what you mean by "standalone task"?
As far as I can tell the TaskImpl class has a getExecutionDbid() method. Maybe you can use the executionDbid in a hibernate query to get all jobs/timers for this execution, this should also include the timers for the task...
I mean a task that is not associated with a process instance. May be I'm wrong but I believe this is possible in JBPM4.
I haven't seen tasks without execution in jBPM4 yet, maybe you can explain a bit more about how you create your tasks.
It seems like timers (the TimerImpl class) is not possible without an execution since they need an execution to signal or fire an event to.
I use the following code to get the timers for a specific task:
ExecutionImpl execution = taskImpl.getExecution(); List<TimerImpl> timers = session.createCriteria(TimerImpl.class) .add(Restrictions.eq("execution", execution)) // .add(Restrictions.eq("eventName", "event name here")) .list();
I'm just reviewing my design options to migrate my JBPM CalDav adapter from JBPM3 to 4. Looking at the TaskService api it seems possible to create a task independent of a process / execution; I want to handle tasks associated with a process and those that aren't. In jBPM3 I use the strategy of creating a very basic process with a single task for standalone tasks. This also works in JBPM4. It seems that sticking with this strategy is the simplest way of dealing with timers in all situations.