Chapter 16. Canceling or destroying a case

Cases can be canceled if they are no longer required and do not require any case work to be performed. Cases that are canceled can be reopened later with the same case instance ID and case file data. In some cases, you might want to permanently destroy a case so that it cannot be reopened.

Cases can only be canceled or destroyed using an API request. Red Hat Process Automation Manager includes the Swagger client, which includes endpoints and documentation for REST API requests. Alternatively, you can use the same endpoints to make API calls using your preferred client or Curl.

Prerequisites

  • A case instance has been started using Showcase.
  • You are able to authenticate API requests as a user with the admin role.

Procedure

  1. Open the Swagger REST API client in a web browser:

    /http://localhost:8080/kie-server/docs

  2. Under Case Instances :: Case Management, open the DELETE request with the following endpoint:

    /server/containers/{id}/cases/instances/{caseId}

    You can cancel a case using the DELETE request. Optionally, you can also destroy the case using the destroy parameter.

  3. Click Try it out and fill in the required parameters:

    Table 16.1. Parameters

    NameDescription

    id

    itorders

    caseId

    IT-0000000001

    destroy

    true

    (Optional. Permanently destroys the case. This parameter is false by default.)

  4. Click Execute to cancel (or destroy) the case.
  5. To confirm the case is canceled, open the Showcase application and change the case list status to Canceled. If the case has been destroyed, it will no longer appear in any case list.

16.1. Removing case logs from the database

Use the CaseLogCleanupCommand to clean-up cases, such as canceled cases that are using up database space. The CaseLogCleanupCommand command contains logic to automatically clean-up all or selected cases.

There are several configuration options that you can use with the CaseLogCleanupCommand command:

Table 16.2. CaseLogCleanupCommand parameters table

NameDescriptionIs Exclusive

SkipProcessLog

Indicates whether or not the process and node instances, along with the process variable log clean-up will be skipped when the command runs. Default value: false

No, can be used with other parameters

SkipTaskLog

Indicates whether or not the task audit, the task event, and the task variable log clean-up will be skipped when the command runs. Default value: false

No, can be used with other parameters

SkipExecutorLog

Indicates if the Red Hat Process Automation Manager executor entries clean-up will be skipped when the command runs. Default value: false

No, can be used with other parameters

SingleRun

Indicates if the job routine will run only once. Default value: false

No, can be used with other parameters

NextRun

Schedules the next job execution. For example, set to 12h for jobs to be executed every 12 hours. The schedule is ignored if you set SingleRun to true, unless you set both SingleRun and NextRun. If both are set, the NextRun schedule takes priority. The ISO format can be used to set the precise date. Default value: 24h

No, can be used with other parameters

OlderThan

Logs older than the specified date are removed. The date format is YYYY-MM-DD. Usually, this parameter is used for single run jobs.

Yes, cannot be used when the OlderThanPeriod parameter is used

OlderThanPeriod

Logs older than the specified timer expression are removed. For example, set 30d to remove logs older than 30 days.

Yes, cannot be used when the OlderThan parameter is used

ForCaseDefId

Specifies the case definition ID of the logs that are removed.

No, can be used with other parameters

ForDeployment

Specifies the deployment ID of the logs that are removed.

No, can be used with other parameters

EmfName

The persistence unit name used to perform the delete operation. Default value: org.jbpm.domain

N/A

DateFormat

Specifies the date format for time-related parameters. Default value: yyyy-MM-dd

No, can be used with other parameters

Status

Status of the case instances of the logs that are removed.

No, can be used with other parameters