Package org.flowable.engine

# Interface HistoryService

public interface HistoryService
Service exposing information about ongoing and past process instances. This is different from the runtime information in the sense that this runtime information only contains the actual runtime state at any given moment and it is optimized for runtime process execution performance. The history information is optimized for easy querying and remains permanent in the persistent storage.

Author:
  Christian Stettler, Tom Baeyens, Joram Barrez

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `bulkDeleteHistoricProcessInstances(Collection<String> instanceIds)`
  Performs a bulk delete with the provided process instance ids.
  `HistoricActivityInstanceQuery`
  `createHistoricActivityInstanceQuery()`
  Creates a new programmatic query to search for `HistoricActivityInstance`s.
  `HistoricDetailQuery`
  `createHistoricDetailQuery()`
  Creates a new programmatic query to search for `HistoricDetail`s.
  `HistoricProcessInstanceQuery`
  `createHistoricProcessInstanceQuery()`
  Creates a new programmatic query to search for `HistoricProcessInstance`s.
  `HistoricTaskInstanceQuery`
  `createHistoricTaskInstanceQuery()`
  Creates a new programmatic query to search for `HistoricTaskInstance`s.
  `HistoricTaskLogEntryBuilder`
  `createHistoricTaskLogEntryBuilder()`
  Create new task log entry builder to the log task event without predefined values from the task
  `HistoricTaskLogEntryBuilder`
  `createHistoricTaskLogEntryBuilder(TaskInfo task)`
  Create new task log entry builder to the log task event
  `HistoricTaskLogEntryQuery`
  `createHistoricTaskLogEntryQuery()`
  Returns a new `HistoricTaskLogEntryQuery` that can be used to dynamically query task log entries.
  `HistoricVariableInstanceQuery`
  `createHistoricVariableInstanceQuery()`
  Creates a new programmatic query to search for `HistoricVariableInstance`s.
  `NativeHistoricActivityInstanceQuery`
  `createNativeHistoricActivityInstanceQuery()`
  creates a native query to search for `HistoricActivityInstance`s via SQL
  `NativeHistoricDetailQuery`
  `createNativeHistoricDetailQuery()`
  Returns a new `NativeQuery` for process definitions.
  `NativeHistoricProcessInstanceQuery`
  `createNativeHistoricProcessInstanceQuery()`
  creates a native query to search for `HistoricProcessInstance`s via SQL
  `org.flowable.task.service.history.NativeHistoricTaskInstanceQuery`
  `createNativeHistoricTaskInstanceQuery()`
  creates a native query to search for `HistoricTaskInstance`s via SQL
  `NativeHistoricTaskLogEntryQuery`
  `createNativeHistoricTaskLogEntryQuery()`
  Returns a new `NativeHistoricTaskLogEntryQuery` for `HistoricTaskLogEntry`s.
  `NativeHistoricVariableInstanceQuery`
  `createNativeHistoricVariableInstanceQuery()`
  Returns a new `NativeQuery` for process definitions.
  `ProcessInstanceHistoryLogQuery`
  `createProcessInstanceHistoryLogQuery(String processInstanceId)`
  Allows to retrieve the `ProcessInstanceHistoryLog` for one process instance.
  `void`
  `deleteHistoricProcessInstance(String processInstanceId)`
  Deletes historic process instance.
  `void`
  `deleteHistoricTaskInstance(String taskId)`
  Deletes historic task instance.
  `void`
  `deleteHistoricTaskLogEntry(long logNumber)`
  Deletes user task log entry by its log number
  `void`
  `deleteRelatedDataOfRemovedHistoricProcessInstances()`
  Deletes historic identity links, detail info, variable data and entity links for removed process instances
  `void`
  `deleteTaskAndActivityDataOfRemovedHistoricProcessInstances()`
  Deletes historic task and activity data for removed process instances
  `List<org.flowable.entitylink.api.history.HistoricEntityLink>`
  `getHistoricEntityLinkChildrenForProcessInstance(String processInstanceId)`
  Retrieves the `HistoricEntityLink`s associated with the given process instance.
  `List<org.flowable.entitylink.api.history.HistoricEntityLink>`
  `getHistoricEntityLinkChildrenForTask(String taskId)`
  Retrieves the `HistoricEntityLink`s associated with the given task.
  `List<org.flowable.entitylink.api.history.HistoricEntityLink>`
  `getHistoricEntityLinkChildrenWithSameRootAsProcessInstance(String processInstanceId)`
  Retrieves all the `HistoricEntityLink`s associated with same root as the given process instance.
  `List<org.flowable.entitylink.api.history.HistoricEntityLink>`
  `getHistoricEntityLinkParentsForProcessInstance(String processInstanceId)`
  Retrieves the `HistoricEntityLink`s where the given process instance is referenced.
  `List<org.flowable.entitylink.api.history.HistoricEntityLink>`
  `getHistoricEntityLinkParentsForTask(String taskId)`
  Retrieves the `HistoricEntityLink`s where the given task is referenced.
  `List<HistoricIdentityLink>`
  `getHistoricIdentityLinksForProcessInstance(String processInstanceId)`
  Retrieves the `HistoricIdentityLink`s associated with the given process instance.
  `List<HistoricIdentityLink>`
  `getHistoricIdentityLinksForTask(String taskId)`
  Retrieves the `HistoricIdentityLink`s associated with the given task.

