cancel
Showing results for 
Search instead for 
Did you mean: 

Reloading task possible?

antje
Champ in-the-making
Champ in-the-making
Is it possible to reactivate a task, which is found in the tasklist assigned to an user?
I tried the following code:

    public void reloadProcessByTask(final Task task) {
        m_processInstance = (ExecutionEntity) m_processEngine.getRuntimeService()
            .createExecutionQuery()
            .executionId(task.getExecutionId())
            .singleResult();

        ProcessDefinition procDef = m_processEngine.getRepositoryService()
            .createProcessDefinitionQuery()
            .id(task.getProcessDefinitionId()).singleResult();

        ((ExecutionEntity) m_processInstance).setProcessDefinition((ProcessDefinitionImpl) procDef);
    }

Later the program fails, when I try to get the activities from the processDefinition (activities are empty).
What`s wrong with the code? Is there a better solution to get an old task run?

Thanks
Antje
8 REPLIES 8

frederikherema1
Star Contributor
Star Contributor
Antje,

I guess you can just signal the execution, found in the RuntimeService :

/** Sends an external trigger to an activity instance that is waiting inside the given execution.
   * @param executionId id of execution to signal, cannot be null.
   * @throws ActivitiException when no execution is found for the given executionId.
   */
  void signal(String executionId);

This way, the task is considered executed. Or did you mean to put the task back in 'unnasigned' state?

antje
Champ in-the-making
Champ in-the-making
I tried signal(), but that method steps to the next task in process, so I find a list of tasks with the same executionID. What I want to do, is going to the same task again, wich was canceled before (user closed page), so the user can type his input again.
To open the page again, I need the activities defined in the processDefinition, but the list of activities is empty if I try to load it as described in the first post.

frederikherema1
Star Contributor
Star Contributor
Okay, I misunderstood the question.

Check out http://jira.codehaus.org/browse/ACT-206, this is the behaviour that you are looking for, claiming with userId 'null' should unassign the task.

antje
Champ in-the-making
Champ in-the-making
No, I don`t want to unassign it, I want to leave the page and do something else. Later I want to look into the tasklist and finish the task, which I began before and which is still assigned to me. To do that I must reload the page and find the informations about the interrupted process.

frederikherema1
Star Contributor
Star Contributor
As long as you don't complete the task, it will be available in the tasklist and the process will be halted.

Or do you want to fill in the form-data and save it without actually completing the task?

antje
Champ in-the-making
Champ in-the-making
The task isn`t the problem, I get it from the tasklist. The problem is, that I must find the matching ProcessInstance with the ProcessDefinition. The ProcessDefinition, I get on this way

        ProcessDefinition procDef = m_processEngine.getRepositoryService()
            .createProcessDefinitionQuery()
            .id(task.getProcessDefinitionId()).singleResult();

is not complete, because I miss all informations about activities inside, which I need to open the page correctly. Is there another way to get the ProcessDefiniton?

falko_menge
Champ in-the-making
Champ in-the-making
Yes, you are right.
http://forums.activiti.org/en/viewtopic.php?f=3&t=339&p=1390#p1390 contains a workaround for this problem and there is also a JIRA issue to address it: http://jira.codehaus.org/browse/ACT-172