Skip to content

Commit 5252727

Browse files
Change query parameter to 'acquired' to 'executing'
1 parent ee6cf11 commit 5252727

File tree

9 files changed

+37
-38
lines changed

9 files changed

+37
-38
lines changed

engine-rest/engine-rest-openapi/src/main/templates/lib/commons/job-query-params.ftl

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@
164164
"desc": "Include jobs which belong to no tenant. Can be used in combination with `tenantIdIn`.
165165
Value may only be `true`, as `false` is the default behavior."
166166
},
167-
"executing": {
167+
"acquired": {
168168
"type": "boolean",
169-
"desc": "Only select jobs which are executing, i.e., lock expiration date is not null, lock expiration
169+
"desc": "Only select jobs which are acquired, i.e., lock expiration date is not null, lock expiration
170170
date is in future and suspension state is 1. Value may only be `true`, as `false` is the default
171171
behavior."
172172
}

engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/runtime/JobQueryDto.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public class JobQueryDto extends AbstractQueryDto<JobQuery> {
9494
protected List<String> tenantIds;
9595
protected Boolean withoutTenantId;
9696
protected Boolean includeJobsWithoutTenantId;
97-
protected Boolean executing;
97+
protected Boolean acquired;
9898

9999
protected List<ConditionQueryParameterDto> dueDates;
100100
protected List<ConditionQueryParameterDto> createTimes;
@@ -235,9 +235,9 @@ public void setIncludeJobsWithoutTenantId(Boolean includeJobsWithoutTenantId) {
235235
this.includeJobsWithoutTenantId = includeJobsWithoutTenantId;
236236
}
237237

238-
@CamundaQueryParam(value="executing", converter = BooleanConverter.class)
239-
public void setExecuting(Boolean executing) {
240-
this.executing = executing;
238+
@CamundaQueryParam(value="acquired", converter = BooleanConverter.class)
239+
public void setAcquired(Boolean acquired) {
240+
this.acquired = acquired;
241241
}
242242

243243
@Override
@@ -424,8 +424,8 @@ String fieldName() {
424424
if (TRUE.equals(includeJobsWithoutTenantId)) {
425425
query.includeJobsWithoutTenantId();
426426
}
427-
if (TRUE.equals(executing)) {
428-
query.executing();
427+
if (TRUE.equals(acquired)) {
428+
query.acquired();
429429
}
430430
}
431431

engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/JobRestServiceQueryTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,13 @@ public void testMessagesParameter() {
360360
}
361361

362362
@Test
363-
public void testExecutingParameter() {
363+
public void testAcquiredParameter() {
364364
Map<String, Object> parameters = new HashMap<>();
365-
parameters.put("executing", MockProvider.EXAMPLE_EXECUTING);
365+
parameters.put("acquired", MockProvider.EXAMPLE_ACQUIRED);
366366

367367
given().queryParams(parameters).then().expect().statusCode(Status.OK.getStatusCode()).when().get(JOBS_RESOURCE_URL);
368368

369-
verify(mockQuery).executing();
369+
verify(mockQuery).acquired();
370370
verify(mockQuery).list();
371371
}
372372

@@ -432,7 +432,7 @@ private Map<String, Object> getCompleteParameters() {
432432
parameters.put("priorityLowerThanOrEquals", JOB_QUERY_MAX_PRIORITY);
433433
parameters.put("priorityHigherThanOrEquals", JOB_QUERY_MIN_PRIORITY);
434434
parameters.put("jobDefinitionId", MockProvider.EXAMPLE_JOB_DEFINITION_ID);
435-
parameters.put("executing", MockProvider.EXAMPLE_EXECUTING);
435+
parameters.put("acquired", MockProvider.EXAMPLE_ACQUIRED);
436436
return parameters;
437437
}
438438

@@ -470,7 +470,7 @@ private void verifyParameterQueryInvocations() {
470470
verify(mockQuery).priorityLowerThanOrEquals(JOB_QUERY_MAX_PRIORITY);
471471
verify(mockQuery).priorityHigherThanOrEquals(JOB_QUERY_MIN_PRIORITY);
472472
verify(mockQuery).jobDefinitionId(MockProvider.EXAMPLE_JOB_DEFINITION_ID);
473-
verify(mockQuery).executing();
473+
verify(mockQuery).acquired();
474474
}
475475

476476
private void testDateParameters(DateParameters parameters) {

engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ public abstract class MockProvider {
530530
public static final String EXAMPLE_AUTHORIZATION_ID = "someAuthorizationId";
531531
public static final int EXAMPLE_AUTHORIZATION_TYPE = 0;
532532
public static final String EXAMPLE_AUTHORIZATION_TYPE_STRING = "0";
533-
public static final Boolean EXAMPLE_EXECUTING = true;
533+
public static final Boolean EXAMPLE_ACQUIRED = true;
534534

535535

536536
// process applications

engine/src/main/java/org/camunda/bpm/engine/impl/JobQueryImpl.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class JobQueryImpl extends AbstractQuery<JobQuery, Job> implements JobQue
7171
protected String failedActivityId;
7272
protected boolean noRetriesLeft;
7373
protected SuspensionState suspensionState;
74-
protected boolean executing;
74+
protected boolean acquired;
7575

7676
protected boolean isTenantIdSet = false;
7777
protected String[] tenantIds;
@@ -258,8 +258,8 @@ public JobQuery suspended() {
258258
return this;
259259
}
260260

261-
public JobQuery executing() {
262-
executing = true;
261+
public JobQuery acquired() {
262+
acquired = true;
263263
return this;
264264
}
265265

@@ -408,8 +408,8 @@ public boolean isWithException() {
408408
public String getExceptionMessage() {
409409
return exceptionMessage;
410410
}
411-
public boolean getExecuting() {
412-
return executing;
411+
public boolean getAcquired() {
412+
return acquired;
413413
}
414414

415415
}

engine/src/main/java/org/camunda/bpm/engine/runtime/JobQuery.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ public interface JobQuery extends Query<JobQuery, Job> {
192192
JobQuery orderByTenantId();
193193

194194
/**
195-
* Only select jobs that are executing,
195+
* Only select jobs that are currently being acquired,
196196
* ie. lock expiration time is not null, lock expiration is in future and suspension state is 1
197197
*/
198-
JobQuery executing();
198+
JobQuery acquired();
199199

200200
}

engine/src/main/resources/org/camunda/bpm/engine/impl/mapping/entity/Job.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@
420420
<if test="suspensionState != null">
421421
and RES.SUSPENSION_STATE_ = #{suspensionState.stateCode}
422422
</if>
423-
<if test="executing">
423+
<if test="acquired">
424424
AND
425425
RES.SUSPENSION_STATE_ = 1
426426
AND

engine/src/test/java/org/camunda/bpm/engine/test/api/mgmt/JobQueryTest.java

+13-15
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ public void testQueryInvalidSortingUsage() {
872872
}
873873

874874
@Test
875-
public void testQueryByExecuting() {
875+
public void testQueryByAcquired() {
876876
Calendar lockExpDate = Calendar.getInstance();
877877
//given - lock expiration date in future
878878
lockExpDate.add(Calendar.MILLISECOND, 30000000);
@@ -882,15 +882,15 @@ public void testQueryByExecuting() {
882882
Job job = managementService.createJobQuery().jobId(timerEntity.getId()).singleResult();
883883
assertNotNull(job);
884884

885-
List<Job> list = managementService.createJobQuery().executing().list();
885+
List<Job> list = managementService.createJobQuery().acquired().list();
886886
assertEquals(list.size(), 1);
887887
deleteJobInDatabase();
888888

889889
//given - lock expiration date in the past
890890
lockExpDate.add(Calendar.MILLISECOND, -60000000);
891891
createJobWithLockExpiration(lockExpDate.getTime());
892892

893-
list = managementService.createJobQuery().executing().list();
893+
list = managementService.createJobQuery().acquired().list();
894894
assertEquals(list.size(), 0);
895895

896896
deleteJobInDatabase();
@@ -913,22 +913,20 @@ public Void execute(CommandContext commandContext) {
913913

914914
private void createJobWithLockExpiration(Date lockDate) {
915915
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
916-
commandExecutor.execute(new Command<Void>() {
917-
public Void execute(CommandContext commandContext) {
918-
JobManager jobManager = commandContext.getJobManager();
919-
timerEntity = new TimerEntity();
920-
timerEntity.setLockOwner(UUID.randomUUID().toString());
921-
timerEntity.setDuedate(new Date());
922-
timerEntity.setRetries(0);
923-
timerEntity.setLockExpirationTime(lockDate);
916+
commandExecutor.execute((Command<Void>) commandContext -> {
917+
JobManager jobManager = commandContext.getJobManager();
918+
timerEntity = new TimerEntity();
919+
timerEntity.setLockOwner(UUID.randomUUID().toString());
920+
timerEntity.setDuedate(new Date());
921+
timerEntity.setRetries(0);
922+
timerEntity.setLockExpirationTime(lockDate);
924923

925-
jobManager.insert(timerEntity);
924+
jobManager.insert(timerEntity);
926925

927-
assertNotNull(timerEntity.getId());
926+
assertNotNull(timerEntity.getId());
928927

929-
return null;
928+
return null;
930929

931-
}
932930
});
933931
}
934932

webapps/frontend/camunda-bpm-sdk-js/lib/api-client/resources/job.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Job.get = function(id, done) {
6666
* @param {String} params.sorting.sortOrder Sort the results in a given order. Values may be asc for ascending order or desc for descending order.
6767
* @param {String} [params.firstResult] Pagination of results. Specifies the index of the first result to return.
6868
* @param {String} [params.maxResults] Pagination of results. Specifies the maximum number of results to return. Will return less results if there are no more results left.
69-
* @param {Bool} [params.executing] Only select jobs which are executing, ie. lock expiration time is not null, lock expiration is in future and suspension state is 1
69+
* @param {Bool} [params.acquired] Select jobs which are acquired, ie. lock expiration time is not
70+
* null,lock expiration is in future and suspension state is 1
7071
* @param {Function} done
7172
*/
7273
Job.list = function(params, done) {

0 commit comments

Comments
 (0)