Package org.flowable.cmmn.api

# Interface CmmnManagementService

public interface CmmnManagementService

Author:
  Joram Barrez

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `bulkMoveDeadLetterJobs(Collection<String> jobIds, int retries)`
  Moves a bulk of jobs that are in the dead letter job table back to the executable job table, and resets the retries (as the retries was 0 when it was put into the dead letter job table).
  `void`
  `bulkMoveDeadLetterJobsToHistoryJobs(Collection<String> jobIds, int retries)`
  Moves a bulk of jobs that are in the dead letter job table back to be history jobs, and resets the retries (as the retries was 0 when it was put into the dead letter job table).
  `BatchBuilder`
  `createBatchBuilder()`
  `BatchPartBuilder`
  `createBatchPartBuilder(Batch batch)`
  `BatchPartQuery`
  `createBatchPartQuery()`
  Returns a new BatchPartQuery implementation, that can be used to dynamically query the batch parts.
  `BatchQuery`
  `createBatchQuery()`
  Returns a new BatchQuery implementation, that can be used to dynamically query the batches.
  `ChangeTenantIdBuilder`
  `createChangeTenantIdBuilder(String fromTenantId, String toTenantId)`
  Create a `ChangeTenantIdBuilder` that can be used to change the tenant id of the case instances and all the related instances.
  `CmmnExternalWorkerTransitionBuilder`
  `createCmmnExternalWorkerTransitionBuilder(String externalJobId, String workerId)`
  Create a `CmmnExternalWorkerTransitionBuilder` that can be used to transition the status of the external worker job.
  `DeadLetterJobQuery`
  `createDeadLetterJobQuery()`
  Returns a new DeadLetterJobQuery implementation, that can be used to query the dead letter jobs.
  `ExternalWorkerJobAcquireBuilder`
  `createExternalWorkerJobAcquireBuilder()`
  Create an `ExternalWorkerJobAcquireBuilder` that can be used to acquire jobs for an external worker.
  `ExternalWorkerJobFailureBuilder`
  `createExternalWorkerJobFailureBuilder(String externalJobId, String workerId)`
  Create an `ExternalWorkerJobFailureBuilder` that can be used to fail an external worker job.
  `ExternalWorkerJobQuery`
  `createExternalWorkerJobQuery()`
  Returns a new ExternalWorkerJobQuery implementation, that can be used to dynamically query the external worker jobs.
  `HistoryJobQuery`
  `createHistoryJobQuery()`
  Returns a new HistoryJobQuery implementation, that can be used to dynamically query the history jobs.
  `JobQuery`
  `createJobQuery()`
  Returns a new JobQuery implementation, that can be used to query the jobs.
  `SuspendedJobQuery`
  `createSuspendedJobQuery()`
  Returns a new SuspendedJobQuery implementation, that can be used to query the suspended jobs.
  `TimerJobQuery`
  `createTimerJobQuery()`
  Returns a new TimerJobQuery implementation, that can be used to query the timer jobs.
  `void`
  `deleteBatch(String batchId)`
  `void`
  `deleteDeadLetterJob(String jobId)`
  Delete the dead letter job with the provided id.
  `void`
  `deleteHistoryJob(String jobId)`
  Delete the history job with the provided id.
  `void`
  `deleteJob(String jobId)`
  Delete the job with the provided id.
  `void`
  `deleteSuspendedJob(String jobId)`
  Delete the suspended job with the provided id.
  `void`
  `deleteTimerJob(String jobId)`
  Delete the timer job with the provided id.
  `void`
  `executeHistoryJob(String historyJobId)`
  Forced synchronous execution of a historyJob (eg. for administration or testing).
  `void`
  `executeJob(String jobId)`
  Forced synchronous execution of a job (eg. for administration or testing).
  `String`
  `getDeadLetterJobExceptionStacktrace(String jobId)`
  Returns the full stacktrace of the exception that occurs when the deadletter job with the given id was last executed.
  `String`
  `getExternalWorkerJobErrorDetails(String jobId)`
  Returns the full error details that were passed to the External worker `Job` when the job was last failed.
  `String`
  `getHistoryJobHistoryJson(String historyJobId)`
  Get the advanced configuration (storing the history json data) of a `HistoryJob`.
  `String`
  `getJobExceptionStacktrace(String jobId)`
  Returns the full stacktrace of the exception that occurs when the job with the given id was last executed.
  `LockManager`
  `getLockManager(String lockName)`
  Acquire a lock manager for the requested lock.
  `String`
  `getSuspendedJobExceptionStacktrace(String jobId)`
  Returns the full stacktrace of the exception that occurs when the suspended with the given id was last executed.
  `Map<String,Long>`
  `getTableCounts()`
  Returns a map containing {tableName, rowCount} values.
  `Collection<String>`
  `getTableNames()`
  Returns all relational database tables of the engine.
  `String`
  `getTimerJobExceptionStacktrace(String jobId)`
  Returns the full stacktrace of the exception that occurs when the timer job with the given id was last executed.
  `void`
  `handleHistoryCleanupTimerJob()`
  `Job`
  `moveDeadLetterJobToExecutableJob(String jobId, int retries)`
  Moves a job that is in the dead letter job table back to be an executable job, and resetting the retries (as the retries were probably 0 when it was put into the dead letter job table).
  `HistoryJob`
  `moveDeadLetterJobToHistoryJob(String jobId, int retries)`
  Moves a job that is in the dead letter job table back to be a history job, and resetting the retries (as the retries was 0 when it was put into the dead letter job table).
  `Job`
  `moveJobToDeadLetterJob(String jobId)`
  Moves a job to the dead letter job table (eg. for administration or testing).
  `Job`
  `moveSuspendedJobToExecutableJob(String jobId)`
  Moves a suspended job from the suspended letter job table back to be an executable job.
  `Job`
  `moveTimerToExecutableJob(String jobId)`
  Moves a timer job to the executable job table (eg. for administration or testing).
  `Job`
  `rescheduleTimeDateJob(String jobId, Date timeDate)`
  Reschedule a timer job with a new date value.
  `Job`
  `rescheduleTimeDateValueJob(String jobId, String timeDateValue)`
  Reschedule a timer job with a time date value.
  `Job`
  `rescheduleTimerEventListenerInstanceWithDate(String eventListenerInstanceId, Date timeDate)`
  Reschedule a timer event listener instance with a new date value.
  `Job`
  `rescheduleTimerEventListenerInstanceWithDateValue(String eventListenerInstanceId, String timeDateValue)`
  Reschedule a timer event listener instance with a time date value.
  `void`
  `setJobRetries(String jobId, int retries)`
  Sets the number of retries that a job has left.
  `void`
  `setTimerJobRetries(String jobId, int retries)`
  Sets the number of retries that a timer job has left.
  `void`
  `unacquireAllExternalWorkerJobsForWorker(String workerId)`
  Unaquire all locked external worker jobs for worker.
  `void`
  `unacquireAllExternalWorkerJobsForWorker(String workerId, String tenantId)`
  Unaquire all locked external worker jobs for worker and tenant.
  `void`
  `unacquireExternalWorkerJob(String jobId, String workerId)`
  Unaquire a locked external worker job.

