Skip to content

Commit

Permalink
feat(BPM failure): add BPM failures API resources (#203)
Browse files Browse the repository at this point in the history
* feat(BPM failure): add BPM failures API resources

Covers [BPM-316](https://bonitasoft.atlassian.net/browse/BPM-316)
Covers [BPM-328](https://bonitasoft.atlassian.net/browse/BPM-328)
---------

Co-authored-by: Romain Bioteau <[email protected]>
  • Loading branch information
abirembaut and rbioteau authored Nov 26, 2024
1 parent 0725a79 commit 1695eba
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 0 deletions.
48 changes: 48 additions & 0 deletions openapi/components/schemas/ArchivedBPMFailure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
type: object
description: "The archived version of a failure that happened during a BPM instance (flow node, process) execution that led to the instance being in a failed state."
properties:
archivedDate:
type: string
description: "the date when this failure was archived, in milliseconds since epoch"
caseId:
description: "the id of the process instance in which that failure occurred"
type: string
context:
description: "Context of the failure"
type: string
errorMessage:
description: "the message of the exception"
type: string
failureDate:
description: "the date when the failure occurred in milliseconds since epoch"
type: string
flowNodeInstanceId:
description: "the id of the flow node instance in which the failure occurred"
type: string
id:
description: "the archived failure id"
type: string
processDefinitionId:
description: "the process id that is associated with the flow node or case instance of the failure"
type: string
scope:
description: "the scope of the failure (General information, Operation, Event, Iteration, Connector, Data initialization, Actor mapping, Outgoing transition, or UNKNOWN)"
type: string
sourceObjectId:
type: string
description: "the original id of the failure before it was archived"
stackTrace:
description: "the stack trace of the exception"
type: string
example:
archivedDate: "1732564904376"
caseId: "1"
context: "expression::setvariable_decision"
errorMessage: "Error while executing operations"
failureDate: "1732564534177"
flowNodeInstanceId: "70"
id: "456"
processDefinitionId: "45"
scope: "Operation"
sourceObjectId: "23"
stackTrace: "Exception in thread 'main' org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException"
40 changes: 40 additions & 0 deletions openapi/components/schemas/BPMFailure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
type: object
description: "A failure that happened during a BPM instance (flow node, process) execution that led to the instance being in a failed state."
properties:
caseId:
description: "the id of the process instance in which that failure occurred"
type: string
context:
description: "Context of the failure"
type: string
errorMessage:
description: "the message of the exception"
type: string
failureDate:
description: "the date when the failure occurred in milliseconds since epoch"
type: string
flowNodeInstanceId:
description: "the id of the flow node instance in which the failure occurred"
type: string
id:
description: "the failure id"
type: string
processDefinitionId:
description: "the process id that is associated with the flow node or case instance of the failure"
type: string
scope:
description: "the scope of the failure (General information, Operation, Event, Iteration, Connector, Data initialization, Actor mapping, Outgoing transition, or UNKNOWN)"
type: string
stackTrace:
description: "the stack trace of the exception"
type: string
example:
caseId: "1"
context: "expression::setvariable_decision"
errorMessage: "Error while executing operations"
failureDate: "1732564534177"
flowNodeInstanceId: "70"
id: "456"
processDefinitionId: "45"
scope: "Operation"
stackTrace: "Exception in thread 'main' org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException"
13 changes: 13 additions & 0 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ x-tagGroups:
- ArchivedConnectorInstance
- FlowNode
- ArchivedFlowNode
- Failure
- ArchivedFailure
- TimerEventTrigger
- Message
- Signal
Expand Down Expand Up @@ -260,6 +262,13 @@ tags:
- name: FlowNode
x-displayName: FlowNode
description: FlowNode
- name: Failure
x-displayName: BPM Failure
description: Failure leading a BPM entity instance to a failed state
- name: ArchivedFailure
x-displayName: Archived BPM Failure
description: Archived version of the Failure leading a BPM entity instance to a failed state

- name: FormMappingBDM
x-displayName: FormMappingBDM
description: FormMappingBDM
Expand Down Expand Up @@ -551,6 +560,10 @@ paths:
$ref: './paths/API@[email protected]'
/API/bpm/archivedFlowNode/{id}:
$ref: './paths/API@bpm@archivedFlowNode@{id}.yaml'
/API/bpm/failure/flowNode/{flowNodeInstanceId}:
$ref: './paths/API@bpm@failure@flowNode@{flowNodeInstanceId}.yaml'
/API/bpm/achivedFailure/flowNode/{flowNodeInstanceId}:
$ref: './paths/API@bpm@archivedFailure@flowNode@{flowNodeInstanceId}.yaml'
/API/bpm/timerEventTrigger:
$ref: './paths/API@[email protected]'
/API/bpm/timerEventTrigger/{id}:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
get:
tags:
- ArchivedFailure
summary: Retrieve the archived failures of an archived flownode instance by it's sourceObjectID
description: |
Returns the most recent failures for the given archived flownode sourceObjectID
operationId: getArchivedBPMFailuresByFlowNodeInstanceId
parameters:
- description: The original identifier (sourceObjectID) of the flownode instance from which to retrieve the failures
in: path
name: flowNodeInstanceId
required: true
schema:
type: string
maxLength: 250
pattern: '^[0-9\_\-\.]{0,250}$'
- $ref: '../components/parameters/pageCount.yaml'
responses:
'200':
description: "Success "
content:
application/json:
schema:
type: array
items:
$ref: '../components/schemas/ArchivedBPMFailure.yaml'
'401':
$ref: '../components/responses/Unauthorized.yaml'
'403':
$ref: '../components/responses/Forbidden.yaml'
'400':
$ref: '../components/responses/BadRequest.yaml'
'404':
$ref: '../components/responses/NotFound.yaml'
'5XX':
$ref: '../components/responses/ServerError.yaml'
36 changes: 36 additions & 0 deletions openapi/paths/API@bpm@failure@flowNode@{flowNodeInstanceId}.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
get:
tags:
- Failure
summary: Retrieve the failures of a flownode instance by it's ID
description: |
Returns the most recent failures for the given flownode ID
operationId: getBPMFailuresByFlowNodeInstanceId
parameters:
- description: The identifier of the flownode instance from which to retrieve the failures
in: path
name: flowNodeInstanceId
required: true
schema:
type: string
maxLength: 250
pattern: '^[0-9\_\-\.]{0,250}$'
- $ref: '../components/parameters/pageCount.yaml'
responses:
'200':
description: "Success "
content:
application/json:
schema:
type: array
items:
$ref: '../components/schemas/BPMFailure.yaml'
'401':
$ref: '../components/responses/Unauthorized.yaml'
'403':
$ref: '../components/responses/Forbidden.yaml'
'400':
$ref: '../components/responses/BadRequest.yaml'
'404':
$ref: '../components/responses/NotFound.yaml'
'5XX':
$ref: '../components/responses/ServerError.yaml'

0 comments on commit 1695eba

Please sign in to comment.