Skip to content

Commit 45604c7

Browse files
Merge branch 'main' of github.com:flowable/flowable-engine into flowable-release-7.3.0
2 parents 33cb441 + 15c9f0b commit 45604c7

13 files changed

Lines changed: 138 additions & 28 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class HistoricCaseInstanceQueryImpl extends AbstractVariableQueryImpl<His
6767
protected Integer caseDefinitionVersion;
6868
protected String caseInstanceId;
6969
protected Set<String> caseInstanceIds;
70+
private List<List<String>> safeCaseInstanceIds;
7071
protected String caseInstanceName;
7172
protected String caseInstanceNameLike;
7273
protected String caseInstanceNameLikeIgnoreCase;
@@ -1459,6 +1460,14 @@ public boolean isNeedsCaseDefinitionOuterJoin() {
14591460
return hasOrderByForColumn(HistoricCaseInstanceQueryProperty.CASE_DEFINITION_KEY.getName());
14601461
}
14611462

1463+
public List<List<String>> getSafeCaseInstanceIds() {
1464+
return safeCaseInstanceIds;
1465+
}
1466+
1467+
public void setSafeCaseInstanceIds(List<List<String>> safeCaseInstanceIds) {
1468+
this.safeCaseInstanceIds = safeCaseInstanceIds;
1469+
}
1470+
14621471
public List<List<String>> getSafeInvolvedGroups() {
14631472
return safeInvolvedGroups;
14641473
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ public void clearAllLockTimes(String lockOwner) {
214214
}
215215

216216
protected void setSafeInValueLists(CaseInstanceQueryImpl caseInstanceQuery) {
217+
if (caseInstanceQuery.getCaseInstanceIds() != null) {
218+
caseInstanceQuery.setSafeCaseInstanceIds(createSafeInValuesList(caseInstanceQuery.getCaseInstanceIds()));
219+
}
220+
217221
if (caseInstanceQuery.getInvolvedGroups() != null) {
218222
caseInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(caseInstanceQuery.getInvolvedGroups()));
219223
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ public void bulkDeleteHistoricCaseInstances(Collection<String> caseInstanceIds)
105105
}
106106

107107
protected void setSafeInValueLists(HistoricCaseInstanceQueryImpl caseInstanceQuery) {
108+
if (caseInstanceQuery.getCaseInstanceIds() != null) {
109+
caseInstanceQuery.setSafeCaseInstanceIds(createSafeInValuesList(caseInstanceQuery.getCaseInstanceIds()));
110+
}
111+
108112
if (caseInstanceQuery.getInvolvedGroups() != null) {
109113
caseInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(caseInstanceQuery.getInvolvedGroups()));
110114
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public class CaseInstanceQueryImpl extends AbstractVariableQueryImpl<CaseInstanc
6969
protected String businessStatusLikeIgnoreCase;
7070
protected String caseInstanceId;
7171
protected Set<String> caseInstanceIds;
72+
private List<List<String>> safeCaseInstanceIds;
7273
protected String caseInstanceParentId;
7374
protected String caseInstanceParentPlanItemInstanceId;
7475
protected Date startedBefore;
@@ -1252,6 +1253,14 @@ public List<CaseInstanceQueryImpl> getOrQueryObjects() {
12521253
return orQueryObjects;
12531254
}
12541255

1256+
public List<List<String>> getSafeCaseInstanceIds() {
1257+
return safeCaseInstanceIds;
1258+
}
1259+
1260+
public void setSafeCaseInstanceIds(List<List<String>> safeCaseInstanceIds) {
1261+
this.safeCaseInstanceIds = safeCaseInstanceIds;
1262+
}
1263+
12551264
public List<List<String>> getSafeInvolvedGroups() {
12561265
return safeInvolvedGroups;
12571266
}

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,18 @@
352352
<if test="caseInstanceId != null">
353353
and RES.ID_ = #{caseInstanceId, jdbcType=VARCHAR}
354354
</if>
355-
<if test="caseInstanceIds != null">
356-
and RES.ID_ IN
357-
<foreach item="caseInstanceId" index="index" collection="caseInstanceIds" open="(" separator="," close=")">
358-
#{caseInstanceId, jdbcType=VARCHAR}
355+
<if test="caseInstanceIds != null &amp;&amp; !caseInstanceIds.empty">
356+
and (
357+
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="safeCaseInstanceIds">
358+
<if test="groupIndex &gt; 0">
359+
or
360+
</if>
361+
RES.ID_ IN
362+
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
363+
#{caseInstanceId, jdbcType=VARCHAR}
364+
</foreach>
359365
</foreach>
366+
)
360367
</if>
361368
<if test="caseDefinitionId != null">
362369
and RES.CASE_DEF_ID_ = #{caseDefinitionId, jdbcType=VARCHAR}
@@ -637,11 +644,18 @@
637644
<if test="orQueryObject.caseInstanceId != null">
638645
or RES.ID_ = #{orQueryObject.caseInstanceId, jdbcType=VARCHAR}
639646
</if>
640-
<if test="orQueryObject.caseInstanceIds != null">
641-
or RES.ID_ IN
642-
<foreach item="caseInstanceId" index="index" collection="orQueryObject.caseInstanceIds" open="(" separator="," close=")">
643-
#{caseInstanceId, jdbcType=VARCHAR}
647+
<if test="orQueryObject.caseInstanceIds != null &amp;&amp; !orQueryObject.caseInstanceIds.empty">
648+
or (
649+
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="orQueryObject.safeCaseInstanceIds">
650+
<if test="groupIndex &gt; 0">
651+
or
652+
</if>
653+
RES.ID_ IN
654+
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
655+
#{caseInstanceId, jdbcType=VARCHAR}
656+
</foreach>
644657
</foreach>
658+
)
645659
</if>
646660
<if test="orQueryObject.caseDefinitionId != null">
647661
or RES.CASE_DEF_ID_ = #{orQueryObject.caseDefinitionId, jdbcType=VARCHAR}

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,17 @@
651651
${queryTablePrefix}ID_ = #{caseInstanceId, jdbcType=VARCHAR}
652652
</if>
653653
<if test="caseInstanceIds != null &amp;&amp; !caseInstanceIds.empty">
654-
and ${queryTablePrefix}ID_ IN
655-
<foreach item="caseInstanceId" index="index" collection="caseInstanceIds"
656-
open="(" separator="," close=")">
657-
#{caseInstanceId, jdbcType=VARCHAR}
654+
and (
655+
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="safeCaseInstanceIds">
656+
<if test="groupIndex &gt; 0">
657+
or
658+
</if>
659+
${queryTablePrefix}ID_ IN
660+
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
661+
#{caseInstanceId, jdbcType=VARCHAR}
662+
</foreach>
658663
</foreach>
664+
)
659665
</if>
660666
<if test="caseDefinitionId != null">
661667
and ${queryTablePrefix}CASE_DEF_ID_ = #{caseDefinitionId, jdbcType=VARCHAR}
@@ -817,11 +823,17 @@
817823
${queryTablePrefix}ID_ = #{orQueryObject.caseInstanceId, jdbcType=VARCHAR}
818824
</if>
819825
<if test="orQueryObject.caseInstanceIds != null &amp;&amp; !orQueryObject.caseInstanceIds.empty">
820-
or ${queryTablePrefix}ID_ IN
821-
<foreach item="caseInstanceId" index="index" collection="orQueryObject.caseInstanceIds"
822-
open="(" separator="," close=")">
823-
#{caseInstanceId, jdbcType=VARCHAR}
826+
or (
827+
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="orQueryObject.safeCaseInstanceIds">
828+
<if test="groupIndex &gt; 0">
829+
or
830+
</if>
831+
${queryTablePrefix}ID_ IN
832+
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
833+
#{caseInstanceId, jdbcType=VARCHAR}
834+
</foreach>
824835
</foreach>
836+
)
825837
</if>
826838
<if test="orQueryObject.caseDefinitionId != null">
827839
or ${queryTablePrefix}CASE_DEF_ID_ = #{orQueryObject.caseDefinitionId, jdbcType=VARCHAR}

modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,10 @@ public String getCallbackType() {
14031403
public List<ExecutionQueryImpl> getOrQueryObjects() {
14041404
return orQueryObjects;
14051405
}
1406+
1407+
public List<List<String>> getSafeProcessInstanceIds() {
1408+
return null;
1409+
}
14061410

14071411
public List<List<String>> getSafeInvolvedGroups() {
14081412
return safeInvolvedGroups;

modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricProcessInstanceQueryImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public class HistoricProcessInstanceQueryImpl extends AbstractVariableQueryImpl<
8989
protected String processDefinitionNameLikeIgnoreCase;
9090
protected Integer processDefinitionVersion;
9191
protected Set<String> processInstanceIds;
92+
private List<List<String>> safeProcessInstanceIds;
9293
protected String activeActivityId;
9394
protected Set<String> activeActivityIds;
9495
protected String involvedUser;
@@ -1473,6 +1474,14 @@ public boolean isNeedsProcessDefinitionOuterJoin() {
14731474
return hasOrderByForColumn(HistoricProcessInstanceQueryProperty.PROCESS_DEFINITION_KEY.getName());
14741475
}
14751476

1477+
public List<List<String>> getSafeProcessInstanceIds() {
1478+
return safeProcessInstanceIds;
1479+
}
1480+
1481+
public void setSafeProcessInstanceIds(List<List<String>> safeProcessInstanceIds) {
1482+
this.safeProcessInstanceIds = safeProcessInstanceIds;
1483+
}
1484+
14761485
public List<List<String>> getSafeInvolvedGroups() {
14771486
return safeInvolvedGroups;
14781487
}

modules/flowable-engine/src/main/java/org/flowable/engine/impl/ProcessInstanceQueryImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public class ProcessInstanceQueryImpl extends AbstractVariableQueryImpl<ProcessI
6666
protected String processDefinitionNameLikeIgnoreCase;
6767
protected Integer processDefinitionVersion;
6868
protected Set<String> processInstanceIds;
69+
private List<List<String>> safeProcessInstanceIds;
6970
protected String processDefinitionKey;
7071
protected String processDefinitionKeyLike;
7172
protected String processDefinitionKeyLikeIgnoreCase;
@@ -1364,6 +1365,14 @@ public boolean isNeedsProcessDefinitionOuterJoin() {
13641365
return hasOrderByForColumn(ProcessInstanceQueryProperty.PROCESS_DEFINITION_KEY.getName());
13651366
}
13661367

1368+
public List<List<String>> getSafeProcessInstanceIds() {
1369+
return safeProcessInstanceIds;
1370+
}
1371+
1372+
public void setSafeProcessInstanceIds(List<List<String>> safeProcessInstanceIds) {
1373+
this.safeProcessInstanceIds = safeProcessInstanceIds;
1374+
}
1375+
13671376
public List<List<String>> getSafeInvolvedGroups() {
13681377
return safeInvolvedGroups;
13691378
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ protected void setSafeInValueLists(ExecutionQueryImpl executionQuery) {
344344
}
345345

346346
protected void setSafeInValueLists(ProcessInstanceQueryImpl processInstanceQuery) {
347+
if (processInstanceQuery.getProcessInstanceIds() != null) {
348+
processInstanceQuery.setSafeProcessInstanceIds(createSafeInValuesList(processInstanceQuery.getProcessInstanceIds()));
349+
}
350+
347351
if (processInstanceQuery.getInvolvedGroups() != null) {
348352
processInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(processInstanceQuery.getInvolvedGroups()));
349353
}

0 commit comments

Comments
 (0)