org.camunda.bpm.engine.impl
Class HistoricDetailQueryImpl

java.lang.Object
  extended by org.camunda.bpm.engine.impl.db.ListQueryParameterObject
      extended by org.camunda.bpm.engine.impl.AbstractQuery<HistoricDetailQuery,HistoricDetail>
          extended by org.camunda.bpm.engine.impl.HistoricDetailQueryImpl
All Implemented Interfaces:
Serializable, HistoricDetailQuery, Command<Object>, Query<HistoricDetailQuery,HistoricDetail>

public class HistoricDetailQueryImpl
extends AbstractQuery<HistoricDetailQuery,HistoricDetail>
implements HistoricDetailQuery

Author:
Tom Baeyens
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.camunda.bpm.engine.impl.AbstractQuery
AbstractQuery.ResultType
 
Field Summary
protected  String activityId
           
protected  String activityInstanceId
           
protected  String caseExecutionId
           
protected  String caseInstanceId
           
protected  String detailId
           
protected  boolean excludeTaskRelated
           
protected  String executionId
           
protected  boolean isByteArrayFetchingEnabled
           
protected  boolean isCustomObjectDeserializationEnabled
           
protected  String processInstanceId
           
protected  String taskId
           
protected  String[] tenantIds
           
protected  String type
           
protected  String variableInstanceId
           
 
Fields inherited from class org.camunda.bpm.engine.impl.AbstractQuery
commandExecutor, expressions, orderingProperties, resultType, SORTORDER_ASC, SORTORDER_DESC, validators
 
Fields inherited from class org.camunda.bpm.engine.impl.db.ListQueryParameterObject
authCheck, databaseType, DEFAULT_ORDER_BY, firstResult, maxResults, orderBy, parameter, tenantCheck
 
Constructor Summary
HistoricDetailQueryImpl()
           
HistoricDetailQueryImpl(CommandExecutor commandExecutor)
           
 
Method Summary
 HistoricDetailQuery activityId(String activityId)
          Only select historic variable updates associated to the given activity instance.
 HistoricDetailQuery activityInstanceId(String activityInstanceId)
          Only select historic variable updates associated to the given activity instance.
 HistoricDetailQuery caseExecutionId(String caseExecutionId)
          Only select historic variable updates with the given case execution.
 HistoricDetailQuery caseInstanceId(String caseInstanceId)
          Only select historic variable updates with the given case instance.
 HistoricDetailQuery detailId(String id)
          Only select the historic detail with the given id.
 HistoricDetailQuery disableBinaryFetching()
          Disable fetching of byte array and file values.
 HistoricDetailQuery disableCustomObjectDeserialization()
          Disable deserialization of variable values that are custom objects.
 HistoricDetailQuery excludeTaskDetails()
          Exclude all task-related HistoricDetails, so only items which have no task-id set will be selected.
 long executeCount(CommandContext commandContext)
           
 List<HistoricDetail> executeList(CommandContext commandContext, Page page)
          Executes the actual query to retrieve the list of results.
 HistoricDetailQuery executionId(String executionId)
          Only select historic variable updates with the given execution.
 HistoricDetailQuery formFields()
          Only select HistoricFormFields.
 HistoricDetailQuery formProperties()
          Only select HistoricFormPropertys.
 String getActivityId()
           
 String getCaseExecutionId()
           
 String getCaseInstanceId()
           
 String getDetailId()
           
 boolean getExcludeTaskRelated()
           
 String getExecutionId()
           
 String getProcessInstanceId()
           
 String getTaskId()
           
 String getType()
           
 HistoricDetailQuery orderByFormPropertyId()
           
 HistoricDetailQuery orderByProcessInstanceId()
           
 HistoricDetailQuery orderByTenantId()
          Order by tenant id (needs to be followed by Query.asc() or Query.desc()).
 HistoricDetailQuery orderByTime()
           
 HistoricDetailQuery orderByVariableName()
           
 HistoricDetailQuery orderByVariableRevision()
           
 HistoricDetailQuery orderByVariableType()
           
 HistoricDetailQuery orderPartiallyByOccurrence()
          Sort the historic detail events in the order in which they occurred and needs to be followed by Query.asc() or Query.desc().
 HistoricDetailQuery processInstanceId(String processInstanceId)
          Only select historic variable updates with the given process instance.
protected  boolean shouldFetchValue(HistoricDetailVariableInstanceUpdateEntity entity)
           
 HistoricDetailQuery taskId(String taskId)
          Only select historic variable updates associated to the given historic task instance.
 HistoricDetailQuery tenantIdIn(String... tenantIds)
          Only select historic details with one of the given tenant ids.
 HistoricDetailQuery variableInstanceId(String variableInstanceId)
          Only select historic variable updates associated to the given historic variable instance.
 HistoricDetailQuery variableUpdates()
          Only select HistoricVariableUpdates.
 