- ## Method Details

  - ### createHistoricProcessInstanceQuery

    HistoricProcessInstanceQuery createHistoricProcessInstanceQuery()
    Creates a new programmatic query to search for `HistoricProcessInstance`s.

  - ### createHistoricActivityInstanceQuery

    HistoricActivityInstanceQuery createHistoricActivityInstanceQuery()
    Creates a new programmatic query to search for `HistoricActivityInstance`s.

  - ### createHistoricTaskInstanceQuery

    HistoricTaskInstanceQuery createHistoricTaskInstanceQuery()
    Creates a new programmatic query to search for `HistoricTaskInstance`s.

  - ### createHistoricDetailQuery

    HistoricDetailQuery createHistoricDetailQuery()
    Creates a new programmatic query to search for `HistoricDetail`s.

  - ### createNativeHistoricDetailQuery

    NativeHistoricDetailQuery createNativeHistoricDetailQuery()
    Returns a new `NativeQuery` for process definitions.

  - ### createHistoricVariableInstanceQuery

    HistoricVariableInstanceQuery createHistoricVariableInstanceQuery()
    Creates a new programmatic query to search for `HistoricVariableInstance`s.

  - ### createNativeHistoricVariableInstanceQuery

    NativeHistoricVariableInstanceQuery createNativeHistoricVariableInstanceQuery()
    Returns a new `NativeQuery` for process definitions.

  - ### deleteHistoricTaskInstance

    void deleteHistoricTaskInstance(String taskId)
    Deletes historic task instance. This might be useful for tasks that are `dynamically created` and then `completed`. If the historic task instance doesn't exist, no exception is thrown and the method returns normal.

  - ### deleteHistoricProcessInstance

    void deleteHistoricProcessInstance(String processInstanceId)
    Deletes historic process instance. All historic activities, historic task and historic details (variable updates, form properties) are deleted as well.

  - ### bulkDeleteHistoricProcessInstances

    void bulkDeleteHistoricProcessInstances(Collection<String> instanceIds)
    Performs a bulk delete with the provided process instance ids. All historic activities, historic tasks and historic details (variable updates, form properties) are deleted as well.

  - ### deleteTaskAndActivityDataOfRemovedHistoricProcessInstances

    void deleteTaskAndActivityDataOfRemovedHistoricProcessInstances()
    Deletes historic task and activity data for removed process instances

  - ### deleteRelatedDataOfRemovedHistoricProcessInstances

    void deleteRelatedDataOfRemovedHistoricProcessInstances()
    Deletes historic identity links, detail info, variable data and entity links for removed process instances

  - ### createNativeHistoricProcessInstanceQuery

    NativeHistoricProcessInstanceQuery createNativeHistoricProcessInstanceQuery()
    creates a native query to search for `HistoricProcessInstance`s via SQL

  - ### createNativeHistoricTaskInstanceQuery

    org.flowable.task.service.history.NativeHistoricTaskInstanceQuery createNativeHistoricTaskInstanceQuery()
    creates a native query to search for `HistoricTaskInstance`s via SQL

  - ### createNativeHistoricActivityInstanceQuery

    NativeHistoricActivityInstanceQuery createNativeHistoricActivityInstanceQuery()
    creates a native query to search for `HistoricActivityInstance`s via SQL

  - ### getHistoricIdentityLinksForTask

    List<HistoricIdentityLink> getHistoricIdentityLinksForTask(String taskId)
    Retrieves the `HistoricIdentityLink`s associated with the given task. Such an `IdentityLink` informs how a certain identity (eg. group or user) is associated with a certain task (eg. as candidate, assignee, etc.), even if the task is completed as opposed to `IdentityLink`s which only exist for active tasks.

  - ### getHistoricIdentityLinksForProcessInstance

    List<HistoricIdentityLink> getHistoricIdentityLinksForProcessInstance(String processInstanceId)
    Retrieves the `HistoricIdentityLink`s associated with the given process instance. Such an `IdentityLink` informs how a certain identity (eg. group or user) is associated with a certain process instance, even if the instance is completed as opposed to `IdentityLink`s which only exist for active instances.

  - ### getHistoricEntityLinkChildrenForProcessInstance

    List<org.flowable.entitylink.api.history.HistoricEntityLink> getHistoricEntityLinkChildrenForProcessInstance(String processInstanceId)
    Retrieves the `HistoricEntityLink`s associated with the given process instance.

  - ### getHistoricEntityLinkChildrenWithSameRootAsProcessInstance

    List<org.flowable.entitylink.api.history.HistoricEntityLink> getHistoricEntityLinkChildrenWithSameRootAsProcessInstance(String processInstanceId)
    Retrieves all the `HistoricEntityLink`s associated with same root as the given process instance.

  - ### getHistoricEntityLinkChildrenForTask

    List<org.flowable.entitylink.api.history.HistoricEntityLink> getHistoricEntityLinkChildrenForTask(String taskId)
    Retrieves the `HistoricEntityLink`s associated with the given task.

  - ### getHistoricEntityLinkParentsForProcessInstance

    List<org.flowable.entitylink.api.history.HistoricEntityLink> getHistoricEntityLinkParentsForProcessInstance(String processInstanceId)
    Retrieves the `HistoricEntityLink`s where the given process instance is referenced.

  - ### getHistoricEntityLinkParentsForTask

    List<org.flowable.entitylink.api.history.HistoricEntityLink> getHistoricEntityLinkParentsForTask(String taskId)
    Retrieves the `HistoricEntityLink`s where the given task is referenced.

  - ### createProcessInstanceHistoryLogQuery

    ProcessInstanceHistoryLogQuery createProcessInstanceHistoryLogQuery(String processInstanceId)
    Allows to retrieve the `ProcessInstanceHistoryLog` for one process instance.

  - ### deleteHistoricTaskLogEntry

    void deleteHistoricTaskLogEntry(long logNumber)
    Deletes user task log entry by its log number
    Parameters:
      `logNumber` - user task log entry identifier

  - ### createHistoricTaskLogEntryBuilder

    HistoricTaskLogEntryBuilder createHistoricTaskLogEntryBuilder(TaskInfo task)
    Create new task log entry builder to the log task event
    Parameters:
      `task` - to which is log related to

  - ### createHistoricTaskLogEntryBuilder

    HistoricTaskLogEntryBuilder createHistoricTaskLogEntryBuilder()
    Create new task log entry builder to the log task event without predefined values from the task

  - ### createHistoricTaskLogEntryQuery

    HistoricTaskLogEntryQuery createHistoricTaskLogEntryQuery()
    Returns a new `HistoricTaskLogEntryQuery` that can be used to dynamically query task log entries.

  - ### createNativeHistoricTaskLogEntryQuery

    NativeHistoricTaskLogEntryQuery createNativeHistoricTaskLogEntryQuery()
    Returns a new `NativeHistoricTaskLogEntryQuery` for `HistoricTaskLogEntry`s.