- ## Method Details

  - ### getTableCounts

    Map<String,Long> getTableCounts()
    Returns a map containing {tableName, rowCount} values.

  - ### getTableNames

    Collection<String> getTableNames()
    Returns all relational database tables of the engine.

  - ### createJobQuery

    JobQuery createJobQuery()
    Returns a new JobQuery implementation, that can be used to query the jobs.

  - ### createExternalWorkerJobQuery

    ExternalWorkerJobQuery createExternalWorkerJobQuery()
    Returns a new ExternalWorkerJobQuery implementation, that can be used to dynamically query the external worker jobs.

  - ### createTimerJobQuery

    TimerJobQuery createTimerJobQuery()
    Returns a new TimerJobQuery implementation, that can be used to query the timer jobs.

  - ### createSuspendedJobQuery

    SuspendedJobQuery createSuspendedJobQuery()
    Returns a new SuspendedJobQuery implementation, that can be used to query the suspended jobs.

  - ### createDeadLetterJobQuery

    DeadLetterJobQuery createDeadLetterJobQuery()
    Returns a new DeadLetterJobQuery implementation, that can be used to query the dead letter jobs.

  - ### executeJob

    void executeJob(String jobId)
    Forced synchronous execution of a job (eg. for administration or testing). The job will be executed, even if the case instance is suspended.
    Parameters:
      `jobId` - id of the job to execute, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### moveTimerToExecutableJob

    Job moveTimerToExecutableJob(String jobId)
    Moves a timer job to the executable job table (eg. for administration or testing). The timer job will be moved, even if the case instance is suspended.
    Parameters:
      `jobId` - id of the timer job to move, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### moveJobToDeadLetterJob

    Job moveJobToDeadLetterJob(String jobId)
    Moves a job to the dead letter job table (eg. for administration or testing). The job will be moved, even if the case instance is suspended or there are retries left.
    Parameters:
      `jobId` - id of the job to move, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### bulkMoveDeadLetterJobs

    void bulkMoveDeadLetterJobs(Collection<String> jobIds, int retries)
    Moves a bulk of jobs that are in the dead letter job table back to the executable job table, and resets the retries (as the retries was 0 when it was put into the dead letter job table).
    Parameters:
      `jobIds` - ids of the jobs to move, cannot be null.
      `retries` - the number of retries (value greater than 0) which will be set on the jobs.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with any of the given ids.

  - ### bulkMoveDeadLetterJobsToHistoryJobs

    void bulkMoveDeadLetterJobsToHistoryJobs(Collection<String> jobIds, int retries)
    Moves a bulk of jobs that are in the dead letter job table back to be history jobs, and resets the retries (as the retries was 0 when it was put into the dead letter job table).
    Parameters:
      `jobIds` - ids of the jobs to move, cannot be null.
      `retries` - the number of retries (value greater than 0) which will be set on the jobs.
    Throws:
      `FlowableObjectNotFoundException` - when one job with of the given ids is not found.

  - ### moveDeadLetterJobToExecutableJob

    Job moveDeadLetterJobToExecutableJob(String jobId, int retries)
    Moves a job that is in the dead letter job table back to be an executable job, and resetting the retries (as the retries were probably 0 when it was put into the dead letter job table).
    Parameters:
      `jobId` - id of the job to move, cannot be null.
      `retries` - the number of retries (value greater than 0) which will be set on the job.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### moveDeadLetterJobToHistoryJob

    HistoryJob moveDeadLetterJobToHistoryJob(String jobId, int retries)
    Moves a job that is in the dead letter job table back to be a history job, and resetting the retries (as the retries was 0 when it was put into the dead letter job table).
    Parameters:
      `jobId` - id of the job to move, cannot be null.
      `retries` - the number of retries (value greater than 0) which will be set on the job.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.
      `FlowableIllegalArgumentException` - when the job cannot be moved to be a history job (e.g. because it's not history job)

  - ### moveSuspendedJobToExecutableJob

    Job moveSuspendedJobToExecutableJob(String jobId)
    Moves a suspended job from the suspended letter job table back to be an executable job. The retries are untouched.
    Parameters:
      `jobId` - id of the job to move, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### deleteJob

    void deleteJob(String jobId)
    Delete the job with the provided id.
    Parameters:
      `jobId` - id of the job to delete, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### deleteTimerJob

    void deleteTimerJob(String jobId)
    Delete the timer job with the provided id.
    Parameters:
      `jobId` - id of the timer job to delete, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### deleteSuspendedJob

    void deleteSuspendedJob(String jobId)
    Delete the suspended job with the provided id.
    Parameters:
      `jobId` - id of the suspended job to delete, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### deleteDeadLetterJob

    void deleteDeadLetterJob(String jobId)
    Delete the dead letter job with the provided id.
    Parameters:
      `jobId` - id of the dead letter job to delete, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### setJobRetries

    void setJobRetries(String jobId, int retries)
    Sets the number of retries that a job has left. Whenever the JobExecutor fails to execute a job, this value is decremented. When it hits zero, the job is supposed to be dead and not retried again. In that case, this method can be used to increase the number of retries.
    Parameters:
      `jobId` - id of the job to modify, cannot be null.
      `retries` - number of retries.

  - ### setTimerJobRetries

    void setTimerJobRetries(String jobId, int retries)
    Sets the number of retries that a timer job has left. Whenever the JobExecutor fails to execute a timer job, this value is decremented. When it hits zero, the job is supposed to be dead and not retried again. In that case, this method can be used to increase the number of retries.
    Parameters:
      `jobId` - id of the timer job to modify, cannot be null.
      `retries` - number of retries.

  - ### rescheduleTimeDateJob

    Job rescheduleTimeDateJob(String jobId, Date timeDate)
    Reschedule a timer job with a new date value.
    Parameters:
      `jobId` - id of the timer job to reschedule, cannot be null.
      `timeDate` - A fixed date

  - ### rescheduleTimeDateValueJob

    Job rescheduleTimeDateValueJob(String jobId, String timeDateValue)
    Reschedule a timer job with a time date value.
    Parameters:
      `jobId` - id of the timer job to reschedule, cannot be null.
      `timeDateValue` - A fixed date in ISO 8601 format, when job will be fired

  - ### rescheduleTimerEventListenerInstanceWithDate

    Job rescheduleTimerEventListenerInstanceWithDate(String eventListenerInstanceId, Date timeDate)
    Reschedule a timer event listener instance with a new date value.
    Parameters:
      `eventListenerInstanceId` - id of the timer event listener instance to reschedule, cannot be null.
      `timeDate` - A fixed date

  - ### rescheduleTimerEventListenerInstanceWithDateValue

    Job rescheduleTimerEventListenerInstanceWithDateValue(String eventListenerInstanceId, String timeDateValue)
    Reschedule a timer event listener instance with a time date value.
    Parameters:
      `eventListenerInstanceId` - id of the timer event listener instance to reschedule, cannot be null.
      `timeDateValue` - A fixed date in ISO 8601 format, when job will be fired

  - ### getJobExceptionStacktrace

    String getJobExceptionStacktrace(String jobId)
    Returns the full stacktrace of the exception that occurs when the job with the given id was last executed. Returns null when the job has no exception stacktrace.
    Parameters:
      `jobId` - id of the job, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when no job exists with the given id.

  - ### getTimerJobExceptionStacktrace

    String getTimerJobExceptionStacktrace(String jobId)
    Returns the full stacktrace of the exception that occurs when the timer job with the given id was last executed. Returns null when the job has no exception stacktrace.
    Parameters:
      `jobId` - id of the job, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when no job exists with the given id.

  - ### getSuspendedJobExceptionStacktrace

    String getSuspendedJobExceptionStacktrace(String jobId)
    Returns the full stacktrace of the exception that occurs when the suspended with the given id was last executed. Returns null when the job has no exception stacktrace.
    Parameters:
      `jobId` - id of the job, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when no job exists with the given id.

  - ### getDeadLetterJobExceptionStacktrace

    String getDeadLetterJobExceptionStacktrace(String jobId)
    Returns the full stacktrace of the exception that occurs when the deadletter job with the given id was last executed. Returns null when the job has no exception stacktrace.
    Parameters:
      `jobId` - id of the job, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when no job exists with the given id.

  - ### getExternalWorkerJobErrorDetails

    String getExternalWorkerJobErrorDetails(String jobId)
    Returns the full error details that were passed to the External worker `Job` when the job was last failed. Returns null when the job has no error details.
    Parameters:
      `jobId` - id of the job, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when no job exists with the given id.

  - ### handleHistoryCleanupTimerJob

    void handleHistoryCleanupTimerJob()

  - ### createBatchQuery

    BatchQuery createBatchQuery()
    Returns a new BatchQuery implementation, that can be used to dynamically query the batches.

  - ### createBatchBuilder

    BatchBuilder createBatchBuilder()

  - ### createBatchPartQuery

    BatchPartQuery createBatchPartQuery()
    Returns a new BatchPartQuery implementation, that can be used to dynamically query the batch parts.

  - ### createBatchPartBuilder

    BatchPartBuilder createBatchPartBuilder(Batch batch)

  - ### deleteBatch

    void deleteBatch(String batchId)

  - ### createHistoryJobQuery

    HistoryJobQuery createHistoryJobQuery()
    Returns a new HistoryJobQuery implementation, that can be used to dynamically query the history jobs.

  - ### executeHistoryJob

    void executeHistoryJob(String historyJobId)
    Forced synchronous execution of a historyJob (eg. for administration or testing).
    Parameters:
      `historyJobId` - id of the historyjob to execute, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no historyJob with the given id.

  - ### getHistoryJobHistoryJson

    String getHistoryJobHistoryJson(String historyJobId)
    Get the advanced configuration (storing the history json data) of a `HistoryJob`.
    Parameters:
      `historyJobId` - id of the history job to execute, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no historyJob with the given id.

  - ### deleteHistoryJob

    void deleteHistoryJob(String jobId)
    Delete the history job with the provided id.
    Parameters:
      `jobId` - id of the history job to delete, cannot be null.
    Throws:
      `FlowableObjectNotFoundException` - when there is no job with the given id.

  - ### createExternalWorkerJobAcquireBuilder

    ExternalWorkerJobAcquireBuilder createExternalWorkerJobAcquireBuilder()
    Create an `ExternalWorkerJobAcquireBuilder` that can be used to acquire jobs for an external worker.

  - ### createExternalWorkerJobFailureBuilder

    ExternalWorkerJobFailureBuilder createExternalWorkerJobFailureBuilder(String externalJobId, String workerId)
    Create an `ExternalWorkerJobFailureBuilder` that can be used to fail an external worker job.
    Parameters:
      `externalJobId` - the id of the external worker job
      `workerId` - the id of the worker doing the action

  - ### createCmmnExternalWorkerTransitionBuilder

    CmmnExternalWorkerTransitionBuilder createCmmnExternalWorkerTransitionBuilder(String externalJobId, String workerId)
    Create a `CmmnExternalWorkerTransitionBuilder` that can be used to transition the status of the external worker job.

  - ### unacquireExternalWorkerJob

    void unacquireExternalWorkerJob(String jobId, String workerId)
    Unaquire a locked external worker job.

  - ### unacquireAllExternalWorkerJobsForWorker

    void unacquireAllExternalWorkerJobsForWorker(String workerId)
    Unaquire all locked external worker jobs for worker.

  - ### unacquireAllExternalWorkerJobsForWorker

    void unacquireAllExternalWorkerJobsForWorker(String workerId, String tenantId)
    Unaquire all locked external worker jobs for worker and tenant.

  - ### createChangeTenantIdBuilder

    ChangeTenantIdBuilder createChangeTenantIdBuilder(String fromTenantId, String toTenantId)
    Create a `ChangeTenantIdBuilder` that can be used to change the tenant id of the case instances and all the related instances. See `CmmnChangeTenantIdEntityTypes` for related instances.

    You must provide the source tenant id and the destination tenant id. All instances from the source tenant id in the CMMN scope will be changed to the target tenant id.

  - ### getLockManager

    LockManager getLockManager(String lockName)
    Acquire a lock manager for the requested lock. This is a stateless call, this means that every time a lock manager is requested a new one would be created. Make sure that you release the lock once you are done.
    Parameters:
      `lockName` - the name of the lock that is being requested
    Returns:
      the lock manager for the given lock