Skip to content

added multiple query properties #4041

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 @@ -250,6 +250,11 @@ public interface HistoricCaseInstanceQuery extends Query<HistoricCaseInstanceQue
* Only select historic case instances that have the provided callback identifier.
*/
HistoricCaseInstanceQuery caseInstanceCallbackId(String callbackId);

/**
* Only select historic case instances that have the provided callback identifiers.
*/
HistoricCaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackId);

/**
* Only select historic case instances that have the provided callback type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;

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

Expand All @@ -30,6 +31,8 @@ public interface HistoricPlanItemInstanceQuery extends Query<HistoricPlanItemIns
HistoricPlanItemInstanceQuery planItemInstanceCaseDefinitionId(String caseDefinitionId);
HistoricPlanItemInstanceQuery planItemInstanceDerivedCaseDefinitionId(String derivedCaseDefinitionId);
HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceId(String caseInstanceId);

HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceIds(Set<String> caseInstanceIds);
HistoricPlanItemInstanceQuery planItemInstanceStageInstanceId(String stageInstanceId);
HistoricPlanItemInstanceQuery planItemInstanceElementId(String elementId);
HistoricPlanItemInstanceQuery planItemInstanceDefinitionId(String planItemDefinitionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public interface CaseInstanceQuery extends Query<CaseInstanceQuery, CaseInstance
CaseInstanceQuery caseInstanceLastReactivatedAfter(Date afterTime);
CaseInstanceQuery caseInstanceLastReactivatedBy(String userId);
CaseInstanceQuery caseInstanceCallbackId(String callbackId);
CaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackIds);
CaseInstanceQuery caseInstanceCallbackType(String callbackType);
CaseInstanceQuery caseInstanceReferenceId(String referenceId);
CaseInstanceQuery caseInstanceReferenceType(String referenceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;

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

Expand All @@ -37,6 +38,7 @@ public interface PlanItemInstanceQuery extends Query<PlanItemInstanceQuery, Plan
PlanItemInstanceQuery caseDefinitionId(String caseDefinitionId);
PlanItemInstanceQuery derivedCaseDefinitionId(String derivedCaseDefinitionId);
PlanItemInstanceQuery caseInstanceId(String caseInstanceId);
PlanItemInstanceQuery caseInstanceIds(Set<String> caseInstanceIds);

PlanItemInstanceQuery stageInstanceId(String stageInstanceId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ protected static void populateQuery(JsonNode queryNode, HistoricCaseInstanceQuer
break;
case "callbackId":
query.caseInstanceCallbackId(value.textValue());
case "callbackIds":
query.caseInstanceCallbackIds(asStringSet(value));
break;
case "callbackType":
query.caseInstanceCallbackType(value.textValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ protected void populateQueryNode(ObjectNode queryNode, HistoricCaseInstanceQuery
putIfNotNull(queryNode, "lastReactivatedAfter", query.getLastReactivatedAfter());
putIfNotNull(queryNode, "lastReactivatedBy", query.getLastReactivatedBy());
putIfNotNull(queryNode, "callbackId", query.getCallbackId());
putIfNotNullOrEmpty(queryNode, "callbackIds", query.getCallbackIds());
putIfNotNull(queryNode, "callbackType", query.getCallbackType());
putIfTrue(queryNode, "withoutCallbackId", query.isWithoutCallbackId());
putIfNotNull(queryNode, "referenceId", query.getReferenceId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public class HistoricCaseInstanceQueryImpl extends AbstractVariableQueryImpl<His
protected boolean withLocalizationFallback;
protected boolean withoutSorting;
protected boolean returnIdsOnly;
protected Set<String> callbackIds;

public HistoricCaseInstanceQueryImpl() {
}
Expand Down Expand Up @@ -687,6 +688,19 @@ public HistoricCaseInstanceQuery caseInstanceCallbackId(String callbackId) {
}
return this;
}

@Override
public HistoricCaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackIds) {
if (callbackIds == null || callbackIds.isEmpty()) {
throw new FlowableIllegalArgumentException("callbackIds is null or empty");
}
if (inOrStatement) {
this.currentOrQueryObject.callbackIds = callbackIds;
} else {
this.callbackIds = callbackIds;
}
return this;
}

@Override
public HistoricCaseInstanceQuery caseInstanceCallbackType(String callbackType) {
Expand Down Expand Up @@ -1370,6 +1384,10 @@ public String getCallbackId() {
return callbackId;
}

public Set<String> getCallbackIds() {
return callbackIds;
}

public String getCallbackType() {
return callbackType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;

import org.flowable.cmmn.api.history.HistoricPlanItemInstance;
import org.flowable.cmmn.api.history.HistoricPlanItemInstanceQuery;
Expand All @@ -41,6 +42,8 @@ public class HistoricPlanItemInstanceQueryImpl extends AbstractQuery<HistoricPla
protected String caseDefinitionId;
protected String derivedCaseDefinitionId;
protected String caseInstanceId;
protected Set<String> caseInstanceIds;
private List<List<String>> safeCaseInstanceIds;
protected String stageInstanceId;
protected String elementId;
protected String planItemDefinitionId;
Expand Down Expand Up @@ -136,6 +139,18 @@ public HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceId(String caseI
return this;
}

@Override
public HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceIds(Set<String> caseInstanceIds) {
if (caseInstanceIds == null) {
throw new FlowableIllegalArgumentException("Set of case instance ids is null");
}
if (caseInstanceIds.isEmpty()) {
throw new FlowableIllegalArgumentException("Set of case instance ids is empty");
}
this.caseInstanceIds = caseInstanceIds;
return this;
}

@Override
public HistoricPlanItemInstanceQuery planItemInstanceStageInstanceId(String stageInstanceId) {
this.stageInstanceId = stageInstanceId;
Expand Down Expand Up @@ -720,4 +735,16 @@ public List<List<String>> getSafeInvolvedGroups() {
public void setSafeInvolvedGroups(List<List<String>> safeInvolvedGroups) {
this.safeInvolvedGroups = safeInvolvedGroups;
}

public List<List<String>> getSafeCaseInstanceIds() {
return safeCaseInstanceIds;
}

public void setSafeCaseInstanceIds(List<List<String>> safeProcessInstanceIds) {
this.safeCaseInstanceIds = safeProcessInstanceIds;
}

public Collection<String> getCaseInstanceIds() {
return caseInstanceIds;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,9 @@ protected void setSafeInValueLists(HistoricPlanItemInstanceQueryImpl planItemIns
if (planItemInstanceQuery.getInvolvedGroups() != null) {
planItemInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(planItemInstanceQuery.getInvolvedGroups()));
}
if(planItemInstanceQuery.getCaseInstanceIds() != null) {
planItemInstanceQuery.setSafeCaseInstanceIds(createSafeInValuesList(planItemInstanceQuery.getCaseInstanceIds()));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ protected void setSafeInValueLists(PlanItemInstanceQueryImpl planItemInstanceQue
if (planItemInstanceQuery.getInvolvedGroups() != null) {
planItemInstanceQuery.setSafeInvolvedGroups(createSafeInValuesList(planItemInstanceQuery.getInvolvedGroups()));
}
if(planItemInstanceQuery.getCaseInstanceIds() != null) {
planItemInstanceQuery.setSafeCaseInstanceIds(createSafeInValuesList(planItemInstanceQuery.getCaseInstanceIds()));
}

if (planItemInstanceQuery.getOrQueryObjects() != null && !planItemInstanceQuery.getOrQueryObjects().isEmpty()) {
for (PlanItemInstanceQueryImpl oInstanceQuery : planItemInstanceQuery.getOrQueryObjects()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class CaseInstanceQueryImpl extends AbstractVariableQueryImpl<CaseInstanc
protected Date lastReactivatedAfter;
protected String lastReactivatedBy;
protected String callbackId;
protected Set<String> callbackIds;
protected String callbackType;
protected String referenceId;
protected String referenceType;
Expand Down Expand Up @@ -606,6 +607,19 @@ public CaseInstanceQuery caseInstanceCallbackId(String callbackId) {
return this;
}

@Override
public CaseInstanceQuery caseInstanceCallbackIds(Set<String> callbackIds) {
if (callbackIds == null || callbackIds.isEmpty()) {
throw new FlowableIllegalArgumentException("callbackIds is null or empty");
}
if (inOrStatement) {
this.currentOrQueryObject.callbackIds = callbackIds;
} else {
this.callbackIds = callbackIds;
}
return this;
}

@Override
public CaseInstanceQuery caseInstanceCallbackType(String callbackType) {
if (callbackType == null) {
Expand Down Expand Up @@ -1175,6 +1189,10 @@ public String getCallbackId() {
return callbackId;
}

public Set<String> getCallbackIds() {
return callbackIds;
}

public String getCallbackType() {
return callbackType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;

import org.flowable.cmmn.api.runtime.PlanItemInstance;
import org.flowable.cmmn.api.runtime.PlanItemInstanceQuery;
Expand All @@ -39,6 +40,8 @@ public class PlanItemInstanceQueryImpl extends AbstractVariableQueryImpl<PlanIte
protected String caseDefinitionId;
protected String derivedCaseDefinitionId;
protected String caseInstanceId;
protected Set<String> caseInstanceIds;
private List<List<String>> safeCaseInstanceIds;
protected String stageInstanceId;
protected String planItemInstanceId;
protected String elementId;
Expand Down Expand Up @@ -150,6 +153,23 @@ public PlanItemInstanceQuery caseInstanceId(String caseInstanceId) {
return this;
}

@Override
public PlanItemInstanceQuery caseInstanceIds(Set<String> caseInstanceIds) {
if (caseInstanceIds == null) {
throw new FlowableIllegalArgumentException("Set of case instance ids is null");
}
if (caseInstanceIds.isEmpty()) {
throw new FlowableIllegalArgumentException("Set of case instance ids is empty");
}

if (inOrStatement) {
this.currentOrQueryObject.caseInstanceIds = caseInstanceIds;
} else {
this.caseInstanceIds = caseInstanceIds;
}
return this;
}

@Override
public PlanItemInstanceQuery stageInstanceId(String stageInstanceId) {
if (stageInstanceId == null) {
Expand Down Expand Up @@ -1352,4 +1372,16 @@ protected void ensureVariablesInitialized() {
public List<PlanItemInstanceQueryImpl> getOrQueryObjects() {
return orQueryObjects;
}

public List<List<String>> getSafeCaseInstanceIds() {
return safeCaseInstanceIds;
}

public void setSafeCaseInstanceIds(List<List<String>> safeProcessInstanceIds) {
this.safeCaseInstanceIds = safeProcessInstanceIds;
}

public Collection<String> getCaseInstanceIds() {
return caseInstanceIds;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@
<if test="callbackId != null">
and RES.CALLBACK_ID_ = #{callbackId, jdbcType=VARCHAR}
</if>
<if test="callbackIds != null">
and RES.CALLBACK_ID_ in
<foreach item="callbackId" index="index" collection="callbackIds" open="(" separator="," close=")">
#{callbackId, jdbcType=VARCHAR}
</foreach>
</if>
<if test="callbackType != null">
and RES.CALLBACK_TYPE_ = #{callbackType, jdbcType=VARCHAR}
</if>
Expand Down Expand Up @@ -762,6 +768,9 @@
<if test="orQueryObject.callbackId != null">
or RES.CALLBACK_ID_ = #{orQueryObject.callbackId, jdbcType=VARCHAR}
</if>
<if test="orQueryObject.callbackIds != null">
or RES.CALLBACK_ID_ in <foreach item="callbackId" index="index" collection="orQueryObject.callbackIds" open="(" separator="," close=")">#{callbackId, jdbcType=VARCHAR}</foreach>
</if>
<if test="orQueryObject.callbackType != null">
or RES.CALLBACK_TYPE_ = #{orQueryObject.callbackType, jdbcType=VARCHAR}
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,12 @@
<if test="callbackId != null">
and ${queryTablePrefix}CALLBACK_ID_ = #{callbackId, jdbcType=VARCHAR}
</if>
<if test="callbackIds != null">
and ${queryTablePrefix}CALLBACK_ID_ in
<foreach item="callbackId" index="index" collection="callbackIds" open="(" separator="," close=")">
#{callbackId, jdbcType=VARCHAR}
</foreach>
</if>
<if test="callbackType != null">
and ${queryTablePrefix}CALLBACK_TYPE_ = #{callbackType, jdbcType=VARCHAR}
</if>
Expand Down Expand Up @@ -913,6 +919,11 @@
<if test="orQueryObject.callbackId != null">
or ${queryTablePrefix}CALLBACK_ID_ = #{orQueryObject.callbackId, jdbcType=VARCHAR}
</if>
<if test="orQueryObject.callbackIds != null">
or ${queryTablePrefix}CALLBACK_ID_ in
<foreach item="callbackId" index="index" collection="orQueryObject.callbackIds" open="(" separator="," close=")">#{callbackId, jdbcType=VARCHAR}
</foreach>
</if>
<if test="orQueryObject.callbackType != null">
or ${queryTablePrefix}CALLBACK_TYPE_ = #{orQueryObject.callbackType, jdbcType=VARCHAR}
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,19 @@
<if test="caseInstanceId != null">
and RES.CASE_INST_ID_ = #{caseInstanceId, jdbcType=VARCHAR}
</if>
<if test="caseInstanceIds != null and !caseInstanceIds.empty">
and (
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="safeCaseInstanceIds">
<if test="groupIndex &gt; 0">
or
</if>
RES.CASE_INST_ID_ IN
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
#{caseInstanceId, jdbcType=VARCHAR}
</foreach>
</foreach>
)
</if>
<if test="stageInstanceId != null">
and RES.STAGE_INST_ID_ = #{stageInstanceId, jdbcType=VARCHAR}
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,19 @@
<if test="caseInstanceId != null">
and RES.CASE_INST_ID_ = #{caseInstanceId, jdbcType=VARCHAR}
</if>
<if test="caseInstanceIds != null and !caseInstanceIds.empty">
and (
<foreach item="caseInstanceIdListItem" index="groupIndex" collection="safeCaseInstanceIds">
<if test="groupIndex &gt; 0">
or
</if>
RES.CASE_INST_ID_ IN
<foreach item="caseInstanceId" index="index" collection="caseInstanceIdListItem" open="(" separator="," close=")">
#{caseInstanceId, jdbcType=VARCHAR}
</foreach>
</foreach>
)
</if>
<if test="stageInstanceId != null">
and RES.STAGE_INST_ID_ = #{stageInstanceId, jdbcType=VARCHAR}
</if>
Expand Down Expand Up @@ -711,6 +724,9 @@
<if test="orQueryObject.caseInstanceId != null">
or RES.CASE_INST_ID_ = #{orQueryObject.caseInstanceId, jdbcType=VARCHAR}
</if>
<if test="orQueryObject.caseInstanceIds != null">
or RES.CASE_INST_ID_ in <foreach item="caseInstanceId" index="index" collection="orQueryObject.caseInstanceIds" open="(" separator="," close=")">#{caseInstanceId, jdbcType=VARCHAR}</foreach>
</if>
<if test="orQueryObject.stageInstanceId != null">
or RES.STAGE_INST_ID_ = #{orQueryObject.stageInstanceId, jdbcType=VARCHAR}
</if>
Expand Down
Loading