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

fix(engine): allow querying for hist pis by async activities #4769

Merged
merged 1 commit into from
Nov 14, 2024
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 @@ -240,7 +240,7 @@
"activityIdIn": {
"type": "array",
"itemType": "string",
"desc": "Restrict to instances with an active activity with one of the given ids. This filter behaves differently as `activeActivityIdIn` since it also yields results when filtering for activities with an incident. ${listTypeDescription}"
"desc": "Restrict to instances with an active activity with one of the given ids. In contrast to the `activeActivityIdIn` filter, it can query for async and incident activities. ${listTypeDescription}"
},

"executedActivityIdIn": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ public interface HistoricProcessInstanceQuery extends Query<HistoricProcessInsta
HistoricProcessInstanceQuery activeActivityIdIn(String... ids);

/**
* Only select historic process instances with an active activity with one of the given ids. This filter behaves differently as `activeActivityIdIn` since it also yields results when filtering for activities with an incident.
* Only select historic process instances with an active activity with one of the given ids.
* In contrast to the `activeActivityIdIn` filter, it can query for async and incident activities.
*/
HistoricProcessInstanceQuery activityIdIn(String... ids);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@

<bind name="INC_JOIN" value="false" />
<bind name="HAI_JOIN" value="false" />
<bind name="INCACT_JOIN" value="false" />
<bind name="RU_EXE_JOIN" value="false" />
<bind name="JOIN_TYPE" value="'inner join'" />

<foreach collection="queries" item="query">
Expand All @@ -414,12 +414,12 @@
<bind name="INC_JOIN" value="true" />
</if>

<if test="query != null &amp;&amp; (query.executedActivityIds != null and query.executedActivityIds.length > 0) || (query.activeActivityIds != null and query.activeActivityIds.length > 0) || (query.activityIds != null and query.activityIds.length > 0)">
<if test="query != null &amp;&amp; (query.executedActivityIds != null and query.executedActivityIds.length > 0) || (query.activeActivityIds != null and query.activeActivityIds.length > 0)">
<bind name="HAI_JOIN" value="true" />
</if>

<if test="query != null &amp;&amp; (query.activityIds != null and query.activityIds.length > 0)">
<bind name="INCACT_JOIN" value="true" />
<bind name="RU_EXE_JOIN" value="true" />
</if>
</foreach>

Expand All @@ -430,9 +430,8 @@
LEFT JOIN ${prefix}ACT_HI_ACTINST HAI
ON HAI.PROC_INST_ID_ = SELF.ID_
</if>

<if test="INCACT_JOIN">
LEFT JOIN ${prefix}ACT_HI_INCIDENT INCACT on SELF.PROC_INST_ID_ = INCACT.PROC_INST_ID_
<if test="RU_EXE_JOIN">
LEFT JOIN ${prefix}ACT_RU_EXECUTION EXE on SELF.PROC_INST_ID_ = EXE.PROC_INST_ID_
</if>

<!-- actual value conditions are checked in the WHERE part;
Expand Down Expand Up @@ -643,19 +642,14 @@
)
</if>

<if test="query.activityIds != null and query.activityIds.length > 0">
${queryType} (
(
HAI.END_TIME_ IS NULL
AND HAI.ACT_ID_ IN
<foreach item="activityId" index="index" collection="query.activityIds" open="(" separator="," close=")">
#{activityId}
</foreach>
) OR INCACT.ACTIVITY_ID_ IN
<foreach item="activityId" index="index" collection="query.activityIds" open="(" separator="," close=")">
#{activityId}
</foreach>
)
<if test="query.activityIds != null &amp;&amp; query.activityIds.length > 0">
${queryType} (EXE.IS_EVENT_SCOPE_ = ${falseConstant}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

and EXE.ACT_ID_ in
<foreach item="activityId" index="index" collection="query.activityIds"
open="(" separator="," close=")">
#{activityId}
</foreach>
)
</if>

<if test="query.executedActivityIds != null and query.executedActivityIds.length > 0">
Expand Down
Loading
Loading