Package org.kie.api.runtime.manager.audit

## Interface AuditService

-     public interface AuditService

  AuditService provides access to active and already completed process (and its components) data. Delivers data about:
  - Process instances
  - Node instances
  - Variable instances
  there might be some limitations in various implementations thus some of the methods might throw `UnsupportedOperationException`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clear()` | Removes all entries from audit data store
    `void` | `dispose()` | Indicates that work with this instance of `AuditService` is completed and can be disposed (release resources)
    `List<? extends ProcessInstanceLog>` | `findActiveProcessInstances​(String processId)` | Returns all active process instances for given process id
    `List<? extends NodeInstanceLog>` | `findNodeInstances​(String processInstanceId)` | Returns all node instances that were already triggered for given process instance id
    `List<? extends NodeInstanceLog>` | `findNodeInstances​(String processInstanceId, String nodeId)` |
    `ProcessInstanceLog` | `findProcessInstance​(String processInstanceId)` | Returns process instance log for given process instance id
    `List<? extends ProcessInstanceLog>` | `findProcessInstances()` | Returns all known process instances currently available to the audit service
    `List<? extends ProcessInstanceLog>` | `findProcessInstances​(String processId)` | Returns all known process instances for given process id
    `List<? extends ProcessInstanceLog>` | `findSubProcessInstances​(String processInstanceId)` | Returns all known subprocess instance logs for given process instance id - considered parent process instance id
    `List<? extends VariableInstanceLog>` | `findVariableInstances​(String processInstanceId)` | Returns all variable logs for given process instance id
    `List<? extends VariableInstanceLog>` | `findVariableInstances​(String processInstanceId, String variableId)` | Returns all variable logs for given process instance id and variable identifier
    `List<? extends VariableInstanceLog>` | `findVariableInstancesByName​(String variableId, boolean onlyActiveProcesses)` | Returns all variable logs that are identified by variable id regardless of what process instance they belong to
    `List<? extends VariableInstanceLog>` | `findVariableInstancesByNameAndValue​(String variableId, String value, boolean onlyActiveProcesses)` | Returns all variable logs that are identified by variable id and has given value regardless of what process instance they belong to

- - ### Method Detail

    - #### findProcessInstances

          List<? extends ProcessInstanceLog> findProcessInstances()

      Returns all known process instances currently available to the audit service
      Returns:
        all process instance logs or empty list if none were found

    - #### findProcessInstances

          List<? extends ProcessInstanceLog> findProcessInstances​(String processId)

      Returns all known process instances for given process id
      Parameters:
        `processId` - identifier of the process definition
      Returns:
        all process instance logs for given process id or empty list if none were found

    - #### findActiveProcessInstances

          List<? extends ProcessInstanceLog> findActiveProcessInstances​(String processId)

      Returns all active process instances for given process id
      Parameters:
        `processId` - identifier of the process definition
      Returns:
        all active process instance logs for given process id or empty list if none were found

    - #### findProcessInstance

          ProcessInstanceLog findProcessInstance​(String processInstanceId)

      Returns process instance log for given process instance id
      Parameters:
        `processInstanceId` - unique identifier of process instance
      Returns:
        process instance log for given process instance id or null if not found

    - #### findSubProcessInstances

          List<? extends ProcessInstanceLog> findSubProcessInstances​(String processInstanceId)

      Returns all known subprocess instance logs for given process instance id - considered parent process instance id
      Parameters:
        `processInstanceId` - identifier of the parent process instance id
      Returns:
        all process instance logs that are subprocess to a given process instance id

    - #### findNodeInstances

          List<? extends NodeInstanceLog> findNodeInstances​(String processInstanceId)

      Returns all node instances that were already triggered for given process instance id
      Parameters:
        `processInstanceId` - unique identifier of process instance
      Returns:
        all node instance logs for given process instance id

    - #### findNodeInstances

          List<? extends NodeInstanceLog> findNodeInstances​(String processInstanceId,
                                                            String nodeId)

      Parameters:
        `processInstanceId` - unique identifier of process instance
        `nodeId` - node identifier - by default it should be unique id (from process definition) but if not available regular node id shall be used
      Returns:
        all node instances that were already triggered for given process instance id and node identifier

    - #### findVariableInstances

          List<? extends VariableInstanceLog> findVariableInstances​(String processInstanceId)

      Returns all variable logs for given process instance id
      Parameters:
        `processInstanceId` - unique identifier of process instance
      Returns:
        all variables logs for given process instance or empty list of none were found

    - #### findVariableInstances

          List<? extends VariableInstanceLog> findVariableInstances​(String processInstanceId,
                                                                    String variableId)

      Returns all variable logs for given process instance id and variable identifier
      Parameters:
        `processInstanceId` - unique identifier of process instance
        `variableId` - variable name
      Returns:
        all variable logs for given process instance and variable identifier or empty list if none were found

    - #### findVariableInstancesByName

          List<? extends VariableInstanceLog> findVariableInstancesByName​(String variableId,
                                                                          boolean onlyActiveProcesses)

      Returns all variable logs that are identified by variable id regardless of what process instance they belong to
      Parameters:
        `variableId` - variable name
        `onlyActiveProcesses` - indicates if only active process instances should be considered or both active and completed
      Returns:
        all variable logs for given variable id or empty list if none were found

    - #### findVariableInstancesByNameAndValue

          List<? extends VariableInstanceLog> findVariableInstancesByNameAndValue​(String variableId,
                                                                                  String value,
                                                                                  boolean onlyActiveProcesses)

      Returns all variable logs that are identified by variable id and has given value regardless of what process instance they belong to
      Parameters:
        `variableId` - variable name
        `value` - value of the variable
        `onlyActiveProcesses` - indicates if only active process instances should be considered or both active and completed
      Returns:
        all variable logs for given variable id and its value matches given value or empty list if none were found

    - #### clear

          void clear()

      Removes all entries from audit data store

    - #### dispose

          void dispose()

      Indicates that work with this instance of `AuditService` is completed and can be disposed (release resources)