How to use 'HistoricTaskInstance.getTaskLocalVariables'

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2013 10:23 PM
Hi,
In Activiti v5.13, I can't task local values using "HistoricTaskInstance.getTaskLocalVariables()".
In HistoricTaskInstanceEntity.getTaskLocalVariables(), it seems that "queryVariables" is null.
Why?
thanks for help.
In Activiti v5.13, I can't task local values using "HistoricTaskInstance.getTaskLocalVariables()".
HistoricTaskInstance histTask = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult(); Map<String, Object> locValues = histTask.getTaskLocalVariables(); // locValues is Empty!!
In HistoricTaskInstanceEntity.getTaskLocalVariables(), it seems that "queryVariables" is null.
Why?
thanks for help.
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2013 02:38 AM
Hi tamutamu,
It depends on whether the variables are saved with <code>task.setVariable()</code> or <code>task.setVariableLocal()</code>
Maybe this post can help you. It's about the scope of variables:
http://forums.activiti.org/content/does-taskvariablevalueequals-method-does-not-work
It depends on whether the variables are saved with <code>task.setVariable()</code> or <code>task.setVariableLocal()</code>
Maybe this post can help you. It's about the scope of variables:
http://forums.activiti.org/content/does-taskvariablevalueequals-method-does-not-work

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2013 12:44 AM
Thanks aitor!
I read that post.
But, I have not obtain the expected results.
Does'nt <code>Task</code> interface have <code>setVariable()</code> and <code>setVariableLocal()</code>?
<code>TaskService</code> interface has <code>setVariable()</code> and <code>setVariableLocal()</code>.
Since <code>HistoryService</code> also does'nt have <code>setVariable()</code> and <code>setVariableLocal()</code>, I tried to use <code>TaksService.setVariableLocal()</code>.
Below Code,
<java>
Map<String, Object> inVarMap = new HashMap<String, Object>();
inVarMap.put("VAL", "val");
taskService.setVariablesLocal(taskId, inVarMap);
Map<String, Object> outVarMap =
taskService.createTaskQuery().taskId(taskId).singleResult().getTaskLocalVariables(); // But outVarMap is Empty!!
</java>
However it does not work.
Is This Code wrong?
After run the above code, <code>VAL</code> value is stored in Table <code>ACT_RU_VARIABLE</code>, and the value of <code>Task_ID_</code> field is exist.
Thank you for your advice.
I read that post.
But, I have not obtain the expected results.
Does'nt <code>Task</code> interface have <code>setVariable()</code> and <code>setVariableLocal()</code>?
<code>TaskService</code> interface has <code>setVariable()</code> and <code>setVariableLocal()</code>.
Since <code>HistoryService</code> also does'nt have <code>setVariable()</code> and <code>setVariableLocal()</code>, I tried to use <code>TaksService.setVariableLocal()</code>.
Below Code,
<java>
Map<String, Object> inVarMap = new HashMap<String, Object>();
inVarMap.put("VAL", "val");
taskService.setVariablesLocal(taskId, inVarMap);
Map<String, Object> outVarMap =
taskService.createTaskQuery().taskId(taskId).singleResult().getTaskLocalVariables(); // But outVarMap is Empty!!
</java>
However it does not work.
Is This Code wrong?
After run the above code, <code>VAL</code> value is stored in Table <code>ACT_RU_VARIABLE</code>, and the value of <code>Task_ID_</code> field is exist.
Thank you for your advice.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2013 03:51 PM
Hi tamutamu.
I don't want to ask you silly questions. The can be many reasons (is History turned on, did you use historyService.createHistoricTaskInstanceQuery().includeTaskLocalVariables() …..?) The best way could be to create jUnit test.
http://forums.activiti.org/content/sticky-how-write-unit-test
I don't want to ask you silly questions. The can be many reasons (is History turned on, did you use historyService.createHistoricTaskInstanceQuery().includeTaskLocalVariables() …..?) The best way could be to create jUnit test.
http://forums.activiti.org/content/sticky-how-write-unit-test

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2013 12:39 AM
Thanks martin.grofcik!
Explanation is insufficient, and I'm sorry.
I found the cause.
I didn't use <code>includeTaskLocalVariables</code>.
<code>HistoricTaskInstance.getTaskLocalVariables</code> javadoc「if requested 」, it is to call includeTaskLocalVariables in task query, isn't it. I wasn't able to notice that.
Thanks and best regards.
Explanation is insufficient, and I'm sorry.
I found the cause.
I didn't use <code>includeTaskLocalVariables</code>.
<code>HistoricTaskInstance.getTaskLocalVariables</code> javadoc「if requested 」, it is to call includeTaskLocalVariables in task query, isn't it. I wasn't able to notice that.
Thanks and best regards.
