Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(restAPI): add withJobsRetrying to rest and openAPI #4922

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@
"desc": "Only include unfinished process instances. Value may only be `true`, as `false` is the default behavior."
},

"withJobsRetrying": {
"type": "boolean",
"desc": "Only include process instances which are associated with jobs that have encountered exceptions and still
have retries left. Value may only be `true`, as `false` is the default behavior."
},

"withIncidents": {
"type": "boolean",
"desc": "Only include process instances which have an incident. Value may only be `true`, as `false` is the default behavior."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class HistoricProcessInstanceQueryDto extends AbstractQueryDto<HistoricPr
private Boolean rootProcessInstances;
private Boolean finished;
private Boolean unfinished;
private Boolean withJobsRetrying;
private Boolean withIncidents;
private Boolean withRootIncidents;
private String incidentType;
Expand Down Expand Up @@ -209,6 +210,11 @@ public void setUnfinished(Boolean unfinished) {
this.unfinished = unfinished;
}

@CamundaQueryParam(value = "withJobsRetrying", converter = BooleanConverter.class)
public void setWithJobsRetrying(Boolean withJobsRetrying) {
this.withJobsRetrying = withJobsRetrying;
}

@CamundaQueryParam(value = "withIncidents", converter = BooleanConverter.class)
public void setWithIncidents(Boolean withIncidents) {
this.withIncidents = withIncidents;
Expand Down Expand Up @@ -449,6 +455,9 @@ protected void applyFilters(HistoricProcessInstanceQuery query) {
if (unfinished != null && unfinished) {
query.unfinished();
}
if (withJobsRetrying != null && withJobsRetrying) {
query.withJobsRetrying();
}
if (withIncidents != null && withIncidents) {
query.withIncidents();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,40 @@ public void testProcessQueryUnfinishedAsPost() {
Assert.assertEquals(null, returnedEndTime);
}

@Test
public void testQueryWithJobsRetrying() {
given()
.queryParam("withJobsRetrying", true)
.then()
.expect()
.statusCode(Status.OK.getStatusCode())
.when()
.get(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL);

InOrder inOrder = inOrder(mockedQuery);
inOrder.verify(mockedQuery).withJobsRetrying();
inOrder.verify(mockedQuery).list();
}

@Test
public void testQueryWithJobsRetryingAsPost() {
Map<String, Boolean> body = new HashMap<String, Boolean>();
body.put("withJobsRetrying", true);

given()
.contentType(POST_JSON_CONTENT_TYPE)
.body(body)
.then()
.expect()
.statusCode(Status.OK.getStatusCode())
.when()
.post(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL);

InOrder inOrder = inOrder(mockedQuery);
inOrder.verify(mockedQuery).withJobsRetrying();
inOrder.verify(mockedQuery).list();
}

@Test
public void testQueryWithIncidents() {
given()
Expand Down
Loading