Methods inherited from class org.camunda.bpm.engine.impl.AbstractQuery
addExpression, addValidator, asc, checkQueryOk, count, desc, direction, evaluateExpressions, evaluateExpressionsAndExecuteCount, evaluateExpressionsAndExecuteList, execute, executeSingleResult, extend, getExpressions, getMethod, getOrderBy, getOrderingProperties, hasExcludingConditions, list, listPage, mergeExpressions, mergeOrdering, orderBy, orderBy, removeValidator, setCommandExecutor, setExpressions, setOrderingProperties, singleResult, validate, validate
 
Methods inherited from class org.camunda.bpm.engine.impl.db.ListQueryParameterObject
getAuthCheck, getDatabaseType, getFirstResult, getFirstRow, getLastRow, getMaxResults, getParameter, getTenantCheck, setAuthCheck, setDatabaseType, setFirstResult, setMaxResults, setOrderBy, setParameter, setTenantCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.camunda.bpm.engine.query.Query
asc, count, desc, list, listPage, singleResult
 

Field Detail

detailId

protected String detailId

taskId

protected String taskId

processInstanceId

protected String processInstanceId

caseInstanceId

protected String caseInstanceId

executionId

protected String executionId

caseExecutionId

protected String caseExecutionId

activityId

protected String activityId

activityInstanceId

protected String activityInstanceId

type

protected String type

variableInstanceId

protected String variableInstanceId

tenantIds

protected String[] tenantIds

excludeTaskRelated

protected boolean excludeTaskRelated

isByteArrayFetchingEnabled

protected boolean isByteArrayFetchingEnabled

isCustomObjectDeserializationEnabled

protected boolean isCustomObjectDeserializationEnabled
Constructor Detail

HistoricDetailQueryImpl

public HistoricDetailQueryImpl()

HistoricDetailQueryImpl

public HistoricDetailQueryImpl(CommandExecutor commandExecutor)
Method Detail

detailId

public HistoricDetailQuery detailId(String id)
Description copied from interface: HistoricDetailQuery
Only select the historic detail with the given id.

Specified by:
detailId in interface HistoricDetailQuery
Parameters:
id - the historic detail to select
Returns:
the query builder

variableInstanceId

