diff --git a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.db2.create.app.sql b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.db2.create.app.sql index 98c2d17d248..133d0d15680 100644 --- a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.db2.create.app.sql +++ b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.db2.create.app.sql @@ -15,4 +15,4 @@ CREATE INDEX ACT_IDX_APP_DEF_DPLY ON ACT_APP_APPDEF(DEPLOYMENT_ID_); CREATE UNIQUE INDEX ACT_IDX_APP_DEF_UNIQ ON ACT_APP_APPDEF(KEY_, VERSION_, TENANT_ID_); insert into ACT_GE_PROPERTY -values ('app.schema.version', '7.1.0.2', 1); +values ('app.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.h2.create.app.sql b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.h2.create.app.sql index 7b6408f21e8..9665b4c2f93 100644 --- a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.h2.create.app.sql +++ b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.h2.create.app.sql @@ -15,4 +15,4 @@ CREATE INDEX ACT_IDX_APP_DEF_DPLY ON ACT_APP_APPDEF(DEPLOYMENT_ID_); CREATE UNIQUE INDEX ACT_IDX_APP_DEF_UNIQ ON ACT_APP_APPDEF(KEY_, VERSION_, TENANT_ID_); insert into ACT_GE_PROPERTY -values ('app.schema.version', '7.1.0.2', 1); +values ('app.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mssql.create.app.sql b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mssql.create.app.sql index b32d15a86fc..87cff60a132 100644 --- a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mssql.create.app.sql +++ b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mssql.create.app.sql @@ -15,4 +15,4 @@ CREATE NONCLUSTERED INDEX ACT_IDX_APP_DEF_DPLY ON ACT_APP_APPDEF(DEPLOYMENT_ID_) CREATE UNIQUE NONCLUSTERED INDEX ACT_IDX_APP_DEF_UNIQ ON ACT_APP_APPDEF(KEY_, VERSION_, TENANT_ID_); insert into ACT_GE_PROPERTY -values ('app.schema.version', '7.1.0.2', 1); +values ('app.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mysql.create.app.sql b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mysql.create.app.sql index c420343cd9f..44f7f6f98f4 100644 --- a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mysql.create.app.sql +++ b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.mysql.create.app.sql @@ -17,4 +17,4 @@ ALTER TABLE ACT_APP_DEPLOYMENT MODIFY DEPLOY_TIME_ datetime(3); CREATE UNIQUE INDEX ACT_IDX_APP_DEF_UNIQ ON ACT_APP_APPDEF(KEY_, VERSION_, TENANT_ID_); insert into ACT_GE_PROPERTY -values ('app.schema.version', '7.1.0.2', 1); +values ('app.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.oracle.create.app.sql b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.oracle.create.app.sql index c79aef2f5f9..be96fe9f768 100644 --- a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.oracle.create.app.sql +++ b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.oracle.create.app.sql @@ -15,4 +15,4 @@ CREATE INDEX ACT_IDX_APP_DEF_DPLY ON ACT_APP_APPDEF(DEPLOYMENT_ID_); CREATE UNIQUE INDEX ACT_IDX_APP_DEF_UNIQ ON ACT_APP_APPDEF(KEY_, VERSION_, TENANT_ID_); insert into ACT_GE_PROPERTY -values ('app.schema.version', '7.1.0.2', 1); +values ('app.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.postgres.create.app.sql b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.postgres.create.app.sql index 09592cc81d6..bc6ce3f70fc 100644 --- a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.postgres.create.app.sql +++ b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/create/flowable.postgres.create.app.sql @@ -15,4 +15,4 @@ CREATE INDEX ACT_IDX_APP_DEF_DPLY ON ACT_APP_APPDEF(DEPLOYMENT_ID_); CREATE UNIQUE INDEX ACT_IDX_APP_DEF_UNIQ ON ACT_APP_APPDEF(KEY_, VERSION_, TENANT_ID_); insert into ACT_GE_PROPERTY -values ('app.schema.version', '7.1.0.2', 1); +values ('app.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/upgrade/flowable.all.upgradestep.7102.to.7200.app.sql b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/upgrade/flowable.all.upgradestep.7102.to.7200.app.sql new file mode 100644 index 00000000000..f9c146eaf30 --- /dev/null +++ b/modules/flowable-app-engine/src/main/resources/org/flowable/app/db/upgrade/flowable.all.upgradestep.7102.to.7200.app.sql @@ -0,0 +1 @@ +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'app.schema.version'; diff --git a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/delegate/DelegatePlanItemInstance.java b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/delegate/DelegatePlanItemInstance.java index 2cdd4780dcd..f6c1c77914c 100644 --- a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/delegate/DelegatePlanItemInstance.java +++ b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/delegate/DelegatePlanItemInstance.java @@ -54,6 +54,8 @@ public interface DelegatePlanItemInstance extends PlanItemInstance, VariableScop void setExitTime(Date exitTime); void setEndedTime(Date endedTime); void setStartUserId(String startUserId); + void setAssignee(String assignee); + void setCompletedBy(String completedBy); void setReferenceId(String referenceId); void setReferenceType(String referenceType); void setCompletable(boolean completable); diff --git a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstance.java b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstance.java index 6cfb5719abb..1d50818f2ca 100644 --- a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstance.java +++ b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstance.java @@ -71,6 +71,10 @@ public interface HistoricPlanItemInstance { String getStartUserId(); + String getAssignee(); + + String getCompletedBy(); + String getReferenceId(); String getReferenceType(); diff --git a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstanceQuery.java b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstanceQuery.java index b4597ab1af5..c51b4c3bd11 100644 --- a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstanceQuery.java +++ b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/history/HistoricPlanItemInstanceQuery.java @@ -36,6 +36,8 @@ public interface HistoricPlanItemInstanceQuery extends Query planItemDefinitionTypes); HistoricPlanItemInstanceQuery planItemInstanceStartUserId(String startUserId); + HistoricPlanItemInstanceQuery planItemInstanceAssignee(String assignee); + HistoricPlanItemInstanceQuery planItemInstanceCompletedBy(String completedBy); HistoricPlanItemInstanceQuery planItemInstanceReferenceId(String referenceId); HistoricPlanItemInstanceQuery planItemInstanceReferenceType(String referenceType); HistoricPlanItemInstanceQuery planItemInstanceEntryCriterionId(String entryCriterionId); diff --git a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstance.java b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstance.java index 5bb33ac53fb..501e21b9c12 100644 --- a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstance.java +++ b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstance.java @@ -51,6 +51,8 @@ default Date getStartTime() { Date getExitTime(); Date getEndedTime(); String getStartUserId(); + String getAssignee(); + String getCompletedBy(); String getReferenceId(); String getReferenceType(); boolean isCompletable(); diff --git a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstanceQuery.java b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstanceQuery.java index b2595cc0737..87f521c47d4 100644 --- a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstanceQuery.java +++ b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/PlanItemInstanceQuery.java @@ -79,6 +79,8 @@ public interface PlanItemInstanceQuery extends Query findByCaseInstanceIdAndPlanItemId(String caseInstanceId, String planItemId); List findByStageInstanceIdAndPlanItemId(String stageInstanceId, String planItemId); + + PlanItemInstanceEntity updateHumanTaskPlanItemInstanceAssignee(TaskEntity taskEntity, String assignee); + + PlanItemInstanceEntity updateHumanTaskPlanItemInstanceCompletedBy(TaskEntity taskEntity, String assignee); void updatePlanItemInstancesCaseDefinitionId(String caseInstanceId, String caseDefinitionId); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityManagerImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityManagerImpl.java index 905506d395a..fa6567af28a 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityManagerImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/PlanItemInstanceEntityManagerImpl.java @@ -19,9 +19,11 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.commons.lang3.StringUtils; import org.flowable.cmmn.api.history.HistoricPlanItemInstance; import org.flowable.cmmn.api.runtime.PlanItemDefinitionType; import org.flowable.cmmn.api.runtime.PlanItemInstance; @@ -53,6 +55,7 @@ import org.flowable.job.service.impl.persistence.entity.ExternalWorkerJobEntityManager; import org.flowable.job.service.impl.persistence.entity.TimerJobEntity; import org.flowable.job.service.impl.persistence.entity.TimerJobEntityManager; +import org.flowable.task.service.impl.persistence.entity.TaskEntity; import org.flowable.variable.service.VariableService; import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntity; @@ -422,7 +425,49 @@ public List findByCaseInstanceIdAndPlanItemId(String cas public List findByStageInstanceIdAndPlanItemId(String stageInstanceId, String planItemId) { return dataManager.findByStageInstanceIdAndPlanItemId(stageInstanceId, planItemId); } - + + @Override + public PlanItemInstanceEntity updateHumanTaskPlanItemInstanceAssignee(TaskEntity taskEntity, String assignee) { + PlanItemInstanceEntity planItemInstanceEntity = null; + if (taskEntity.getScopeId() != null && taskEntity.getSubScopeId() != null) { + planItemInstanceEntity = dataManager.findById(taskEntity.getSubScopeId()); + if (planItemInstanceEntity != null) { + if (!Objects.equals(getOriginalAssignee(taskEntity), assignee)) { + planItemInstanceEntity.setAssignee(assignee); + engineConfiguration.getCmmnHistoryManager().recordPlanItemInstanceUpdated(planItemInstanceEntity); + } + } + return planItemInstanceEntity; + } + return planItemInstanceEntity; + } + + protected Object getOriginalAssignee(TaskEntity taskEntity) { + if (taskEntity.getOriginalPersistentState() != null) { + return ((Map) taskEntity.getOriginalPersistentState()).get("assignee"); + } else { + return null; + } + } + + @Override + public PlanItemInstanceEntity updateHumanTaskPlanItemInstanceCompletedBy(TaskEntity taskEntity, String completedBy) { + PlanItemInstanceEntity planItemInstanceEntity = null; + if (taskEntity.getScopeId() != null && taskEntity.getSubScopeId() != null) { + planItemInstanceEntity = dataManager.findById(taskEntity.getSubScopeId()); + if (planItemInstanceEntity != null) { + if (StringUtils.isNotEmpty(completedBy)) { + planItemInstanceEntity.setCompletedBy(completedBy); + } else { + planItemInstanceEntity.setCompletedBy(taskEntity.getAssignee()); + } + engineConfiguration.getCmmnHistoryManager().recordPlanItemInstanceUpdated(planItemInstanceEntity); + } + return planItemInstanceEntity; + } + return planItemInstanceEntity; + } + @Override public void updatePlanItemInstancesCaseDefinitionId(String caseInstanceId, String caseDefinitionId) { CommandContext commandContext = Context.getCommandContext(); diff --git a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java index fa5a994cc72..1dd80f67fd8 100644 --- a/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java +++ b/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java @@ -74,6 +74,8 @@ public class PlanItemInstanceQueryImpl extends AbstractVariableQueryImpl ( @@ -78,6 +80,8 @@ #{historicPlanItemInstance.endedTime, jdbcType=TIMESTAMP}, #{historicPlanItemInstance.lastUpdatedTime, jdbcType=TIMESTAMP}, #{historicPlanItemInstance.startUserId, jdbcType=VARCHAR}, + #{historicPlanItemInstance.assignee, jdbcType=VARCHAR}, + #{historicPlanItemInstance.completedBy, jdbcType=VARCHAR}, #{historicPlanItemInstance.referenceId, jdbcType=VARCHAR}, #{historicPlanItemInstance.referenceType, jdbcType=VARCHAR}, #{historicPlanItemInstance.entryCriterionId, jdbcType=VARCHAR}, @@ -95,7 +99,7 @@ into ${prefix}ACT_CMMN_HI_PLAN_ITEM_INST (ID_, REV_, NAME_, STATE_, CASE_DEF_ID_, DERIVED_CASE_DEF_ID_, CASE_INST_ID_, STAGE_INST_ID_, IS_STAGE_, ELEMENT_ID_, ITEM_DEFINITION_ID_, ITEM_DEFINITION_TYPE_, CREATE_TIME_, LAST_AVAILABLE_TIME_, LAST_UNAVAILABLE_TIME_, LAST_ENABLED_TIME_, LAST_DISABLED_TIME_, LAST_STARTED_TIME_, LAST_SUSPENDED_TIME_, COMPLETED_TIME_, OCCURRED_TIME_, TERMINATED_TIME_, EXIT_TIME_, ENDED_TIME_, LAST_UPDATED_TIME_, - START_USER_ID_, REFERENCE_ID_, REFERENCE_TYPE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, SHOW_IN_OVERVIEW_, EXTRA_VALUE_, TENANT_ID_) + START_USER_ID_, ASSIGNEE_, COMPLETED_BY_, REFERENCE_ID_, REFERENCE_TYPE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, SHOW_IN_OVERVIEW_, EXTRA_VALUE_, TENANT_ID_) VALUES ( #{historicPlanItemInstance.id, jdbcType=VARCHAR}, 1, #{historicPlanItemInstance.name, jdbcType=NVARCHAR}, @@ -122,6 +126,8 @@ #{historicPlanItemInstance.endedTime, jdbcType=TIMESTAMP}, #{historicPlanItemInstance.lastUpdatedTime, jdbcType=TIMESTAMP}, #{historicPlanItemInstance.startUserId, jdbcType=VARCHAR}, + #{historicPlanItemInstance.assignee, jdbcType=VARCHAR}, + #{historicPlanItemInstance.completedBy, jdbcType=VARCHAR}, #{historicPlanItemInstance.referenceId, jdbcType=VARCHAR}, #{historicPlanItemInstance.referenceType, jdbcType=VARCHAR}, #{historicPlanItemInstance.entryCriterionId, jdbcType=VARCHAR}, @@ -211,6 +217,12 @@ START_USER_ID_ = #{startUserId, jdbcType=VARCHAR}, + + ASSIGNEE_ = #{assignee, jdbcType=VARCHAR}, + + + COMPLETED_BY_ = #{completedBy, jdbcType=VARCHAR}, + REFERENCE_ID_ = #{referenceId, jdbcType=VARCHAR}, @@ -300,6 +312,8 @@ + + @@ -491,6 +505,12 @@ and RES.START_USER_ID_ = #{startUserId, jdbcType=VARCHAR} + + and RES.ASSIGNEE_ = #{assignee, jdbcType=VARCHAR} + + + and RES.COMPLETED_BY_ = #{completedBy, jdbcType=VARCHAR} + and RES.REFERENCE_ID_ = #{referenceId, jdbcType=VARCHAR} diff --git a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/PlanItemInstance.xml b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/PlanItemInstance.xml index dcaa4df27ef..f107ed23f5b 100644 --- a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/PlanItemInstance.xml +++ b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/PlanItemInstance.xml @@ -8,7 +8,7 @@ insert into ${prefix}ACT_CMMN_RU_PLAN_ITEM_INST (ID_, REV_, CASE_DEF_ID_, DERIVED_CASE_DEF_ID_, CASE_INST_ID_, STAGE_INST_ID_, IS_STAGE_, ELEMENT_ID_, ITEM_DEFINITION_ID_, ITEM_DEFINITION_TYPE_, NAME_, STATE_, CREATE_TIME_, LAST_AVAILABLE_TIME_, LAST_UNAVAILABLE_TIME_, LAST_ENABLED_TIME_, LAST_DISABLED_TIME_, LAST_STARTED_TIME_, LAST_SUSPENDED_TIME_, COMPLETED_TIME_, OCCURRED_TIME_, TERMINATED_TIME_, EXIT_TIME_, ENDED_TIME_, - START_USER_ID_, REFERENCE_ID_, REFERENCE_TYPE_, IS_COMPLETEABLE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, EXTRA_VALUE_, IS_COUNT_ENABLED_, + START_USER_ID_, ASSIGNEE_, COMPLETED_BY_, REFERENCE_ID_, REFERENCE_TYPE_, IS_COMPLETEABLE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, EXTRA_VALUE_, IS_COUNT_ENABLED_, VAR_COUNT_, SENTRY_PART_INST_COUNT_, TENANT_ID_) values ( #{id, jdbcType=VARCHAR}, @@ -35,6 +35,8 @@ #{exitTime, jdbcType=TIMESTAMP}, #{endedTime, jdbcType=TIMESTAMP}, #{startUserId, jdbcType=VARCHAR}, + #{assignee, jdbcType=VARCHAR}, + #{completedBy, jdbcType=VARCHAR}, #{referenceId, jdbcType=VARCHAR}, #{referenceType, jdbcType=VARCHAR}, #{completable, jdbcType=BOOLEAN}, @@ -52,7 +54,7 @@ insert into ${prefix}ACT_CMMN_RU_PLAN_ITEM_INST (ID_, REV_, CASE_DEF_ID_, DERIVED_CASE_DEF_ID_, CASE_INST_ID_, STAGE_INST_ID_, IS_STAGE_, ELEMENT_ID_, ITEM_DEFINITION_ID_, ITEM_DEFINITION_TYPE_, NAME_, STATE_, CREATE_TIME_, LAST_AVAILABLE_TIME_, LAST_UNAVAILABLE_TIME_, LAST_ENABLED_TIME_, LAST_DISABLED_TIME_, LAST_STARTED_TIME_, LAST_SUSPENDED_TIME_, COMPLETED_TIME_, OCCURRED_TIME_, TERMINATED_TIME_, EXIT_TIME_, - ENDED_TIME_, START_USER_ID_, REFERENCE_ID_, REFERENCE_TYPE_, IS_COMPLETEABLE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, + ENDED_TIME_, START_USER_ID_, ASSIGNEE_, COMPLETED_BY_, REFERENCE_ID_, REFERENCE_TYPE_, IS_COMPLETEABLE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, EXTRA_VALUE_, IS_COUNT_ENABLED_, VAR_COUNT_, SENTRY_PART_INST_COUNT_, TENANT_ID_) values @@ -81,6 +83,8 @@ #{planItemInstance.exitTime, jdbcType=TIMESTAMP}, #{planItemInstance.endedTime, jdbcType=TIMESTAMP}, #{planItemInstance.startUserId, jdbcType=VARCHAR}, + #{planItemInstance.assignee, jdbcType=VARCHAR}, + #{planItemInstance.completedBy, jdbcType=VARCHAR}, #{planItemInstance.referenceId, jdbcType=VARCHAR}, #{planItemInstance.referenceType, jdbcType=VARCHAR}, #{planItemInstance.completable, jdbcType=BOOLEAN}, @@ -101,7 +105,7 @@ into ${prefix}ACT_CMMN_RU_PLAN_ITEM_INST (ID_, REV_, CASE_DEF_ID_, DERIVED_CASE_DEF_ID_, CASE_INST_ID_, STAGE_INST_ID_, IS_STAGE_, ELEMENT_ID_, ITEM_DEFINITION_ID_, ITEM_DEFINITION_TYPE_, NAME_, STATE_, CREATE_TIME_, LAST_AVAILABLE_TIME_, LAST_UNAVAILABLE_TIME_, LAST_ENABLED_TIME_, LAST_DISABLED_TIME_, LAST_STARTED_TIME_, LAST_SUSPENDED_TIME_, COMPLETED_TIME_, OCCURRED_TIME_, TERMINATED_TIME_, EXIT_TIME_, ENDED_TIME_, - START_USER_ID_, REFERENCE_ID_, REFERENCE_TYPE_, IS_COMPLETEABLE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, + START_USER_ID_, ASSIGNEE_, COMPLETED_BY_, REFERENCE_ID_, REFERENCE_TYPE_, IS_COMPLETEABLE_, ENTRY_CRITERION_ID_, EXIT_CRITERION_ID_, EXTRA_VALUE_, IS_COUNT_ENABLED_, VAR_COUNT_, SENTRY_PART_INST_COUNT_, TENANT_ID_) VALUES ( #{planItemInstance.id, jdbcType=VARCHAR}, @@ -128,6 +132,8 @@ #{planItemInstance.exitTime, jdbcType=TIMESTAMP}, #{planItemInstance.endedTime, jdbcType=TIMESTAMP}, #{planItemInstance.startUserId, jdbcType=VARCHAR}, + #{planItemInstance.assignee, jdbcType=VARCHAR}, + #{planItemInstance.completedBy, jdbcType=VARCHAR}, #{planItemInstance.referenceId, jdbcType=VARCHAR}, #{planItemInstance.referenceType, jdbcType=VARCHAR}, #{planItemInstance.completable, jdbcType=BOOLEAN}, @@ -216,6 +222,12 @@ START_USER_ID_ = #{startUserId, jdbcType=VARCHAR}, + + ASSIGNEE_ = #{assignee, jdbcType=VARCHAR}, + + + COMPLETED_BY_ = #{completedBy, jdbcType=VARCHAR}, + REFERENCE_ID_ = #{referenceId, jdbcType=VARCHAR}, @@ -295,6 +307,8 @@ + + @@ -510,6 +524,12 @@ and RES.START_USER_ID_ = #{startUserId, jdbcType=VARCHAR} + + and RES.ASSIGNEE_ = #{assignee, jdbcType=VARCHAR} + + + and RES.COMPLETED_BY_ = #{completedBy, jdbcType=VARCHAR} + and RES.REFERENCE_ID_ = #{referenceId, jdbcType=VARCHAR} @@ -796,6 +816,12 @@ or RES.START_USER_ID_ = #{orQueryObject.startUserId, jdbcType=VARCHAR} + + or RES.ASSIGNEE_ = #{orQueryObject.assignee, jdbcType=VARCHAR} + + + or RES.COMPLETED_BY_ = #{orQueryObject.completedBy, jdbcType=VARCHAR} + or RES.REFERENCE_ID_ = #{orQueryObject.referenceId, jdbcType=VARCHAR} diff --git a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.db2.upgradestep.7102.to.7200.cmmn.sql b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.db2.upgradestep.7102.to.7200.cmmn.sql new file mode 100644 index 00000000000..025622d6649 --- /dev/null +++ b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.db2.upgradestep.7102.to.7200.cmmn.sql @@ -0,0 +1,7 @@ +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255); +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255); + +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255); +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'cmmn.schema.version'; \ No newline at end of file diff --git a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.h2.upgradestep.7102.to.7200.cmmn.sql b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.h2.upgradestep.7102.to.7200.cmmn.sql new file mode 100644 index 00000000000..025622d6649 --- /dev/null +++ b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.h2.upgradestep.7102.to.7200.cmmn.sql @@ -0,0 +1,7 @@ +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255); +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255); + +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255); +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'cmmn.schema.version'; \ No newline at end of file diff --git a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.cmmn.sql b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.cmmn.sql new file mode 100644 index 00000000000..8d958ba5843 --- /dev/null +++ b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.cmmn.sql @@ -0,0 +1,7 @@ +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD ASSIGNEE_ nvarchar(255); +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD COMPLETED_BY_ nvarchar(255); + +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD ASSIGNEE_ nvarchar(255); +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD COMPLETED_BY_ nvarchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'cmmn.schema.version'; \ No newline at end of file diff --git a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.cmmn.sql b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.cmmn.sql new file mode 100644 index 00000000000..f5c474add37 --- /dev/null +++ b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.cmmn.sql @@ -0,0 +1,7 @@ +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255) NULL; +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255) NULL; + +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255) NULL; +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255) NULL; + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'cmmn.schema.version'; \ No newline at end of file diff --git a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.cmmn.sql b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.cmmn.sql new file mode 100644 index 00000000000..979e775c99d --- /dev/null +++ b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.cmmn.sql @@ -0,0 +1,7 @@ +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR2(255); +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR2(255); + +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR2(255); +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR2(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'cmmn.schema.version'; \ No newline at end of file diff --git a/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.cmmn.sql b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.cmmn.sql new file mode 100644 index 00000000000..025622d6649 --- /dev/null +++ b/modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.cmmn.sql @@ -0,0 +1,7 @@ +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255); +ALTER TABLE ACT_CMMN_RU_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255); + +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD ASSIGNEE_ VARCHAR(255); +ALTER TABLE ACT_CMMN_HI_PLAN_ITEM_INST ADD COMPLETED_BY_ VARCHAR(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'cmmn.schema.version'; \ No newline at end of file diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java index 3da8972b817..4cf2445e642 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/history/HistoricPlanItemInstanceQueryTest.java @@ -162,6 +162,64 @@ public void testByStateAndType() { } } + @Test + public void testByAssignee() { + startInstances(2); + + List planItemInstances = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .list(); + assertThat(planItemInstances).hasSize(4); + + List tasks = cmmnTaskService.createTaskQuery().list(); + for (Task task : tasks) { + cmmnTaskService.setAssignee(task.getId(), "gonzo"); + } + + planItemInstances = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceAssignee("gonzo") + .list(); + assertThat(planItemInstances).hasSize(2); + + planItemInstances = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceAssignee("johnDoe") + .list(); + assertThat(planItemInstances).hasSize(0); + + } + + @Test + public void testByCompletedBy() { + startInstances(3); + + List tasks = cmmnTaskService.createTaskQuery().list(); + for (Task task : tasks) { + cmmnTaskService.setAssignee(task.getId(), "gonzo"); + cmmnTaskService.complete(task.getId(), "kermit"); + } + + List planItemInstances = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceAssignee("gonzo") + .list(); + assertThat(planItemInstances).hasSize(3); + + planItemInstances = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceCompletedBy("kermit") + .list(); + assertThat(planItemInstances).hasSize(3); + + planItemInstances = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceCompletedBy("johnDoe") + .list(); + assertThat(planItemInstances).hasSize(0); + + } + @Test public void testOrderBy() { startInstances(4); diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CmmnRuntimeServiceTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CmmnRuntimeServiceTest.java index d4464890624..724ddb0f521 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CmmnRuntimeServiceTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/CmmnRuntimeServiceTest.java @@ -339,10 +339,12 @@ public void testNestedRuntimeServiceInvocation() { @Override public void onEvent(FlowableEvent event) { - Object entity = ((FlowableEntityEvent) event).getEntity(); - if (event instanceof FlowableCaseStartedEvent) { - CaseInstanceEntity caseInstanceEntity = (CaseInstanceEntity) entity; - cmmnRuntimeService.setVariable(caseInstanceEntity.getId(), "testVariable", 123); + if (event instanceof FlowableEntityEvent) { + Object entity = ((FlowableEntityEvent) event).getEntity(); + if (event instanceof FlowableCaseStartedEvent) { + CaseInstanceEntity caseInstanceEntity = (CaseInstanceEntity) entity; + cmmnRuntimeService.setVariable(caseInstanceEntity.getId(), "testVariable", 123); + } } } diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/HumanTaskTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/HumanTaskTest.java index 6def8de0a20..84d1a742e5b 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/HumanTaskTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/HumanTaskTest.java @@ -620,4 +620,92 @@ public void testTaskNonBlockingWithEntryAndExitCriterion() { assertThat(cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).list()).hasSize(0); assertThat(cmmnRuntimeService.createCaseInstanceQuery().count()).isZero(); } + + @Test + @CmmnDeployment + public void testTaskAssigneeSyncedWithPlanItemInstance() { + CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() + .caseDefinitionKey("oneHumanTaskCase") + .variable("assigneeVar", "kermit") + .start(); + Task task = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult(); + assertThat(task.getAssignee()).isEqualTo("kermit"); + + PlanItemInstance planItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery() + .caseInstanceId(caseInstance.getId()) + .planItemInstanceStateActive() + .singleResult(); + assertThat(planItemInstance.getAssignee()).isEqualTo("kermit"); + assertThat(planItemInstance.getCompletedBy()).isNull(); + + HistoricPlanItemInstance historicPlanItemInstance = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceId(planItemInstance.getId()).singleResult(); + assertThat(historicPlanItemInstance.getAssignee()).isEqualTo("kermit"); + assertThat(historicPlanItemInstance.getCompletedBy()).isNull(); + } + + @Test + @CmmnDeployment(resources = "org/flowable/cmmn/test/runtime/HumanTaskTest.testTaskAssigneeSyncedWithPlanItemInstance.cmmn") + public void testTaskAssigneeChangeSyncedToPlanItemInstance() { + CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() + .caseDefinitionKey("oneHumanTaskCase") + .variable("assigneeVar", "kermit") + .start(); + Task task = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult(); + assertThat(task.getAssignee()).isEqualTo("kermit"); + + cmmnTaskService.setAssignee(task.getId(), "gonzo"); + + PlanItemInstance planItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery() + .caseInstanceId(caseInstance.getId()) + .planItemInstanceStateActive() + .singleResult(); + assertThat(planItemInstance.getAssignee()).isEqualTo("gonzo"); + assertThat(planItemInstance.getCompletedBy()).isNull(); + + HistoricPlanItemInstance historicPlanItemInstance = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceId(planItemInstance.getId()) + .singleResult(); + assertThat(historicPlanItemInstance.getAssignee()).isEqualTo("gonzo"); + assertThat(historicPlanItemInstance.getCompletedBy()).isNull(); + } + + @Test + @CmmnDeployment(resources = "org/flowable/cmmn/test/runtime/HumanTaskTest.testTaskAssigneeSyncedWithPlanItemInstance.cmmn") + public void testTaskCompletionSyncedToPlanItemInstance() { + CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder() + .caseDefinitionKey("oneHumanTaskCase") + .variable("assigneeVar", "kermit") + .start(); + Task task = cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult(); + + PlanItemInstance planItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery() + .caseInstanceId(caseInstance.getId()) + .planItemInstanceStateActive() + .singleResult(); + assertThat(planItemInstance.getAssignee()).isEqualTo("kermit"); + assertThat(planItemInstance.getCompletedBy()).isNull(); + + HistoricPlanItemInstance historicPlanItemInstance = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceId(planItemInstance.getId()) + .singleResult(); + assertThat(historicPlanItemInstance.getAssignee()).isEqualTo("kermit"); + assertThat(historicPlanItemInstance.getCompletedBy()).isNull(); + + cmmnTaskService.complete(task.getId(), "gonzo"); + + planItemInstance = cmmnRuntimeService.createPlanItemInstanceQuery() + .caseInstanceId(caseInstance.getId()) + .planItemInstanceStateCompleted() + .includeEnded() + .singleResult(); + assertThat(planItemInstance.getAssignee()).isEqualTo("kermit"); + assertThat(planItemInstance.getCompletedBy()).isEqualTo("gonzo"); + + historicPlanItemInstance = cmmnHistoryService.createHistoricPlanItemInstanceQuery() + .planItemInstanceId(planItemInstance.getId()) + .singleResult(); + assertThat(historicPlanItemInstance.getAssignee()).isEqualTo("kermit"); + assertThat(historicPlanItemInstance.getCompletedBy()).isEqualTo("gonzo"); + } } diff --git a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java index bda7bcb98b1..7f481e855c4 100644 --- a/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java +++ b/modules/flowable-cmmn-engine/src/test/java/org/flowable/cmmn/test/runtime/PlanItemInstanceQueryTest.java @@ -759,6 +759,66 @@ public void testLastStartedBeforeAndAfter() { } + @Test + public void testByAssignee() { + startInstances(2); + + List planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() + .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .list(); + assertThat(planItemInstances).hasSize(4); + + List tasks = cmmnTaskService.createTaskQuery().list(); + for (Task task : tasks) { + cmmnTaskService.setAssignee(task.getId(), "gonzo"); + } + + planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() + .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceAssignee("gonzo") + .list(); + assertThat(planItemInstances).hasSize(2); + + planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() + .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceAssignee("johnDoe") + .list(); + assertThat(planItemInstances).hasSize(0); + + } + + @Test + public void testByCompletedBy() { + startInstances(3); + + List tasks = cmmnTaskService.createTaskQuery().list(); + for (Task task : tasks) { + cmmnTaskService.setAssignee(task.getId(), "gonzo"); + cmmnTaskService.complete(task.getId(), "kermit"); + } + + List planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() + .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .includeEnded() + .planItemInstanceAssignee("gonzo") + .list(); + assertThat(planItemInstances).hasSize(3); + + planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() + .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .includeEnded() + .planItemInstanceCompletedBy("kermit") + .list(); + assertThat(planItemInstances).hasSize(3); + + planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery() + .planItemDefinitionType(PlanItemDefinitionType.HUMAN_TASK) + .planItemInstanceCompletedBy("johnDoe") + .list(); + assertThat(planItemInstances).hasSize(0); + + } + @Test public void testCompletedBeforeAndAfter() { startInstances(5); diff --git a/modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/runtime/HumanTaskTest.testTaskAssigneeSyncedWithPlanItemInstance.cmmn b/modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/runtime/HumanTaskTest.testTaskAssigneeSyncedWithPlanItemInstance.cmmn new file mode 100644 index 00000000000..c5bb5a05640 --- /dev/null +++ b/modules/flowable-cmmn-engine/src/test/resources/org/flowable/cmmn/test/runtime/HumanTaskTest.testTaskAssigneeSyncedWithPlanItemInstance.cmmn @@ -0,0 +1,28 @@ + + + + + + + + + + + + complete + + + + + + + + + + diff --git a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java index 035425b3dba..e809d6c3b84 100644 --- a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java +++ b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/CmmnRestResponseFactory.java @@ -567,6 +567,8 @@ public PlanItemInstanceResponse createPlanItemInstanceResponse(PlanItemInstance result.setExitTime(planItemInstance.getExitTime()); result.setEndedTime(planItemInstance.getEndedTime()); result.setStartUserId(planItemInstance.getStartUserId()); + result.setAssignee(planItemInstance.getAssignee()); + result.setCompletedBy(planItemInstance.getCompletedBy()); result.setStage(planItemInstance.isStage()); result.setCompletable(planItemInstance.isCompletable()); result.setEntryCriterionId(planItemInstance.getEntryCriterionId()); @@ -909,6 +911,8 @@ public HistoricPlanItemInstanceResponse createHistoricPlanItemInstanceResponse(H result.setEndedTime(historicPlanItemInstance.getEndedTime()); result.setLastUpdatedTime(historicPlanItemInstance.getLastUpdatedTime()); result.setStartUserId(historicPlanItemInstance.getStartUserId()); + result.setAssignee(historicPlanItemInstance.getAssignee()); + result.setCompletedBy(historicPlanItemInstance.getCompletedBy()); result.setReferenceId(historicPlanItemInstance.getReferenceId()); result.setReferenceType(historicPlanItemInstance.getReferenceType()); result.setEntryCriterionId(historicPlanItemInstance.getEntryCriterionId()); diff --git a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/planitem/HistoricPlanItemInstanceResponse.java b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/planitem/HistoricPlanItemInstanceResponse.java index ff99b711650..45dbb62b5ce 100644 --- a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/planitem/HistoricPlanItemInstanceResponse.java +++ b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/planitem/HistoricPlanItemInstanceResponse.java @@ -66,6 +66,8 @@ public class HistoricPlanItemInstanceResponse { @JsonSerialize(using = DateToStringSerializer.class, as = Date.class) protected Date lastUpdatedTime; protected String startUserId; + protected String assignee; + protected String completedBy; protected String referenceId; protected String referenceType; protected String entryCriterionId; @@ -295,6 +297,22 @@ public void setStartUserId(String startUserId) { this.startUserId = startUserId; } + public String getAssignee() { + return assignee; + } + + public void setAssignee(String assignee) { + this.assignee = assignee; + } + + public String getCompletedBy() { + return completedBy; + } + + public void setCompletedBy(String completedBy) { + this.completedBy = completedBy; + } + @ApiModelProperty(example = "referenceId") public String getReferenceId() { return referenceId; diff --git a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/planitem/PlanItemInstanceResponse.java b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/planitem/PlanItemInstanceResponse.java index 276fda56aa3..4b44bf65548 100644 --- a/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/planitem/PlanItemInstanceResponse.java +++ b/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/planitem/PlanItemInstanceResponse.java @@ -69,6 +69,8 @@ public class PlanItemInstanceResponse { @JsonSerialize(using = DateToStringSerializer.class, as = Date.class) protected Date endedTime; protected String startUserId; + protected String assignee; + protected String completedBy; protected String referenceId; protected String referenceType; protected boolean completable; @@ -354,6 +356,22 @@ public void setFormKey(String formKey) { this.formKey = formKey; } + public String getAssignee() { + return assignee; + } + + public void setAssignee(String assignee) { + this.assignee = assignee; + } + + public String getCompletedBy() { + return completedBy; + } + + public void setCompletedBy(String completedBy) { + this.completedBy = completedBy; + } + public String getExtraValue() { return extraValue; } diff --git a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/PlanItemInstanceResourceTest.java b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/PlanItemInstanceResourceTest.java index 397115b8033..35744340b5e 100644 --- a/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/PlanItemInstanceResourceTest.java +++ b/modules/flowable-cmmn-rest/src/test/java/org/flowable/cmmn/rest/service/api/runtime/PlanItemInstanceResourceTest.java @@ -90,6 +90,8 @@ public void testGetPlanItemInstance() throws Exception { + " exitTime: null," + " endedTime: null," + " startUserId: null," + + " assignee: 'johnDoe'," + + " completedBy: null," + " referenceId: '${json-unit.any-string}'," + " referenceType: 'cmmn-1.1-to-cmmn-1.1-child-human-task'," + " completable: false," @@ -102,6 +104,167 @@ public void testGetPlanItemInstance() throws Exception { + "}"); } + /** + * Test getting a single plan item instance. + */ + @CmmnDeployment(resources = { "org/flowable/cmmn/rest/service/api/repository/oneHumanTaskCase.cmmn" }) + public void testChangeAssignee() throws Exception { + CaseInstance caseInstance = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("oneHumanTaskCase").businessKey("myBusinessKey").start(); + + List planItems = runtimeService.createPlanItemInstanceQuery().caseInstanceId(caseInstance.getId()).list(); + assertThat(planItems).hasSize(1); + PlanItemInstance planItem = planItems.get(0); + + String url = buildUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE, planItem.getId()); + CloseableHttpResponse response = executeRequest(new HttpGet(url), HttpStatus.SC_OK); + + // Check resulting instance + JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); + closeResponse(response); + assertThat(responseNode).isNotNull(); + assertThatJson(responseNode) + .isEqualTo("{" + + " id: '" + planItem.getId() + "'," + + " url: '" + buildUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE, planItem.getId()) + "'," + + " name: 'The Task'," + + " caseInstanceId: '" + caseInstance.getId() + "'," + + " caseInstanceUrl: '" + buildUrl(CmmnRestUrls.URL_CASE_INSTANCE, planItem.getCaseInstanceId()) + "'," + + " caseDefinitionId: '" + caseInstance.getCaseDefinitionId() + "'," + + " caseDefinitionUrl: '" + buildUrl(CmmnRestUrls.URL_CASE_DEFINITION, planItem.getCaseDefinitionId()) + "'," + + " derivedCaseDefinitionId: null," + + " derivedCaseDefinitionUrl: null," + + " stageInstanceId: null," + + " stageInstanceUrl: null," + + " planItemDefinitionId: 'theTask'," + + " planItemDefinitionType: 'humantask'," + + " state: 'active'," + + " stage: false," + + " elementId: 'planItem1'," + + " createTime: '${json-unit.any-string}'," + + " lastAvailableTime: '${json-unit.any-string}'," + + " lastEnabledTime: null," + + " lastDisabledTime: null," + + " lastStartedTime: '${json-unit.any-string}'," + + " lastSuspendedTime: null," + + " completedTime: null," + + " occurredTime: null," + + " terminatedTime: null," + + " exitTime: null," + + " endedTime: null," + + " startUserId: null," + + " assignee: 'johnDoe'," + + " completedBy: null," + + " referenceId: '${json-unit.any-string}'," + + " referenceType: 'cmmn-1.1-to-cmmn-1.1-child-human-task'," + + " completable: false," + + " entryCriterionId: null," + + " exitCriterionId: null," + + " formKey: null," + + " extraValue: null," + + " tenantId: ''," + + " localVariables :[]" + + "}"); + + String taskId = taskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult().getId(); + taskService.setAssignee(taskId, "gonzo"); + + response = executeRequest(new HttpGet(url), HttpStatus.SC_OK); + responseNode = objectMapper.readTree(response.getEntity().getContent()); + closeResponse(response); + assertThatJson(responseNode) + .isEqualTo("{" + + " id: '" + planItem.getId() + "'," + + " url: '" + buildUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE, planItem.getId()) + "'," + + " name: 'The Task'," + + " caseInstanceId: '" + caseInstance.getId() + "'," + + " caseInstanceUrl: '" + buildUrl(CmmnRestUrls.URL_CASE_INSTANCE, planItem.getCaseInstanceId()) + "'," + + " caseDefinitionId: '" + caseInstance.getCaseDefinitionId() + "'," + + " caseDefinitionUrl: '" + buildUrl(CmmnRestUrls.URL_CASE_DEFINITION, planItem.getCaseDefinitionId()) + "'," + + " derivedCaseDefinitionId: null," + + " derivedCaseDefinitionUrl: null," + + " stageInstanceId: null," + + " stageInstanceUrl: null," + + " planItemDefinitionId: 'theTask'," + + " planItemDefinitionType: 'humantask'," + + " state: 'active'," + + " stage: false," + + " elementId: 'planItem1'," + + " createTime: '${json-unit.any-string}'," + + " lastAvailableTime: '${json-unit.any-string}'," + + " lastEnabledTime: null," + + " lastDisabledTime: null," + + " lastStartedTime: '${json-unit.any-string}'," + + " lastSuspendedTime: null," + + " completedTime: null," + + " occurredTime: null," + + " terminatedTime: null," + + " exitTime: null," + + " endedTime: null," + + " startUserId: null," + + " assignee: 'gonzo'," + + " completedBy: null," + + " referenceId: '${json-unit.any-string}'," + + " referenceType: 'cmmn-1.1-to-cmmn-1.1-child-human-task'," + + " completable: false," + + " entryCriterionId: null," + + " exitCriterionId: null," + + " formKey: null," + + " extraValue: null," + + " tenantId: ''," + + " localVariables :[]" + + "}"); + + taskService.complete(taskId, "kermit"); + + url = buildUrl(CmmnRestUrls.URL_HISTORIC_PLANITEM_INSTANCE, planItem.getId()); // note the change to the historic plan item call, as the plan item instance has been completed + response = executeRequest(new HttpGet(url), HttpStatus.SC_OK); + responseNode = objectMapper.readTree(response.getEntity().getContent()); + closeResponse(response); + assertThatJson(responseNode) + .isEqualTo("{" + + " id: '" + planItem.getId() + "'," + + " url: '" + buildUrl(CmmnRestUrls.URL_HISTORIC_PLANITEM_INSTANCE, planItem.getId()) + "'," + + " name: 'The Task'," + + " caseInstanceId: '" + caseInstance.getId() + "'," + + " caseInstanceUrl: '" + buildUrl(CmmnRestUrls.URL_HISTORIC_CASE_INSTANCE, planItem.getCaseInstanceId()) + "'," + + " caseDefinitionId: '" + caseInstance.getCaseDefinitionId() + "'," + + " caseDefinitionUrl: '" + buildUrl(CmmnRestUrls.URL_CASE_DEFINITION, planItem.getCaseDefinitionId()) + "'," + + " derivedCaseDefinitionId: null," + + " derivedCaseDefinitionUrl: null," + + " stageInstanceId: null," + + " stageInstanceUrl: null," + + " planItemDefinitionId: 'theTask'," + + " planItemDefinitionType: 'humantask'," + + " state: 'completed'," // due to completion + + " stage: false," + + " elementId: 'planItem1'," + + " createTime: '${json-unit.any-string}'," + + " lastAvailableTime: '${json-unit.any-string}'," + + " lastEnabledTime: null," + + " lastDisabledTime: null," + + " lastStartedTime: '${json-unit.any-string}'," + + " lastSuspendedTime: null," + + " completedTime: '${json-unit.any-string}'," // this is set now, as it's completed + + " occurredTime: null," + + " terminatedTime: null," + + " exitTime: null," + + " endedTime: '${json-unit.any-string}'," // this is set now, as it's completed + + " lastUpdatedTime: '${json-unit.any-string}'," + + " showInOverview: false," + + " startUserId: null," + + " assignee: 'gonzo'," + + " completedBy: 'kermit'," + + " referenceId: '${json-unit.any-string}'," + + " referenceType: 'cmmn-1.1-to-cmmn-1.1-child-human-task'," + + " entryCriterionId: null," + + " exitCriterionId: null," + + " formKey: null," + + " extraValue: null," + + " tenantId: ''," + + " localVariables :[]" + + "}"); + } + /** * Test getting an unexisting plan item instance. */ diff --git a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.db2.create.dmn.sql b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.db2.create.dmn.sql index 1c870e12eb4..56e89cc91a2 100644 --- a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.db2.create.dmn.sql +++ b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.db2.create.dmn.sql @@ -31,4 +31,4 @@ CALL SYSPROC.ADMIN_CMD ('REORG TABLE ACT_DMN_DECISION'); CREATE INDEX ACT_IDX_DMN_INSTANCE_ID ON ACT_DMN_HI_DECISION_EXECUTION(INSTANCE_ID_); insert into ACT_GE_PROPERTY -values ('dmn.schema.version', '7.1.0.2', 1); +values ('dmn.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.h2.create.dmn.sql b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.h2.create.dmn.sql index 76d43404447..290e6d146ed 100644 --- a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.h2.create.dmn.sql +++ b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.h2.create.dmn.sql @@ -15,4 +15,4 @@ ALTER TABLE ACT_DMN_DECISION ADD DECISION_TYPE_ VARCHAR(255); CREATE INDEX ACT_IDX_DMN_INSTANCE_ID ON ACT_DMN_HI_DECISION_EXECUTION(INSTANCE_ID_); insert into ACT_GE_PROPERTY -values ('dmn.schema.version', '7.1.0.2', 1); +values ('dmn.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mssql.create.dmn.sql b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mssql.create.dmn.sql index 0049e360b3b..e0c334b134c 100644 --- a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mssql.create.dmn.sql +++ b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mssql.create.dmn.sql @@ -39,4 +39,4 @@ ALTER TABLE ACT_DMN_DECISION ALTER COLUMN RESOURCE_NAME_ nvarchar(255); ALTER TABLE ACT_DMN_DECISION ALTER COLUMN DESCRIPTION_ nvarchar(255); insert into ACT_GE_PROPERTY -values ('dmn.schema.version', '7.1.0.2', 1); +values ('dmn.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mysql.create.dmn.sql b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mysql.create.dmn.sql index 32a98be9585..02134a455b6 100644 --- a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mysql.create.dmn.sql +++ b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.mysql.create.dmn.sql @@ -15,4 +15,4 @@ ALTER TABLE ACT_DMN_DECISION ADD DECISION_TYPE_ VARCHAR(255) NULL; CREATE INDEX ACT_IDX_DMN_INSTANCE_ID ON ACT_DMN_HI_DECISION_EXECUTION(INSTANCE_ID_); insert into ACT_GE_PROPERTY -values ('dmn.schema.version', '7.1.0.2', 1); +values ('dmn.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.oracle.create.dmn.sql b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.oracle.create.dmn.sql index 1691e3faa7c..5da477c3f40 100644 --- a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.oracle.create.dmn.sql +++ b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.oracle.create.dmn.sql @@ -23,4 +23,4 @@ ALTER TABLE ACT_DMN_DECISION ADD DECISION_TYPE_ VARCHAR2(255); CREATE INDEX ACT_IDX_DMN_INSTANCE_ID ON ACT_DMN_HI_DECISION_EXECUTION(INSTANCE_ID_); insert into ACT_GE_PROPERTY -values ('dmn.schema.version', '7.1.0.2', 1); +values ('dmn.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.postgres.create.dmn.sql b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.postgres.create.dmn.sql index bb9f7c49520..b7f3e89fd6e 100644 --- a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.postgres.create.dmn.sql +++ b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/create/flowable.postgres.create.dmn.sql @@ -15,4 +15,4 @@ ALTER TABLE ACT_DMN_DECISION ADD DECISION_TYPE_ VARCHAR(255); CREATE INDEX ACT_IDX_DMN_INSTANCE_ID ON ACT_DMN_HI_DECISION_EXECUTION(INSTANCE_ID_); insert into ACT_GE_PROPERTY -values ('dmn.schema.version', '7.1.0.2', 1); +values ('dmn.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/upgrade/flowable.all.upgradestep.7102.to.7200.dmn.sql b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/upgrade/flowable.all.upgradestep.7102.to.7200.dmn.sql new file mode 100644 index 00000000000..7734b1b6909 --- /dev/null +++ b/modules/flowable-dmn-engine/src/main/resources/org/flowable/dmn/db/upgrade/flowable.all.upgradestep.7102.to.7200.dmn.sql @@ -0,0 +1 @@ +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'dmn.schema.version'; diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/FlowableVersions.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/FlowableVersions.java index 5c0449c508c..a70512fe09b 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/FlowableVersions.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/FlowableVersions.java @@ -23,7 +23,7 @@ */ public class FlowableVersions { - public static final String CURRENT_VERSION = "7.1.0.2"; // Note the extra .x at the end. To cater for snapshot releases with different database changes + public static final String CURRENT_VERSION = "7.2.0.0"; // Note the extra .x at the end. To cater for snapshot releases with different database changes public static final List FLOWABLE_VERSIONS = new ArrayList<>(); @@ -145,6 +145,7 @@ public class FlowableVersions { FLOWABLE_VERSIONS.add(new FlowableVersion("7.0.1.1")); FLOWABLE_VERSIONS.add(new FlowableVersion("7.1.0.0")); FLOWABLE_VERSIONS.add(new FlowableVersion("7.1.0.1")); + FLOWABLE_VERSIONS.add(new FlowableVersion("7.1.0.1")); /* Current */ FLOWABLE_VERSIONS.add(new FlowableVersion(CURRENT_VERSION)); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.cockroachdb.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.cockroachdb.create.common.sql index 65b85e90a4b..bc81523996b 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.cockroachdb.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.cockroachdb.create.common.sql @@ -16,7 +16,7 @@ CREATE TABLE if not exists ACT_GE_BYTEARRAY ( ); insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.db2.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.db2.create.common.sql index da9c54b5d1b..142f320c469 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.db2.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.db2.create.common.sql @@ -16,7 +16,7 @@ create table ACT_GE_BYTEARRAY ( ); insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.h2.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.h2.create.common.sql index 9dd0eaa98ff..4d941b9d7f4 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.h2.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.h2.create.common.sql @@ -16,7 +16,7 @@ create table ACT_GE_BYTEARRAY ( ); insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.hsql.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.hsql.create.common.sql index 9dd0eaa98ff..4d941b9d7f4 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.hsql.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.hsql.create.common.sql @@ -16,7 +16,7 @@ create table ACT_GE_BYTEARRAY ( ); insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mssql.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mssql.create.common.sql index c4539afe0df..217b9bd31c4 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mssql.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mssql.create.common.sql @@ -16,7 +16,7 @@ create table ACT_GE_BYTEARRAY ( ); insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mysql.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mysql.create.common.sql index 7dc77885fcf..3da3fa4f1bc 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mysql.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.mysql.create.common.sql @@ -16,7 +16,7 @@ create table ACT_GE_BYTEARRAY ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.oracle.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.oracle.create.common.sql index 917888e0b5a..f59c48a267b 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.oracle.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.oracle.create.common.sql @@ -16,7 +16,7 @@ create table ACT_GE_BYTEARRAY ( ); insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.postgres.create.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.postgres.create.common.sql index 487656e5443..ef3a66b3967 100644 --- a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.postgres.create.common.sql +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/create/flowable.postgres.create.common.sql @@ -16,7 +16,7 @@ create table ACT_GE_BYTEARRAY ( ); insert into ACT_GE_PROPERTY -values ('common.schema.version', '7.1.0.2', 1); +values ('common.schema.version', '7.2.0.0', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); diff --git a/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/upgrade/flowable.all.upgradestep.7102.to.7200.common.sql b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/upgrade/flowable.all.upgradestep.7102.to.7200.common.sql new file mode 100644 index 00000000000..1063b33de36 --- /dev/null +++ b/modules/flowable-engine-common/src/main/resources/org/flowable/common/db/upgrade/flowable.all.upgradestep.7102.to.7200.common.sql @@ -0,0 +1 @@ +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'common.schema.version'; \ No newline at end of file diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstance.java b/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstance.java index d8b528c70b9..fa046d6016c 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstance.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstance.java @@ -56,6 +56,9 @@ public interface HistoricActivityInstance extends HistoricData { /** Assignee in case of user task activity */ String getAssignee(); + /** User id of the user completing the user task in case of a user task activity */ + String getCompletedBy(); + /** Time when the activity instance started */ Date getStartTime(); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstanceQuery.java b/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstanceQuery.java index e2e84c00ba2..f4adc0b71b8 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstanceQuery.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/history/HistoricActivityInstanceQuery.java @@ -70,6 +70,11 @@ public interface HistoricActivityInstanceQuery extends Query activityTypes; protected String assignee; + protected String completedBy; protected String tenantId; protected String tenantIdLike; protected boolean withoutTenantId; @@ -145,6 +146,12 @@ public HistoricActivityInstanceQueryImpl taskAssignee(String assignee) { return this; } + @Override + public HistoricActivityInstanceQuery taskCompletedBy(String userId) { + this.completedBy = userId; + return this; + } + @Override public HistoricActivityInstanceQueryImpl finished() { this.finished = true; @@ -338,6 +345,10 @@ public String getAssignee() { return assignee; } + public String getCompletedBy() { + return completedBy; + } + public boolean isFinished() { return finished; } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/history/DefaultHistoryManager.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/history/DefaultHistoryManager.java index 02f531d5e32..4eadacd9dd2 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/history/DefaultHistoryManager.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/history/DefaultHistoryManager.java @@ -505,6 +505,7 @@ public void updateHistoricActivityInstance(ActivityInstance activityInstance) { if (historicActivityInstance != null) { historicActivityInstance.setTaskId(activityInstance.getTaskId()); historicActivityInstance.setAssignee(activityInstance.getAssignee()); + historicActivityInstance.setCompletedBy(activityInstance.getCompletedBy()); historicActivityInstance.setCalledProcessInstanceId(activityInstance.getCalledProcessInstanceId()); } } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntity.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntity.java index 2eca1f0161a..243e840ad5d 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntity.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntity.java @@ -69,6 +69,8 @@ public interface ActivityInstanceEntity extends ActivityInstance, Entity, HasRev void setAssignee(String assignee); + void setCompletedBy(String completedBy); + void setTaskId(String taskId); void setCalledProcessInstanceId(String calledProcessInstanceId); diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java index 8ecea4e7b3b..267f58fad90 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityImpl.java @@ -43,6 +43,7 @@ public class ActivityInstanceEntityImpl extends AbstractBpmnEngineEntity impleme protected String activityType; protected String executionId; protected String assignee; + protected String completedBy; protected String taskId; protected String calledProcessInstanceId; protected String tenantId = ProcessEngineConfiguration.NO_TENANT_ID; @@ -61,6 +62,7 @@ public Object getPersistentState() { persistentState.put("executionId", executionId); persistentState.put("taskId", taskId); persistentState.put("assignee", assignee); + persistentState.put("completedBy", completedBy); persistentState.put("calledProcessInstanceId", calledProcessInstanceId); persistentState.put("activityId", activityId); persistentState.put("activityName", activityName); @@ -200,6 +202,16 @@ public void setAssignee(String assignee) { this.assignee = assignee; } + @Override + public String getCompletedBy() { + return completedBy; + } + + @Override + public void setCompletedBy(String completedBy) { + this.completedBy = completedBy; + } + @Override public String getTaskId() { return taskId; diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityManager.java b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityManager.java index 7721d116238..61d5b158993 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityManager.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ActivityInstanceEntityManager.java @@ -76,6 +76,15 @@ public interface ActivityInstanceEntityManager extends EntityManager ASSIGNEE_ = #{assignee, jdbcType=NVARCHAR}, + + COMPLETED_BY_ = #{completedBy, jdbcType=NVARCHAR}, + END_TIME_ = #{endTime, jdbcType=TIMESTAMP}, @@ -220,6 +229,7 @@ + @@ -273,6 +283,9 @@ and RES.ASSIGNEE_ = #{assignee, jdbcType=NVARCHAR} + + + and RES.COMPLETED_BY_ = #{completedBy, jdbcType=NVARCHAR} and RES.TENANT_ID_ = #{tenantId, jdbcType=NVARCHAR} diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/mapping/entity/HistoricActivityInstance.xml b/modules/flowable-engine/src/main/resources/org/flowable/db/mapping/entity/HistoricActivityInstance.xml index 673e986342d..8879202d300 100644 --- a/modules/flowable-engine/src/main/resources/org/flowable/db/mapping/entity/HistoricActivityInstance.xml +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/mapping/entity/HistoricActivityInstance.xml @@ -33,6 +33,7 @@ ACT_NAME_, ACT_TYPE_, ASSIGNEE_, + COMPLETED_BY_, START_TIME_, END_TIME_, TRANSACTION_ORDER_, @@ -50,6 +51,7 @@ #{activityName, jdbcType=NVARCHAR}, #{activityType, jdbcType=NVARCHAR}, #{assignee, jdbcType=NVARCHAR}, + #{completedBy, jdbcType=NVARCHAR}, #{startTime, jdbcType=TIMESTAMP}, #{endTime, jdbcType=TIMESTAMP}, #{transactionOrder, jdbcType=INTEGER}, @@ -72,6 +74,7 @@ ACT_NAME_, ACT_TYPE_, ASSIGNEE_, + COMPLETED_BY_, START_TIME_, END_TIME_, TRANSACTION_ORDER_, @@ -90,6 +93,7 @@ #{historicActivityInstance.activityName, jdbcType=NVARCHAR}, #{historicActivityInstance.activityType, jdbcType=NVARCHAR}, #{historicActivityInstance.assignee, jdbcType=NVARCHAR}, + #{historicActivityInstance.completedBy, jdbcType=NVARCHAR}, #{historicActivityInstance.startTime, jdbcType=TIMESTAMP}, #{historicActivityInstance.endTime, jdbcType=TIMESTAMP}, #{historicActivityInstance.transactionOrder, jdbcType=INTEGER}, @@ -114,6 +118,7 @@ ACT_NAME_, ACT_TYPE_, ASSIGNEE_, + COMPLETED_BY_, START_TIME_, END_TIME_, TRANSACTION_ORDER_, @@ -131,6 +136,7 @@ #{historicActivityInstance.activityName, jdbcType=NVARCHAR}, #{historicActivityInstance.activityType, jdbcType=NVARCHAR}, #{historicActivityInstance.assignee, jdbcType=NVARCHAR}, + #{historicActivityInstance.completedBy, jdbcType=NVARCHAR}, #{historicActivityInstance.startTime, jdbcType=TIMESTAMP}, #{historicActivityInstance.endTime, jdbcType=TIMESTAMP}, #{historicActivityInstance.transactionOrder, jdbcType=INTEGER}, @@ -159,6 +165,9 @@ ASSIGNEE_ = #{assignee, jdbcType=NVARCHAR}, + + COMPLETED_BY_ = #{completedBy, jdbcType=NVARCHAR}, + END_TIME_ = #{endTime, jdbcType=TIMESTAMP}, @@ -216,6 +225,7 @@ + @@ -338,6 +348,9 @@ and ${queryTablePrefix}ASSIGNEE_ = #{assignee, jdbcType=NVARCHAR} + + + and ${queryTablePrefix}COMPLETED_BY_ = #{completedBy, jdbcType=NVARCHAR} and ${queryTablePrefix}TENANT_ID_ = #{tenantId, jdbcType=NVARCHAR} diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.cockroachdb.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.cockroachdb.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..bab936af282 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.cockroachdb.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add column COMPLETED_BY_ varchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.cockroachdb.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.cockroachdb.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..08c319bbf77 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.cockroachdb.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add column COMPLETED_BY_ varchar(255); \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.db2.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.db2.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..bab936af282 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.db2.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add column COMPLETED_BY_ varchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.db2.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.db2.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..08c319bbf77 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.db2.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add column COMPLETED_BY_ varchar(255); \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.h2.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.h2.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..3e85e331185 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.h2.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add column COMPLETED_BY_ varchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.h2.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.h2.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..2970fee6002 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.h2.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add column COMPLETED_BY_ varchar(255); diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.hsql.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.hsql.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..3e85e331185 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.hsql.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add column COMPLETED_BY_ varchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.hsql.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.hsql.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..2970fee6002 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.hsql.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add column COMPLETED_BY_ varchar(255); diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..2738fa4f571 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add COMPLETED_BY_ nvarchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..2f0297fee7c --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mssql.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add COMPLETED_BY_ nvarchar(255); \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..3e85e331185 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add column COMPLETED_BY_ varchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..2970fee6002 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.mysql.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add column COMPLETED_BY_ varchar(255); diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..a6979c281b2 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add COMPLETED_BY_ NVARCHAR2(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..3f27e8bb41a --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.oracle.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add COMPLETED_BY_ NVARCHAR2(255); \ No newline at end of file diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.engine.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.engine.sql new file mode 100644 index 00000000000..bab936af282 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.engine.sql @@ -0,0 +1,3 @@ +alter table ACT_RU_ACTINST add column COMPLETED_BY_ varchar(255); + +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; diff --git a/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.history.sql b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.history.sql new file mode 100644 index 00000000000..2970fee6002 --- /dev/null +++ b/modules/flowable-engine/src/main/resources/org/flowable/db/upgrade/flowable.postgres.upgradestep.7102.to.7200.history.sql @@ -0,0 +1 @@ +alter table ACT_HI_ACTINST add column COMPLETED_BY_ varchar(255); diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/RuntimeActivityInstanceTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/RuntimeActivityInstanceTest.java index 3cbe6954720..0137db988a2 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/RuntimeActivityInstanceTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/api/runtime/RuntimeActivityInstanceTest.java @@ -20,6 +20,7 @@ import org.flowable.common.engine.api.FlowableIllegalArgumentException; import org.flowable.common.engine.impl.history.HistoryLevel; +import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.common.engine.impl.util.CollectionUtil; import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricProcessInstance; @@ -37,6 +38,7 @@ /** * @author martin.grofcik + * @author Joram Barrez */ public class RuntimeActivityInstanceTest extends PluggableFlowableTestCase { @@ -178,6 +180,7 @@ public void testActivityInstanceQuery() { assertThat(runtimeService.createActivityInstanceQuery().activityName("No operation").list()).hasSize(1); assertThat(runtimeService.createActivityInstanceQuery().taskAssignee("nonExistingAssignee").list()).isEmpty(); + assertThat(runtimeService.createActivityInstanceQuery().taskCompletedBy("nonExistingUserId").list()).isEmpty(); assertThat(runtimeService.createActivityInstanceQuery().executionId("nonExistingExecutionId").list()).isEmpty(); @@ -229,7 +232,7 @@ protected void assertThatActivityInstancesAreSame(String userTask) { @Test @Deployment(resources = "org/flowable/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceProperties.bpmn20.xml") - public void testActivityInstanceProperties() { + public void testActivityInstanceAssignee() { // Start process instance runtimeService.startProcessInstanceByKey("taskAssigneeProcess"); @@ -239,6 +242,103 @@ public void testActivityInstanceProperties() { org.flowable.task.api.Task task = taskService.createTaskQuery().singleResult(); assertThat(activityInstance.getTaskId()).isEqualTo(task.getId()); assertThat(activityInstance.getAssignee()).isEqualTo("kermit"); + assertThat(activityInstance.getCompletedBy()).isEqualTo(null); + + if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { + HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("theTask").singleResult(); + assertActivityInstancesAreSame(historicActivityInstance, activityInstance); + } + } + + @Test + @Deployment(resources = "org/flowable/engine/test/api/twoTasksProcess.bpmn20.xml") + public void testAssigneeChange() { + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoTasksProcess"); + org.flowable.task.api.Task task = taskService.createTaskQuery().singleResult(); + + taskService.claim(task.getId(), "kermit"); + assertThat(taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult().getAssignee()).isEqualTo("kermit"); + + taskService.setAssignee(task.getId(), "gonzo"); + assertThat(taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult().getAssignee()).isEqualTo("gonzo"); + + ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() + .processInstanceId(processInstance.getId()) + .activityId("firstTask") + .singleResult(); + assertThat(activityInstance.getAssignee()).isEqualTo("gonzo"); + + assertThat(runtimeService.createActivityInstanceQuery().activityId("firstTask").taskAssignee("gonzo").count()).isOne(); + + + if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { + HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery() + .processInstanceId(processInstance.getId()) + .activityId("firstTask") + .singleResult(); + assertActivityInstancesAreSame(historicActivityInstance, activityInstance); + + assertThat(historyService.createHistoricActivityInstanceQuery().activityId("firstTask").taskAssignee("gonzo").count()).isOne(); + } + } + + @Test + @Deployment(resources = "org/flowable/engine/test/api/twoTasksProcess.bpmn20.xml") + public void testCompletedBy() { + runtimeService.startProcessInstanceByKey("twoTasksProcess"); + org.flowable.task.api.Task task = taskService.createTaskQuery().singleResult(); + taskService.claim(task.getId(), "kermit"); + taskService.complete(task.getId()); + + ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery().activityId("firstTask").singleResult(); + + assertThat(activityInstance.getTaskId()).isEqualTo(task.getId()); + assertThat(activityInstance.getAssignee()).isEqualTo("kermit"); + assertThat(activityInstance.getCompletedBy()).isEqualTo("kermit"); + + assertThat(runtimeService.createActivityInstanceQuery().activityId("firstTask").taskAssignee("kermit").count()).isOne(); + assertThat(runtimeService.createActivityInstanceQuery().activityId("firstTask").taskCompletedBy("kermit").count()).isOne(); + assertThat(runtimeService.createActivityInstanceQuery().activityId("firstTask").taskAssignee("kermit").taskCompletedBy("kermit").count()).isOne(); + + if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { + HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("firstTask").singleResult(); + assertActivityInstancesAreSame(historicActivityInstance, activityInstance); + + assertThat(historyService.createHistoricActivityInstanceQuery().activityId("firstTask").taskAssignee("kermit").count()).isOne(); + assertThat(historyService.createHistoricActivityInstanceQuery().activityId("firstTask").taskCompletedBy("kermit").count()).isOne(); + } + + // Option 2: completer is different from assignee + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoTasksProcess"); + task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); + taskService.claim(task.getId(), "kermit"); + + Authentication.setAuthenticatedUserId("gonzo"); + taskService.complete(task.getId(), "gonzo"); + Authentication.setAuthenticatedUserId(null); + + activityInstance = runtimeService.createActivityInstanceQuery() + .processInstanceId(processInstance.getId()) + .activityId("firstTask").singleResult(); + + assertThat(activityInstance.getTaskId()).isEqualTo(task.getId()); + assertThat(activityInstance.getAssignee()).isEqualTo("kermit"); + assertThat(activityInstance.getCompletedBy()).isEqualTo("gonzo"); + + assertThat(runtimeService.createActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("firstTask").taskAssignee("kermit").count()).isOne(); + assertThat(runtimeService.createActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("firstTask").taskCompletedBy("gonzo").count()).isOne(); + assertThat(runtimeService.createActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("firstTask").taskAssignee("kermit").taskCompletedBy("gonzo").count()).isOne(); + + if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) { + HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery() + .processInstanceId(processInstance.getId()).activityId("firstTask").singleResult(); + assertActivityInstancesAreSame(historicActivityInstance, activityInstance); + + assertThat(historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("firstTask").taskAssignee("kermit").count()).isOne(); + assertThat(historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("firstTask").taskCompletedBy("gonzo").count()).isOne(); + assertThat(historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).activityId("firstTask").taskAssignee("kermit").taskCompletedBy("gonzo").count()).isOne(); + + } } @Test diff --git a/modules/flowable-engine/src/test/java/org/flowable/engine/test/cfg/executioncount/VerifyDatabaseOperationsTest.java b/modules/flowable-engine/src/test/java/org/flowable/engine/test/cfg/executioncount/VerifyDatabaseOperationsTest.java index e8c3e7d92fa..6b66a73a8bb 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/engine/test/cfg/executioncount/VerifyDatabaseOperationsTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/engine/test/cfg/executioncount/VerifyDatabaseOperationsTest.java @@ -434,7 +434,8 @@ public void testOneTaskProcess() { "selectById org.flowable.task.service.impl.persistence.entity.TaskEntityImpl", 1L, "selectById org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl", 1L, "selectById org.flowable.engine.impl.persistence.entity.HistoricActivityInstanceEntityImpl", 1L, - "selectUnfinishedActivityInstanceExecutionIdAndActivityId", 2L, + "selectUnfinishedActivityInstanceExecutionIdAndActivityId", 1L, + "selectActivityInstanceByTaskId", 1L, "selectExecutionsWithSameRootProcessInstanceId", 1L, "selectTasksByExecutionId", 2L, "selectVariablesByQuery", 2L, diff --git a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.db2.create.eventregistry.sql b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.db2.create.eventregistry.sql index 6e6ed51dfb8..d26d6b48ba0 100644 --- a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.db2.create.eventregistry.sql +++ b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.db2.create.eventregistry.sql @@ -19,4 +19,4 @@ ALTER TABLE FLW_CHANNEL_DEFINITION ADD IMPLEMENTATION_ VARCHAR(255); CALL SYSPROC.ADMIN_CMD ('REORG TABLE FLW_CHANNEL_DEFINITION'); insert into ACT_GE_PROPERTY -values ('eventregistry.schema.version', '7.1.0.2', 1); +values ('eventregistry.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.h2.create.eventregistry.sql b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.h2.create.eventregistry.sql index ada54a4aa2e..e2e7908779f 100644 --- a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.h2.create.eventregistry.sql +++ b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.h2.create.eventregistry.sql @@ -15,4 +15,4 @@ ALTER TABLE FLW_CHANNEL_DEFINITION ADD TYPE_ VARCHAR(255); ALTER TABLE FLW_CHANNEL_DEFINITION ADD IMPLEMENTATION_ VARCHAR(255); insert into ACT_GE_PROPERTY -values ('eventregistry.schema.version', '7.1.0.2', 1); +values ('eventregistry.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mssql.create.eventregistry.sql b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mssql.create.eventregistry.sql index 613b81fa374..444e92740b8 100644 --- a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mssql.create.eventregistry.sql +++ b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mssql.create.eventregistry.sql @@ -35,4 +35,4 @@ ALTER TABLE FLW_CHANNEL_DEFINITION ALTER COLUMN DESCRIPTION_ nvarchar(255); ALTER TABLE FLW_EVENT_DEFINITION ALTER COLUMN DESCRIPTION_ nvarchar(255); insert into ACT_GE_PROPERTY -values ('eventregistry.schema.version', '7.1.0.2', 1); +values ('eventregistry.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mysql.create.eventregistry.sql b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mysql.create.eventregistry.sql index 567240f7496..015fc6f52cd 100644 --- a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mysql.create.eventregistry.sql +++ b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.mysql.create.eventregistry.sql @@ -15,4 +15,4 @@ ALTER TABLE FLW_CHANNEL_DEFINITION ADD TYPE_ VARCHAR(255) NULL; ALTER TABLE FLW_CHANNEL_DEFINITION ADD IMPLEMENTATION_ VARCHAR(255) NULL; insert into ACT_GE_PROPERTY -values ('eventregistry.schema.version', '7.1.0.2', 1); +values ('eventregistry.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.oracle.create.eventregistry.sql b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.oracle.create.eventregistry.sql index f39b93dfd41..292a585b04e 100644 --- a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.oracle.create.eventregistry.sql +++ b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.oracle.create.eventregistry.sql @@ -15,4 +15,4 @@ ALTER TABLE FLW_CHANNEL_DEFINITION ADD TYPE_ VARCHAR2(255); ALTER TABLE FLW_CHANNEL_DEFINITION ADD IMPLEMENTATION_ VARCHAR2(255); insert into ACT_GE_PROPERTY -values ('eventregistry.schema.version', '7.1.0.2', 1); +values ('eventregistry.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.postgres.create.eventregistry.sql b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.postgres.create.eventregistry.sql index 58e50cd909e..8cd21ca1e5c 100644 --- a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.postgres.create.eventregistry.sql +++ b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/create/flowable.postgres.create.eventregistry.sql @@ -15,4 +15,4 @@ ALTER TABLE FLW_CHANNEL_DEFINITION ADD TYPE_ VARCHAR(255); ALTER TABLE FLW_CHANNEL_DEFINITION ADD IMPLEMENTATION_ VARCHAR(255); insert into ACT_GE_PROPERTY -values ('eventregistry.schema.version', '7.1.0.2', 1); +values ('eventregistry.schema.version', '7.2.0.0', 1); diff --git a/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/upgrade/flowable.all.upgradestep.7102.to.7200.eventregistry.sql b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/upgrade/flowable.all.upgradestep.7102.to.7200.eventregistry.sql new file mode 100644 index 00000000000..15e4e5b8e00 --- /dev/null +++ b/modules/flowable-event-registry/src/main/resources/org/flowable/eventregistry/db/upgrade/flowable.all.upgradestep.7102.to.7200.eventregistry.sql @@ -0,0 +1 @@ +update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'eventregistry.schema.version'; diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.cockroachdb.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.cockroachdb.create.identity.sql index 688a44ea733..5c231c81267 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.cockroachdb.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.cockroachdb.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ); insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ varchar(64), diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.db2.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.db2.create.identity.sql index a25a06762a8..b9465a01862 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.db2.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.db2.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ); insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ varchar(64) not null, diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.h2.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.h2.create.identity.sql index df54e54ea9d..e75232c2e36 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.h2.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.h2.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ); insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ varchar(64), diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.hsql.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.hsql.create.identity.sql index ea1d0cbfbfb..7892fe5aad2 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.hsql.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.hsql.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ); insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ varchar(64), diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mssql.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mssql.create.identity.sql index 49faa323806..e68c4ad6c81 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mssql.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mssql.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ); insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ nvarchar(64), diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mysql.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mysql.create.identity.sql index 0de0fdd02f9..0b553068fcc 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mysql.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.mysql.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ varchar(64), diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.oracle.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.oracle.create.identity.sql index 4dffa974d84..9c649dfb586 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.oracle.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.oracle.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ); insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ NVARCHAR2(64), diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.postgres.create.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.postgres.create.identity.sql index fdefe1274c3..b5c79dcb952 100644 --- a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.postgres.create.identity.sql +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/create/flowable.postgres.create.identity.sql @@ -6,7 +6,7 @@ create table ACT_ID_PROPERTY ( ); insert into ACT_ID_PROPERTY -values ('schema.version', '7.1.0.2', 1); +values ('schema.version', '7.2.0.0', 1); create table ACT_ID_BYTEARRAY ( ID_ varchar(64), diff --git a/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/upgrade/flowable.all.upgradestep.7102.to.7200.identity.sql b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/upgrade/flowable.all.upgradestep.7102.to.7200.identity.sql new file mode 100644 index 00000000000..f1c721d4b74 --- /dev/null +++ b/modules/flowable-idm-engine/src/main/resources/org/flowable/idm/db/upgrade/flowable.all.upgradestep.7102.to.7200.identity.sql @@ -0,0 +1 @@ +update ACT_ID_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'schema.version'; diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceBaseResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceBaseResource.java index 9032b30b5e7..9590753e4ef 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceBaseResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceBaseResource.java @@ -93,6 +93,10 @@ protected DataResponse getQueryResponse(ActivityInstan if (queryRequest.getTaskAssignee() != null) { query.taskAssignee(queryRequest.getTaskAssignee()); } + + if (queryRequest.getTaskCompletedBy() != null) { + query.taskCompletedBy(queryRequest.getTaskCompletedBy()); + } if (queryRequest.getProcessInstanceId() != null) { query.processInstanceId(queryRequest.getProcessInstanceId()); diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceCollectionResource.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceCollectionResource.java index fd0119f9db1..b97ecfb0486 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceCollectionResource.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceCollectionResource.java @@ -87,6 +87,10 @@ public DataResponse getActivityInstances(@ApiParam(hid query.setTaskAssignee(allRequestParams.get("taskAssignee")); } + if (allRequestParams.get("taskCompletedBy") != null) { + query.setTaskCompletedBy(allRequestParams.get("taskCompletedBy")); + } + if (allRequestParams.get("processInstanceId") != null) { query.setProcessInstanceId(allRequestParams.get("processInstanceId")); } diff --git a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceQueryRequest.java b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceQueryRequest.java index 82ff077b012..6c25dca694a 100644 --- a/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceQueryRequest.java +++ b/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ActivityInstanceQueryRequest.java @@ -27,6 +27,7 @@ public class ActivityInstanceQueryRequest extends PaginateRequest { private String executionId; private Boolean finished; private String taskAssignee; + private String taskCompletedBy; private String processInstanceId; private String processDefinitionId; private String tenantId; @@ -89,6 +90,14 @@ public void setTaskAssignee(String taskAssignee) { this.taskAssignee = taskAssignee; } + public String getTaskCompletedBy() { + return taskCompletedBy; + } + + public void setTaskCompletedBy(String taskCompletedBy) { + this.taskCompletedBy = taskCompletedBy; + } + public String getProcessInstanceId() { return processInstanceId; }