Skip to content

Commit 8411991

Browse files
added multiple query properties
added query parameter for case, processes, tasks, plan items and the historic variants changes according to comments fixed testcases
1 parent 6846929 commit 8411991

File tree

114 files changed

+1584
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1584
-28
lines changed

modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricCaseInstanceQuery.java

+5
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ public interface HistoricCaseInstanceQuery extends Query<HistoricCaseInstanceQue
250250
* Only select historic case instances that have the provided callback identifier.
251251
*/
252252
HistoricCaseInstanceQuery caseInstanceCallbackId(String callbackId);
253+
254+
/**
255+
* Only select historic case instances that have the provided callback identifiers.
256+
*/
257+
HistoricCaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackId);
253258

254259
/**
255260
* Only select historic case instances that have the provided callback type.

modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstanceQuery.java

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.Collection;
1616
import java.util.Date;
1717
import java.util.List;
18+
import java.util.Set;
1819

1920
import org.flowable.common.engine.api.query.Query;
2021

@@ -30,6 +31,8 @@ public interface HistoricPlanItemInstanceQuery extends Query<HistoricPlanItemIns
3031
HistoricPlanItemInstanceQuery planItemInstanceCaseDefinitionId(String caseDefinitionId);
3132
HistoricPlanItemInstanceQuery planItemInstanceDerivedCaseDefinitionId(String derivedCaseDefinitionId);
3233
HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceId(String caseInstanceId);
34+
35+
HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceIds(Set<String> caseInstanceIds);
3336
HistoricPlanItemInstanceQuery planItemInstanceStageInstanceId(String stageInstanceId);
3437
HistoricPlanItemInstanceQuery planItemInstanceElementId(String elementId);
3538
HistoricPlanItemInstanceQuery planItemInstanceDefinitionId(String planItemDefinitionId);

modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/CaseInstanceQuery.java

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public interface CaseInstanceQuery extends Query<CaseInstanceQuery, CaseInstance
6060
CaseInstanceQuery caseInstanceLastReactivatedAfter(Date afterTime);
6161
CaseInstanceQuery caseInstanceLastReactivatedBy(String userId);
6262
CaseInstanceQuery caseInstanceCallbackId(String callbackId);
63+
CaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackIds);
6364
CaseInstanceQuery caseInstanceCallbackType(String callbackType);
6465
CaseInstanceQuery caseInstanceReferenceId(String referenceId);
6566
CaseInstanceQuery caseInstanceReferenceType(String referenceType);

modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstanceQuery.java

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.Collection;
1717
import java.util.Date;
1818
import java.util.List;
19+
import java.util.Set;
1920

2021
import org.flowable.common.engine.api.query.Query;
2122

@@ -37,6 +38,7 @@ public interface PlanItemInstanceQuery extends Query<PlanItemInstanceQuery, Plan
3738
PlanItemInstanceQuery caseDefinitionId(String caseDefinitionId);
3839
PlanItemInstanceQuery derivedCaseDefinitionId(String derivedCaseDefinitionId);
3940
PlanItemInstanceQuery caseInstanceId(String caseInstanceId);
41+
PlanItemInstanceQuery caseInstanceIds(Set<String> caseInstanceIds);
4042

4143
PlanItemInstanceQuery stageInstanceId(String stageInstanceId);
4244

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/BatchDeleteCaseConfig.java

+2
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ protected static void populateQuery(JsonNode queryNode, HistoricCaseInstanceQuer
240240
break;
241241
case "callbackId":
242242
query.caseInstanceCallbackId(value.textValue());
243+
case "callbackIds":
244+
query.caseInstanceCallbackIds(asStringSet(value));
243245
break;
244246
case "callbackType":
245247
query.caseInstanceCallbackType(value.textValue());

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/DeleteHistoricCaseInstancesUsingBatchesCmd.java

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ protected void populateQueryNode(ObjectNode queryNode, HistoricCaseInstanceQuery
222222
putIfNotNull(queryNode, "lastReactivatedAfter", query.getLastReactivatedAfter());
223223
putIfNotNull(queryNode, "lastReactivatedBy", query.getLastReactivatedBy());
224224
putIfNotNull(queryNode, "callbackId", query.getCallbackId());
225+
putIfNotNullOrEmpty(queryNode, "callbackIds", query.getCallbackIds());
225226
putIfNotNull(queryNode, "callbackType", query.getCallbackType());
226227
putIfTrue(queryNode, "withoutCallbackId", query.isWithoutCallbackId());
227228
putIfNotNull(queryNode, "referenceId", query.getReferenceId());

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java

+18
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public class HistoricCaseInstanceQueryImpl extends AbstractVariableQueryImpl<His
118118
protected boolean withLocalizationFallback;
119119
protected boolean withoutSorting;
120120
protected boolean returnIdsOnly;
121+
protected Set<String> callbackIds;
121122

122123
public HistoricCaseInstanceQueryImpl() {
123124
}
@@ -687,6 +688,19 @@ public HistoricCaseInstanceQuery caseInstanceCallbackId(String callbackId) {
687688
}
688689
return this;
689690
}
691+
692+
@Override
693+
public HistoricCaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackIds) {
694+
if (callbackIds == null || callbackIds.isEmpty()) {
695+
throw new FlowableIllegalArgumentException("callbackIds is null or empty");
696+
}
697+
if (inOrStatement) {
698+
this.currentOrQueryObject.callbackIds = callbackIds;
699+
} else {
700+
this.callbackIds = callbackIds;
701+
}
702+
return this;
703+
}
690704

691705
@Override
692706
public HistoricCaseInstanceQuery caseInstanceCallbackType(String callbackType) {
@@ -1370,6 +1384,10 @@ public String getCallbackId() {
13701384
return callbackId;
13711385
}
13721386

1387+
public Set<String> getCallbackIds() {
1388+
return callbackIds;
1389+
}
1390+
13731391
public String getCallbackType() {
13741392
return callbackType;
13751393
}

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricPlanItemInstanceQueryImpl.java

+27
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.Collection;
1616
import java.util.Date;
1717
import java.util.List;
18+
import java.util.Set;
1819

1920
import org.flowable.cmmn.api.history.HistoricPlanItemInstance;
2021
import org.flowable.cmmn.api.history.HistoricPlanItemInstanceQuery;
@@ -41,6 +42,8 @@ public class HistoricPlanItemInstanceQueryImpl extends AbstractQuery<HistoricPla
4142
protected String caseDefinitionId;
4243
protected String derivedCaseDefinitionId;
4344
protected String caseInstanceId;
45+
protected Set<String> caseInstanceIds;
46+
private List<List<String>> safeCaseInstanceIds;
4447
protected String stageInstanceId;
4548
protected String elementId;
4649
protected String planItemDefinitionId;
@@ -136,6 +139,18 @@ public HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceId(String caseI
136139
return this;
137140
}
138141

142+
@Override
143+
public HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceIds(Set<String> caseInstanceIds) {
144+
if (caseInstanceIds == null) {
145+
throw new FlowableIllegalArgumentException("Set of case instance ids is null");
146+
}
147+
if (caseInstanceIds.isEmpty()) {
148+
throw new FlowableIllegalArgumentException("Set of case instance ids is empty");
149+
}
150+
this.caseInstanceIds = caseInstanceIds;
151+
return this;
152+
}
153+
139154
@Override
140155
public HistoricPlanItemInstanceQuery planItemInstanceStageInstanceId(String stageInstanceId) {
141156
this.stageInstanceId = stageInstanceId;
@@ -720,4 +735,16 @@ public List<List<String>> getSafeInvolvedGroups() {
720735
public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) {
721736
this.safeInvolvedGroups = safeInvolvedGroups;
722737
}
738+
739+
public List<List<String>> getSafeCaseInstanceIds() {
740+
return safeCaseInstanceIds;
741+
}
742+
743+
public void setSafeCaseInstanceIds(List<List<String>> safeProcessInstanceIds) {
744+
this.safeCaseInstanceIds = safeProcessInstanceIds;
745+
}
746+
747+
public Collection<String> getCaseInstanceIds() {
748+
return caseInstanceIds;
749+
}
723750
}

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisHistoricPlanItemInstanceDataManager.java

+4
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,9 @@ protected void setSafeInValueLists(HistoricPlanItemInstanceQueryImpl planItemIns
103103
if (planItemInstanceQuery.getInvolvedGroups() != null) {
104104
planItemInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(planItemInstanceQuery.getInvolvedGroups()));
105105
}
106+
if(planItemInstanceQuery.getCaseInstanceIds() != null) {
107+
planItemInstanceQuery.setSafeCaseInstanceIds(createSafeInValuesList(planItemInstanceQuery.getCaseInstanceIds()));
108+
}
109+
106110
}
107111
}

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisPlanItemInstanceDataManagerImpl.java

+3
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ protected void setSafeInValueLists(PlanItemInstanceQueryImpl planItemInstanceQue
196196
if (planItemInstanceQuery.getInvolvedGroups() != null) {
197197
planItemInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(planItemInstanceQuery.getInvolvedGroups()));
198198
}
199+
if(planItemInstanceQuery.getCaseInstanceIds() != null) {
200+
planItemInstanceQuery.setSafeCaseInstanceIds(createSafeInValuesList(planItemInstanceQuery.getCaseInstanceIds()));
201+
}
199202

200203
if (planItemInstanceQuery.getOrQueryObjects() != null && !planItemInstanceQuery.getOrQueryObjects().isEmpty()) {
201204
for (PlanItemInstanceQueryImpl oInstanceQuery : planItemInstanceQuery.getOrQueryObjects()) {

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java

+18
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public class CaseInstanceQueryImpl extends AbstractVariableQueryImpl<CaseInstanc
8080
protected Date lastReactivatedAfter;
8181
protected String lastReactivatedBy;
8282
protected String callbackId;
83+
protected Set<String> callbackIds;
8384
protected String callbackType;
8485
protected String referenceId;
8586
protected String referenceType;
@@ -606,6 +607,19 @@ public CaseInstanceQuery caseInstanceCallbackId(String callbackId) {
606607
return this;
607608
}
608609

610+
@Override
611+
public CaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackIds) {
612+
if (callbackIds == null || callbackIds.isEmpty()) {
613+
throw new FlowableIllegalArgumentException("callbackIds is null or empty");
614+
}
615+
if (inOrStatement) {
616+
this.currentOrQueryObject.callbackIds = callbackIds;
617+
} else {
618+
this.callbackIds = callbackIds;
619+
}
620+
return this;
621+
}
622+
609623
@Override
610624
public CaseInstanceQuery caseInstanceCallbackType(String callbackType) {
611625
if (callbackType == null) {
@@ -1175,6 +1189,10 @@ public String getCallbackId() {
11751189
return callbackId;
11761190
}
11771191

1192+
public Set<String> getCallbackIds() {
1193+
return callbackIds;
1194+
}
1195+
11781196
public String getCallbackType() {
11791197
return callbackType;
11801198
}

modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java

+32
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.util.Collection;
1717
import java.util.Date;
1818
import java.util.List;
19+
import java.util.Set;
1920

2021
import org.flowable.cmmn.api.runtime.PlanItemInstance;
2122
import org.flowable.cmmn.api.runtime.PlanItemInstanceQuery;
@@ -39,6 +40,8 @@ public class PlanItemInstanceQueryImpl extends AbstractVariableQueryImpl<PlanIte
3940
protected String caseDefinitionId;
4041
protected String derivedCaseDefinitionId;
4142
protected String caseInstanceId;
43+
protected Set<String> caseInstanceIds;
44+
private List<List<String>> safeCaseInstanceIds;
4245
protected String stageInstanceId;
4346
protected String planItemInstanceId;
4447
protected String elementId;
@@ -150,6 +153,23 @@ public PlanItemInstanceQuery caseInstanceId(String caseInstanceId) {
150153
return this;
151154
}
152155

156+
@Override
157+
public PlanItemInstanceQuery caseInstanceIds(Set<String> caseInstanceIds) {
158+
if (caseInstanceIds == null) {
159+
throw new FlowableIllegalArgumentException("Set of case instance ids is null");
160+
}
161+
if (caseInstanceIds.isEmpty()) {
162+
throw new FlowableIllegalArgumentException("Set of case instance ids is empty");
163+
}
164+
165+
if (inOrStatement) {
166+
this.currentOrQueryObject.caseInstanceIds = caseInstanceIds;
167+
} else {
168+
this.caseInstanceIds = caseInstanceIds;
169+
}
170+
return this;
171+
}
172+
153173
@Override
154174
public PlanItemInstanceQuery stageInstanceId(String stageInstanceId) {
155175
if (stageInstanceId == null) {
@@ -1352,4 +1372,16 @@ protected void ensureVariablesInitialized() {
13521372
public List<PlanItemInstanceQueryImpl> getOrQueryObjects() {
13531373
return orQueryObjects;
13541374
}
1375+
1376+
public List<List<String>> getSafeCaseInstanceIds() {
1377+
return safeCaseInstanceIds;
1378+
}
1379+
1380+
public void setSafeCaseInstanceIds(List<List<String>> safeProcessInstanceIds) {
1381+
this.safeCaseInstanceIds = safeProcessInstanceIds;
1382+
}
1383+
1384+
public Collection<String> getCaseInstanceIds() {
1385+
return caseInstanceIds;
1386+
}
13551387
}

modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/CaseInstance.xml

+9
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,12 @@
483483
<if test="callbackId != null">
484484
and RES.CALLBACK_ID_ = #{callbackId, jdbcType=VARCHAR}
485485
</if>
486+
<if test="callbackIds != null">
487+
and RES.CALLBACK_ID_ in
488+
<foreach item="callBackId" index="index" collection="callbackIds" open="(" separator="," close=")">
489+
#{callBackId, jdbcType=NVARCHAR}
490+
</foreach>
491+
</if>
486492
<if test="callbackType != null">
487493
and RES.CALLBACK_TYPE_ = #{callbackType, jdbcType=VARCHAR}
488494
</if>
@@ -762,6 +768,9 @@
762768
<if test="orQueryObject.callbackId != null">
763769
or RES.CALLBACK_ID_ = #{orQueryObject.callbackId, jdbcType=VARCHAR}
764770
</if>
771+
<if test="orQueryObject.callbackIds != null">
772+
or RES.CALLBACK_ID_ in <foreach item="callbackId" index="index" collection="orQueryObject.callbackIds" open="(" separator="," close=")">#{callbackId, jdbcType=VARCHAR}</foreach>
773+
</if>
765774
<if test="orQueryObject.callbackType != null">
766775
or RES.CALLBACK_TYPE_ = #{orQueryObject.callbackType, jdbcType=VARCHAR}
767776
</if>

modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/HistoricCaseInstance.xml

+11
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,12 @@
754754
<if test="callbackId != null">
755755
and ${queryTablePrefix}CALLBACK_ID_ = #{callbackId, jdbcType=VARCHAR}
756756
</if>
757+
<if test="callbackIds != null">
758+
and ${queryTablePrefix}CALLBACK_ID_ in
759+
<foreach item="callBackId" index="index" collection="callbackIds" open="(" separator="," close=")">
760+
#{callBackId, jdbcType=NVARCHAR}
761+
</foreach>
762+
</if>
757763
<if test="callbackType != null">
758764
and ${queryTablePrefix}CALLBACK_TYPE_ = #{callbackType, jdbcType=VARCHAR}
759765
</if>
@@ -913,6 +919,11 @@
913919
<if test="orQueryObject.callbackId != null">
914920
or ${queryTablePrefix}CALLBACK_ID_ = #{orQueryObject.callbackId, jdbcType=VARCHAR}
915921
</if>
922+
<if test="orQueryObject.callbackIds != null">
923+
or ${queryTablePrefix}CALLBACK_ID_ in
924+
<foreach item="callbackId" index="index" collection="orQueryObject.callbackIds" open="(" separator="," close=")">#{callbackId, jdbcType=VARCHAR}
925+
</foreach>
926+
</if>
916927
<if test="orQueryObject.callbackType != null">
917928
or ${queryTablePrefix}CALLBACK_TYPE_ = #{orQueryObject.callbackType, jdbcType=VARCHAR}
918929
</if>

modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/HistoricPlanItemInstance.xml

+13
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,19 @@
409409
<if test="caseInstanceId != null">
410410
and RES.CASE_INST_ID_ = #{caseInstanceId, jdbcType=VARCHAR}
411411
</if>
412+
<if test="caseInstanceIds != null and !caseInstanceIds.empty">
413+
and (
414+
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="safeCaseInstanceIds">
415+
<if test="groupIndex &gt; 0">
416+
or
417+
</if>
418+
RES.CASE_INST_ID_ IN
419+
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
420+
#{caseInstanceId, jdbcType=NVARCHAR}
421+
</foreach>
422+
</foreach>
423+
)
424+
</if>
412425
<if test="stageInstanceId != null">
413426
and RES.STAGE_INST_ID_ = #{stageInstanceId, jdbcType=VARCHAR}
414427
</if>

modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/PlanItemInstance.xml

+16
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,19 @@
416416
<if test="caseInstanceId != null">
417417
and RES.CASE_INST_ID_ = #{caseInstanceId, jdbcType=VARCHAR}
418418
</if>
419+
<if test="caseInstanceIds != null and !caseInstanceIds.empty">
420+
and (
421+
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="safeCaseInstanceIds">
422+
<if test="groupIndex &gt; 0">
423+
or
424+
</if>
425+
RES.CASE_INST_ID_ IN
426+
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
427+
#{caseInstanceId, jdbcType=NVARCHAR}
428+
</foreach>
429+
</foreach>
430+
)
431+
</if>
419432
<if test="stageInstanceId != null">
420433
and RES.STAGE_INST_ID_ = #{stageInstanceId, jdbcType=VARCHAR}
421434
</if>
@@ -711,6 +724,9 @@
711724
<if test="orQueryObject.caseInstanceId != null">
712725
or RES.CASE_INST_ID_ = #{orQueryObject.caseInstanceId, jdbcType=VARCHAR}
713726
</if>
727+
<if test="orQueryObject.caseInstanceIds != null">
728+
or RES.CASE_INST_ID_ in <foreach item="instanceId" index="index" collection="orQueryObject.caseInstanceIds" open="(" separator="," close=")">#{instanceId, jdbcType=VARCHAR}</foreach>
729+
</if>
714730
<if test="orQueryObject.stageInstanceId != null">
715731
or RES.STAGE_INST_ID_ = #{orQueryObject.stageInstanceId, jdbcType=VARCHAR}
716732
</if>

0 commit comments

Comments
 (0)