public HistoricDetailQuery variableInstanceId(String variableInstanceId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates associated to the given historic variable instance.

Specified by:
variableInstanceId in interface HistoricDetailQuery

processInstanceId

public HistoricDetailQuery processInstanceId(String processInstanceId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates with the given process instance. ProcessInstance ids and HistoricProcessInstance ids match.

Specified by:
processInstanceId in interface HistoricDetailQuery

caseInstanceId

public HistoricDetailQuery caseInstanceId(String caseInstanceId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates with the given case instance. CaseInstance ids and HistoricCaseInstance ids match.

Specified by:
caseInstanceId in interface HistoricDetailQuery

executionId

public HistoricDetailQuery executionId(String executionId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates with the given execution. Note that Execution ids are not stored in the history as first class citizen, only process instances are.

Specified by:
executionId in interface HistoricDetailQuery

caseExecutionId

public HistoricDetailQuery caseExecutionId(String caseExecutionId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates with the given case execution. Note that CaseExecution ids are not stored in the history as first class citizen, only case instances are.

Specified by:
caseExecutionId in interface HistoricDetailQuery

activityId

public HistoricDetailQuery activityId(String activityId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates associated to the given activity instance.

Specified by:
activityId in interface HistoricDetailQuery

activityInstanceId

public HistoricDetailQuery activityInstanceId(String activityInstanceId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates associated to the given activity instance.

Specified by:
activityInstanceId in interface HistoricDetailQuery

taskId

public HistoricDetailQuery taskId(String taskId)
Description copied from interface: HistoricDetailQuery
Only select historic variable updates associated to the given historic task instance.

Specified by:
taskId in interface HistoricDetailQuery

formProperties

public HistoricDetailQuery formProperties()
Description copied from interface: HistoricDetailQuery
Only select HistoricFormPropertys.

Specified by:
formProperties in interface HistoricDetailQuery

formFields

public HistoricDetailQuery formFields()
Description copied from interface: HistoricDetailQuery
Only select HistoricFormFields.

Specified by:
formFields in interface HistoricDetailQuery

variableUpdates

public HistoricDetailQuery variableUpdates()
Description copied from interface: HistoricDetailQuery
Only select HistoricVariableUpdates.

Specified by:
variableUpdates in interface HistoricDetailQuery

tenantIdIn

public HistoricDetailQuery tenantIdIn(String... tenantIds)
Description copied from interface: HistoricDetailQuery
Only select historic details with one of the given tenant ids.

Specified by:
tenantIdIn in interface HistoricDetailQuery

excludeTaskDetails

public HistoricDetailQuery excludeTaskDetails()
Description copied from interface: HistoricDetailQuery
Exclude all task-related HistoricDetails, so only items which have no task-id set will be selected. When used together with HistoricDetailQuery.taskId(String), this call is ignored task details are NOT excluded.

Specified by:
excludeTaskDetails in interface HistoricDetailQuery

executeCount

public long executeCount(CommandContext commandContext)
Specified by:
executeCount in class AbstractQuery<HistoricDetailQuery,HistoricDetail>

disableBinaryFetching

public HistoricDetailQuery disableBinaryFetching()
Description copied from interface: HistoricDetailQuery
Disable fetching of byte array and file values. By default, the query will fetch such values. By calling this method you can prevent the values of (potentially large) blob data chunks to be fetched. The variables themselves are nonetheless included in the query result.

Specified by:
disableBinaryFetching in interface HistoricDetailQuery
Returns:
the query builder

disableCustomObjectDeserialization

public HistoricDetailQuery disableCustomObjectDeserialization()
Description copied from interface: HistoricDetailQuery
Disable deserialization of variable values that are custom objects. By default, the query will attempt to deserialize the value of these variables. By calling this method you can prevent such attempts in environments where their classes are not available. Independent of this setting, variable serialized values are accessible.

Specified by:
disableCustomObjectDeserialization in interface HistoricDetailQuery

executeList

public List<HistoricDetail> executeList(CommandContext commandContext,
                                        Page page)
Description copied from class: AbstractQuery
Executes the actual query to retrieve the list of results.

Specified by:
executeList in class AbstractQuery<HistoricDetailQuery,HistoricDetail>
page - used if the results must be paged. If null, no paging will be applied.

shouldFetchValue

protected boolean shouldFetchValue(HistoricDetailVariableInstanceUpdateEntity entity)

orderByProcessInstanceId

public HistoricDetailQuery orderByProcessInstanceId()
Specified by:
orderByProcessInstanceId in interface HistoricDetailQuery

orderByTime

public HistoricDetailQuery orderByTime()
Specified by:
orderByTime in interface HistoricDetailQuery

orderByVariableName

public HistoricDetailQuery orderByVariableName()
Specified by:
orderByVariableName in interface HistoricDetailQuery

orderByFormPropertyId

public HistoricDetailQuery orderByFormPropertyId()
Specified by:
orderByFormPropertyId in interface HistoricDetailQuery

orderByVariableRevision

public HistoricDetailQuery orderByVariableRevision()
Specified by:
orderByVariableRevision in interface HistoricDetailQuery

orderByVariableType

public HistoricDetailQuery orderByVariableType()
Specified by:
orderByVariableType in interface HistoricDetailQuery

orderPartiallyByOccurrence

public HistoricDetailQuery orderPartiallyByOccurrence()
Description copied from interface: HistoricDetailQuery

Sort the historic detail events in the order in which they occurred and needs to be followed by Query.asc() or Query.desc().

The set of all historic variable update events is a partially ordered set. Due to this fact historic variable update events for two different variable instances are incomparable. So that it is not possible to sort the historic variable update events for two variable instances in the order they occurred. Just for one variable instance the set of historic variable update events can be totally ordered by using HistoricDetailQuery.variableInstanceId(String) and HistoricDetailQuery.orderPartiallyByOccurrence() which will return a result set ordered by its occurrence.

For example:
An execution variable myVariable will be updated multiple times:

runtimeService.setVariable("anExecutionId", "myVariable", 1000);
execution.setVariable("myVariable", 5000);
runtimeService.setVariable("anExecutionId", "myVariable", 2500);
runtimeService.removeVariable("anExecutionId", "myVariable");

As a result there exists four historic variable update events.

By using HistoricDetailQuery.variableInstanceId(String) and HistoricDetailQuery.orderPartiallyByOccurrence() it is possible to sort the events in the order in which they occurred. The following query

historyService.createHistoricDetailQuery()
  .variableInstanceId("myVariableInstId")
  .orderBySequenceCounter()
  .asc()
  .list()

will return the following totally ordered result set

[
  HistoricVariableUpdate[id: "myVariableInstId", variableName: "myVariable", value: 1000],
  HistoricVariableUpdate[id: "myVariableInstId", variableName: "myVariable", value: 5000],
  HistoricVariableUpdate[id: "myVariableInstId", variableName: "myVariable", value: 2500]
  HistoricVariableUpdate[id: "myVariableInstId", variableName: "myVariable", value: null]
]

Note:
Please note that a historic form field event can occur only once.

Specified by:
orderPartiallyByOccurrence in interface HistoricDetailQuery

orderByTenantId

public HistoricDetailQuery orderByTenantId()
Description copied from interface: HistoricDetailQuery
Order by tenant id (needs to be followed by Query.asc() or Query.desc()). Note that the ordering of historic details without tenant id is database-specific.

Specified by:
orderByTenantId in interface HistoricDetailQuery

getProcessInstanceId

public String getProcessInstanceId()

getCaseInstanceId

public String getCaseInstanceId()

getExecutionId

public String getExecutionId()

getCaseExecutionId

public String getCaseExecutionId()

getTaskId

public String getTaskId()

getActivityId

public String getActivityId()

getType

public String getType()

getExcludeTaskRelated

public boolean getExcludeTaskRelated()

getDetailId

public String getDetailId()


Copyright © 2016 camunda services GmbH. All rights reserved.