Package org.kie.api.executor

## Interface ExecutorQueryService

-     public interface ExecutorQueryService

  Executor query interface that provides runtime access to data.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `List<ErrorInfo>` | `getAllErrors​(QueryContext queryContext)` |
    `List<RequestInfo>` | `getAllRequests​(QueryContext queryContext)` |
    `List<RequestInfo>` | `getCancelledRequests​(QueryContext queryContext)` |
    `List<RequestInfo>` | `getCompletedRequests​(QueryContext queryContext)` |
    `List<ErrorInfo>` | `getErrorsByRequestId​(Long id)` |
    `List<RequestInfo>` | `getFutureQueuedRequests​(QueryContext queryContext)` |
    `List<RequestInfo>` | `getInErrorRequests​(QueryContext queryContext)` |
    `List<RequestInfo>` | `getPendingRequestById​(Long id)` |
    `List<RequestInfo>` | `getPendingRequests​(QueryContext queryContext)` |
    `List<RequestInfo>` | `getQueuedRequests​(QueryContext queryContext)` |
    `List<RequestInfo>` | `getRequestByBusinessKey​(String businessKey, QueryContext queryContext)` | Returns requests identified by `businessKey` usually it should be only one with given business key but it does not have to as same business key requests can be processed sequentially and thus might be in different statuses.
    `List<RequestInfo>` | `getRequestByCommand​(String command, QueryContext queryContext)` | Returns requests that are scheduled to run given command
    `RequestInfo` | `getRequestById​(Long id)` |
    `RequestInfo` | `getRequestForProcessing()` | Dedicated method for handling special case that is get the request for processing.
    `RequestInfo` | `getRequestForProcessing​(Long requestId)` | Dedicated method for handling special case that is get the request for processing by id.
    `List<RequestInfo>` | `getRequestsByBusinessKey​(String businessKey, List<STATUS> statuses, QueryContext queryContext)` | Returns requests identified by `businessKey` usually it should be only one with given business key but it does not have to as same business key requests can be processed sequentially and thus might be in different statuses.
    `List<RequestInfo>` | `getRequestsByCommand​(String command, List<STATUS> statuses, QueryContext queryContext)` | Returns requests that are scheduled to run given command
    `List<RequestInfo>` | `getRequestsByDeployment​(String deploymentId, List<STATUS> statuses, QueryContext queryContext)` | Returns requests by deployment id
    `List<RequestInfo>` | `getRequestsByProcessInstance​(Long processInstanceId, List<STATUS> statuses, QueryContext queryContext)` | Returns requests by process instance id
    `List<RequestInfo>` | `getRequestsByStatus​(List<STATUS> statuses, QueryContext queryContext)` |
    `List<RequestInfo>` | `getRunningRequests​(QueryContext queryContext)` |

