cancel
Showing results for 
Search instead for 
Did you mean: 

HistoricProcessInstanceQueryImpl processVariableEquals

mitziuro
Champ in-the-making
Champ in-the-making
You once had (december 2011):


/**
* @author Tom Baeyens
* @author Falko Menge
* @author Bernd Ruecker
*/
public class HistoricProcessInstanceQueryImpl extends AbstractVariableQueryImpl<HistoricProcessInstanceQuery, HistoricProcessInstance> implements HistoricProcessInstanceQuery {



public HistoricProcessInstanceQuery processVariableEquals(String variableName, Object variableValue) {
   variables.add(new QueryVariableValue(variableName, variableValue, QueryOperator.EQUALS));
   return this;
}

but now it's gone:

3095 14.12.2011 13:33:48, by trademak
Rollback process variable equals query for history process instances


In HistoricProcessInstance.xml you still have:


     <foreach collection="variables" index="index" item="var">
        and exists (
          select HD.ID_
          from ${prefix}ACT_HI_DETAIL HD
          where
            HD.TYPE_ = 'VariableUpdate'
            and HD.NAME_ =  #{var.name}
            and HD.PROC_INST_ID_ = HPI.PROC_INST_ID_ and HD.TASK_ID_ is null
            and HD.REV_ = (select max(HDM.REV_) from ${prefix}ACT_HI_DETAIL HDM where HDM.PROC_INST_ID_ = HPI.PROC_INST_ID_ and HDM.TASK_ID_ is null and HDM.VAR_TYPE_ = #{var.type} and HDM.NAME_ = #{var.name} and HDM.TYPE_ = 'VariableUpdate')
            and HD.TIME_ = (select max(HDM.TIME_) from ${prefix}ACT_HI_DETAIL HDM where HDM.PROC_INST_ID_ = HPI.PROC_INST_ID_ and HDM.TASK_ID_ is null and HDM.VAR_TYPE_ = #{var.type} and HDM.NAME_ = #{var.name} and HDM.TYPE_ = 'VariableUpdate')

            <if test="!var.type.equals('null')">
              and HD.VAR_TYPE_ = #{var.type}
            </if>
            <!– Variable value –>
            <if test="var.textValue != null &amp;&amp; var.longValue == null &amp;&amp; var.doubleValue == null">
              and HD.TEXT_ =  #{var.textValue}
            </if>
            <if test="var.textValue2 != null">
              and HD.TEXT2_ = #{var.textValue2}
            </if>
            <if test="var.longValue != null">
              and HD.LONG_ = #{var.longValue}
            </if>
            <if test="var.doubleValue != null">
              and HD.DOUBLE_ = #{var.doubleValue}
            </if>
            <!– Null variable type –>
            <if test="var.textValue == null &amp;&amp; var.textValue2 == null &amp;&amp; var.longValue == null &amp;&amp; var.doubleValue == null">
              and HD.TEXT_ is null and HD.TEXT2_ is null and HD.LONG_ is null and HD.DOUBLE_ is null and HD.BYTEARRAY_ID_ is null
            </if>
        )
      </foreach>

so you've just removed the query support.

Is there any particular reason for removing this feature?
We are planning(in our application) to reactivate it(the variable search support), so we were curious if there are any problems with this kind of approach.
2 REPLIES 2

bernd_ruecker
Champ in-the-making
Champ in-the-making
Hi mitziuro.

Actually that was removed because we had not real support for doing that right, because with the history we only recorded changes in the process variables, not the latest value. We changed that recently and introduced a new table for historic process variables (see https://app.camunda.com/confluence/display/foxUserGuide/History#History-ACTHIPROCVARIABLE). Now you can again do this query, but only if the process instances has ended.

This change hasn't made it into 5.10, so it will be available with Activiti 5.11, or you could go with the fox-engine in the latest version (https://app.camunda.com/confluence/display/foxUserGuide/fox+engine), where it is contained as well.

Cheers
Bernd

mitziuro
Champ in-the-making
Champ in-the-making
Ok, thanks.

We've added the old code(method processVariableEquals) in our custom class <extends HistoricProcessInstanceQueryImpl>, until the next Activiti release is available.