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

feat: #3659 createHistoricProcessInstanceQuery().list() returns processDefinitionCategory #3660

Open
wants to merge 1 commit 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 @@ -50,6 +50,9 @@ public interface HistoricProcessInstance {
/** The version of the process definition of the process instance. */
Integer getProcessDefinitionVersion();

/** The category of the process definition of the process instance. */
String getProcessDefinitionCategory();

/**
* The deployment id of the process definition of the process instance.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public interface HistoricProcessInstanceEntity extends HistoricScopeInstanceEnti

void setProcessDefinitionVersion(Integer processDefinitionVersion);

void setProcessDefinitionCategory(String processDefinitionCategory);

void setDeploymentId(String deploymentId);

void setCallbackId(String callbackId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class HistoricProcessInstanceEntityImpl extends HistoricScopeInstanceEnti
protected String processDefinitionKey;
protected String processDefinitionName;
protected Integer processDefinitionVersion;
protected String processDefinitionCategory;
protected String deploymentId;
protected String callbackId;
protected String callbackType;
Expand Down Expand Up @@ -101,6 +102,7 @@ public Object getPersistentState() {
persistentState.put("processDefinitionKey", processDefinitionKey);
persistentState.put("processDefinitionName", processDefinitionName);
persistentState.put("processDefinitionVersion", processDefinitionVersion);
persistentState.put("processDefinitionCategory", processDefinitionCategory);
persistentState.put("deploymentId", deploymentId);
persistentState.put("callbackId", callbackId);
persistentState.put("callbackType", callbackType);
Expand Down Expand Up @@ -258,6 +260,16 @@ public void setProcessDefinitionVersion(Integer processDefinitionVersion) {
this.processDefinitionVersion = processDefinitionVersion;
}

@Override
public String getProcessDefinitionCategory() {
return processDefinitionCategory;
}

@Override
public void setProcessDefinitionCategory(String processDefinitionCategory) {
this.processDefinitionCategory = processDefinitionCategory;
}

@Override
public String getDeploymentId() {
return deploymentId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
<result property="processDefinitionName" column="PROC_DEF_NAME_" jdbcType="VARCHAR" />
<result property="processDefinitionKey" column="PROC_DEF_KEY_" jdbcType="VARCHAR" />
<result property="processDefinitionVersion" column="PROC_DEF_VERSION_" jdbcType="INTEGER" />
<result property="processDefinitionCategory" column="PROC_DEF_CATEGORY_" jdbcType="VARCHAR" />
<result property="deploymentId" column="DEPLOYMENT_ID_" jdbcType="VARCHAR" />
<result property="startTime" column="START_TIME_" jdbcType="TIMESTAMP" />
<result property="endTime" column="END_TIME_" jdbcType="TIMESTAMP" />
Expand Down Expand Up @@ -358,7 +359,7 @@

<select id="selectHistoricProcessInstancesByQueryCriteria" parameterType="org.flowable.engine.impl.HistoricProcessInstanceQueryImpl" resultMap="historicProcessInstanceResultMap">
<if test="needsPaging">${limitBefore}</if>
SELECT RES.* <if test="needsPaging">${limitBetween}</if>, DEF.KEY_ as PROC_DEF_KEY_, DEF.NAME_ as PROC_DEF_NAME_, DEF.VERSION_ as PROC_DEF_VERSION_, DEF.DEPLOYMENT_ID_ as DEPLOYMENT_ID_
SELECT RES.* <if test="needsPaging">${limitBetween}</if>, DEF.KEY_ as PROC_DEF_KEY_, DEF.NAME_ as PROC_DEF_NAME_, DEF.VERSION_ as PROC_DEF_VERSION_, DEF.CATEGORY_ as PROC_DEF_CATEGORY_, DEF.DEPLOYMENT_ID_ as DEPLOYMENT_ID_
<include refid="selectHistoricProcessInstancesByQueryCriteriaSql"/>
${orderBy}
<if test="needsPaging">${limitAfter}</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,7 @@ public void testHistoricProcessInstanceQueryByProcessDefinitionCategory() {
HistoryTestHelper.waitForJobExecutorToProcessAllHistoryJobs(processEngineConfiguration, managementService, 7000, 200);

assertThat(historyService.createHistoricProcessInstanceQuery().processDefinitionCategory(processDefinitionCategory).list()).hasSize(1);
assertThat(historyService.createHistoricProcessInstanceQuery().processDefinitionCategory(processDefinitionCategory).list().get(0).getProcessDefinitionCategory()).isEqualTo(processDefinitionCategory);
assertThat(historyService.createHistoricProcessInstanceQuery().processDefinitionCategory(processDefinitionCategory).count()).isEqualTo(1);
assertThat(historyService.createHistoricProcessInstanceQuery().processDefinitionCategory("invalid").list()).isEmpty();
assertThat(historyService.createHistoricProcessInstanceQuery().processDefinitionCategory("invalid").count()).isZero();
Expand Down