cancel
Showing results for 
Search instead for 
Did you mean: 

CompleteListener can not find now task data from act_hi_taskinst table, have solutions?

nova
Champ in-the-making
Champ in-the-making
Hello everyone, I met a problem:I want to get the task end-time(act_hi_taskinst END_TIME_) by CompleteListener, but CompleteListener can not find now task data from act_hi_taskinst table.

The  specific  content:


    // complete task method
    @Transactional
    public void saveAndComplete(TaskService taskService, Model entity,String taskId, Map map) {
        modelDao.save(entity);
        taskService.complete(taskId,map);
    }


<xml>
    <!– complete Listener config –>
    <userTask id="step2" name="send to leader" activiti:assignee="${applyUser}">
      <extensionElements>
        <activiti:taskListener event="complete" delegateExpression="${superviseListener}"/>
      </extensionElements>
    </userTask>
</xml>


// my completeListener
@Component
@Transactional
public class SuperviseListener implements TaskListener {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    protected SuperviseManager superviseManager;

    @Autowired
    protected ModelManager modelManager;

    @Override
    public void notify(DelegateTask execution)  {
        // … …
    }


I  guess  this  problem  may  be  caused  by  the  transaction  control, please give me some advice.
4 REPLIES 4

nova
Champ in-the-making
Champ in-the-making
<code>
   // my complete listener config
   <userTask id="step2" name="send to leader" activiti:assignee="${applyUser}">
      <extensionElements>
        <activiti:taskListener event="complete" delegateExpression="${superviseListener}"/>
      </extensionElements>
    </userTask>
</code>

jbarrez
Star Contributor
Star Contributor
The complete listener is called on complete event. The historic data is not yet persisted. Why do you need that timestamp? Wouldn't it be very close to the current time upon receiving the complete event?

nova
Champ in-the-making
Champ in-the-making
jbarrez, thanks for your advice, I practice your method:

<code>
// my create listener config
   <userTask id="step2" name="send to leader" activiti:assignee="${applyUser}">
      <extensionElements>
        <activiti:taskListener event="create" delegateExpression="${superviseListener}"/>
      </extensionElements>
    </userTask>
</code>

<java>
// my createListener
@Component
@Transactional
public class SuperviseListener implements TaskListener {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    protected SuperviseManager superviseManager;

    @Autowired
    protected ModelManager modelManager;

    @Override
    public void notify(DelegateTask execution)  {
        // via sql to get step1's END_TIME
        // But still can not find
    }
</java>

But still can not find. I have a wrong place?

jbarrez
Star Contributor
Star Contributor
I'm not sure you understood my remark … I was sking why can't you simply use the 'new Date()' for example … why do you need the histpric task?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.