- - ### Method Detail

    - #### getPendingRequests

          List<RequestInfo> getPendingRequests​(QueryContext queryContext)

      Returns:
        list of pending execution requests.

    - #### getPendingRequestById

          List<RequestInfo> getPendingRequestById​(Long id)

      Parameters:
        `id` - unique id of the request
      Returns:
        given pending request identified by `id`

    - #### getRequestById

          RequestInfo getRequestById​(Long id)

      Parameters:
        `id` - unique id of the request
      Returns:
        request identified by `id` regardless of its status

    - #### getRequestByBusinessKey

          List<RequestInfo> getRequestByBusinessKey​(String businessKey,
                                                    QueryContext queryContext)

      Returns requests identified by `businessKey` usually it should be only one with given business key but it does not have to as same business key requests can be processed sequentially and thus might be in different statuses.
      Parameters:
        `businessKey` - business key of the request
      Returns:
        requests identified by the business key

    - #### getRequestsByBusinessKey

          List<RequestInfo> getRequestsByBusinessKey​(String businessKey,
                                                     List<STATUS> statuses,
                                                     QueryContext queryContext)

      Returns requests identified by `businessKey` usually it should be only one with given business key but it does not have to as same business key requests can be processed sequentially and thus might be in different statuses.
      Parameters:
        `businessKey` - business key of the request
        `statuses` - filter by job status
        `queryContext` - paging and sorting controls
      Returns:
        requests identified by the business key

    - #### getRequestByCommand

          List<RequestInfo> getRequestByCommand​(String command,
                                                QueryContext queryContext)

      Returns requests that are scheduled to run given command
      Parameters:
        `command` - command configured in the request
        `queryContext` - paging and sorting controls
      Returns:
        requests configured with given `command`

    - #### getRequestsByCommand

          List<RequestInfo> getRequestsByCommand​(String command,
                                                 List<STATUS> statuses,
                                                 QueryContext queryContext)

      Returns requests that are scheduled to run given command
      Parameters:
        `command` - command configured in the request
        `statuses` - filter by job status
        `queryContext` - paging and sorting controls
      Returns:
        requests configured with given `command`

    - #### getRequestsByDeployment

          List<RequestInfo> getRequestsByDeployment​(String deploymentId,
                                                    List<STATUS> statuses,
                                                    QueryContext queryContext)

      Returns requests by deployment id
      Parameters:
        `deploymentId` - deployment id from process execution context
        `statuses` - filter by job status
        `queryContext` - paging and sorting controls
      Returns:
        requests scheduled for given deployment

    - #### getRequestsByProcessInstance

          List<RequestInfo> getRequestsByProcessInstance​(Long processInstanceId,
                                                         List<STATUS> statuses,
                                                         QueryContext queryContext)

      Returns requests by process instance id
      Parameters:
        `processInstanceId` - process instance id from process execution context
        `statuses` - filter by job status
        `queryContext` - paging and sorting controls
      Returns:
        requests scheduled for given deployment

    - #### getErrorsByRequestId

          List<ErrorInfo> getErrorsByRequestId​(Long id)

      Parameters:
        `id` - unique id of the request
      Returns:
        all errors (if any) for given request

    - #### getQueuedRequests

          List<RequestInfo> getQueuedRequests​(QueryContext queryContext)

      Returns:
        all queued requests

    - #### getCompletedRequests

          List<RequestInfo> getCompletedRequests​(QueryContext queryContext)

      Returns:
        all comleted requests.

    - #### getInErrorRequests

          List<RequestInfo> getInErrorRequests​(QueryContext queryContext)

      Returns:
        all requests that have errors.

    - #### getCancelledRequests

          List<RequestInfo> getCancelledRequests​(QueryContext queryContext)

      Returns:
        all requests that were cancelled

    - #### getAllErrors

          List<ErrorInfo> getAllErrors​(QueryContext queryContext)

      Returns:
        all errors.

    - #### getAllRequests

          List<RequestInfo> getAllRequests​(QueryContext queryContext)

      Returns:
        all requests

    - #### getRunningRequests

          List<RequestInfo> getRunningRequests​(QueryContext queryContext)

      Returns:
        all currently running requests

    - #### getFutureQueuedRequests

          List<RequestInfo> getFutureQueuedRequests​(QueryContext queryContext)

      Returns:
        requests queued for future execution

    - #### getRequestsByStatus

          List<RequestInfo> getRequestsByStatus​(List<STATUS> statuses,
                                                QueryContext queryContext)

      Parameters:
        `statuses` - statuses that requests should be in
      Returns:
        requests based on their status

    - #### getRequestForProcessing

          RequestInfo getRequestForProcessing()

      Dedicated method for handling special case that is get the request for processing. To ensure its efficient use it shall perform necessary operation to minimize risk of race conditions and deadlock.

    - #### getRequestForProcessing

          RequestInfo getRequestForProcessing​(Long requestId)

      Dedicated method for handling special case that is get the request for processing by id. To ensure its efficient use it shall perform necessary operation to minimize risk of race conditions and deadlock.