Skip to content

Commit

Permalink
Add completedBy to runtime activity instance + add assignee/completed…
Browse files Browse the repository at this point in the history
…By to planitem instance, to make it consistent with activity instance
  • Loading branch information
jbarrez committed Oct 24, 2024
1 parent 940bac5 commit aedc94c
Show file tree
Hide file tree
Showing 135 changed files with 1,129 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
update ACT_GE_PROPERTY set VALUE_ = '7.2.0.0' where NAME_ = 'app.schema.version';
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public interface HistoricPlanItemInstance {

String getStartUserId();

String getAssignee();

String getCompletedBy();

String getReferenceId();

String getReferenceType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public interface HistoricPlanItemInstanceQuery extends Query<HistoricPlanItemIns
HistoricPlanItemInstanceQuery planItemInstanceDefinitionType(String planItemDefinitionType);
HistoricPlanItemInstanceQuery planItemInstanceDefinitionTypes(List<String> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ default Date getStartTime() {
Date getExitTime();
Date getEndedTime();
String getStartUserId();
String getAssignee();
String getCompletedBy();
String getReferenceId();
String getReferenceType();
boolean isCompletable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public interface PlanItemInstanceQuery extends Query<PlanItemInstanceQuery, Plan
PlanItemInstanceQuery planItemInstanceEndedBefore(Date endedBefore);
PlanItemInstanceQuery planItemInstanceEndedAfter(Date endedAfter);
PlanItemInstanceQuery planItemInstanceStartUserId(String startUserId);
PlanItemInstanceQuery planItemInstanceAssignee(String assignee);
PlanItemInstanceQuery planItemInstanceCompletedBy(String completedBy);
PlanItemInstanceQuery planItemInstanceReferenceId(String referenceId);
PlanItemInstanceQuery planItemInstanceReferenceType(String referenceType);
PlanItemInstanceQuery planItemInstanceEntryCriterionId(String entryCriterionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.flowable.cmmn.engine.impl.behavior.PlanItemActivityBehavior;
import org.flowable.cmmn.engine.impl.event.FlowableCmmnEventBuilder;
import org.flowable.cmmn.engine.impl.persistence.entity.PlanItemInstanceEntity;
import org.flowable.cmmn.engine.impl.persistence.entity.PlanItemInstanceEntityManager;
import org.flowable.cmmn.engine.impl.task.TaskHelper;
import org.flowable.cmmn.engine.impl.util.CmmnLoggingSessionUtil;
import org.flowable.cmmn.engine.impl.util.CommandContextUtil;
Expand Down Expand Up @@ -84,6 +85,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
TaskService taskService = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService();
ExpressionManager expressionManager = CommandContextUtil.getExpressionManager(commandContext);
PlanItemInstanceEntityManager planItemInstanceEntityManager = CommandContextUtil.getPlanItemInstanceEntityManager(commandContext);

TaskEntity taskEntity = taskService.createTask();

Expand Down Expand Up @@ -114,7 +116,7 @@ public void execute(CommandContext commandContext, PlanItemInstanceEntity planIt

handleTaskName(planItemInstanceEntity, expressionManager, taskEntity, beforeContext);
handleTaskDescription(planItemInstanceEntity, expressionManager, taskEntity, beforeContext);
handleAssignee(planItemInstanceEntity, taskService, expressionManager, taskEntity, beforeContext, migrationContext);
handleAssignee(planItemInstanceEntity, taskService, expressionManager, taskEntity, planItemInstanceEntityManager, beforeContext, migrationContext);
handleOwner(planItemInstanceEntity, taskService, expressionManager, taskEntity, beforeContext);
handlePriority(planItemInstanceEntity, expressionManager, taskEntity, beforeContext);
handleFormKey(planItemInstanceEntity, expressionManager, taskEntity, beforeContext);
Expand Down Expand Up @@ -207,8 +209,8 @@ protected void handleTaskDescription(PlanItemInstanceEntity planItemInstanceEnti
}

protected void handleAssignee(PlanItemInstanceEntity planItemInstanceEntity, TaskService taskService,
ExpressionManager expressionManager, TaskEntity taskEntity, CreateHumanTaskBeforeContext beforeContext,
MigrationContext migrationContext) {
ExpressionManager expressionManager, TaskEntity taskEntity, PlanItemInstanceEntityManager planItemInstanceEntityManager,
CreateHumanTaskBeforeContext beforeContext, MigrationContext migrationContext) {

String assigneeStringValue = null;
if (migrationContext != null && migrationContext.getAssignee() != null) {
Expand All @@ -226,6 +228,7 @@ protected void handleAssignee(PlanItemInstanceEntity planItemInstanceEntity, Tas
}

taskService.changeTaskAssignee(taskEntity, assigneeValue);
planItemInstanceEntityManager.updateHumanTaskPlanItemInstanceAssignee(taskEntity, assigneeValue);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class ReadOnlyDelegatePlanItemInstanceImpl implements ReadOnlyDelegatePla
protected final Date exitTime;
protected final Date endedTime;
protected final String startUserId;
protected final String assignee;
protected final String completedBy;
protected final String referenceId;
protected final String referenceType;
protected final boolean completable;
Expand Down Expand Up @@ -87,6 +89,8 @@ public ReadOnlyDelegatePlanItemInstanceImpl(DelegatePlanItemInstance planItemIns
this.exitTime = planItemInstance.getExitTime();
this.endedTime = planItemInstance.getEndedTime();
this.startUserId = planItemInstance.getStartUserId();
this.assignee = planItemInstance.getAssignee();
this.completedBy = planItemInstance.getCompletedBy();
this.referenceId = planItemInstance.getReferenceId();
this.referenceType = planItemInstance.getReferenceType();
this.completable = planItemInstance.isCompletable();
Expand Down Expand Up @@ -220,6 +224,16 @@ public String getStartUserId() {
return startUserId;
}

@Override
public String getAssignee() {
return assignee;
}

@Override
public String getCompletedBy() {
return completedBy;
}

@Override
public String getReferenceId() {
return referenceId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ public void recordPlanItemInstanceUpdated(PlanItemInstanceEntity planItemInstanc
historicPlanItemInstanceEntity.setFormKey(planItemInstanceEntity.getFormKey());
historicPlanItemInstanceEntity.setElementId(planItemInstanceEntity.getElementId());
historicPlanItemInstanceEntity.setPlanItemDefinitionId(planItemInstanceEntity.getPlanItemDefinitionId());
historicPlanItemInstanceEntity.setAssignee(planItemInstanceEntity.getAssignee());
historicPlanItemInstanceEntity.setCompletedBy(planItemInstanceEntity.getCompletedBy());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public class HistoricPlanItemInstanceQueryImpl extends AbstractQuery<HistoricPla
protected Date endedBefore;
protected Date endedAfter;
protected String startUserId;
protected String assignee;
protected String completedBy;
protected String referenceId;
protected String referenceType;
protected boolean ended;
Expand Down Expand Up @@ -179,6 +181,18 @@ public HistoricPlanItemInstanceQuery planItemInstanceStartUserId(String startUse
return this;
}

@Override
public HistoricPlanItemInstanceQuery planItemInstanceAssignee(String assignee) {
this.assignee = assignee;
return this;
}

@Override
public HistoricPlanItemInstanceQuery planItemInstanceCompletedBy(String completedBy) {
this.completedBy = completedBy;
return this;
}

@Override
public HistoricPlanItemInstanceQuery planItemInstanceReferenceId(String referenceId) {
this.referenceId = referenceId;
Expand Down Expand Up @@ -647,6 +661,12 @@ public Date getEndedAfter() {
public String getStartUserId() {
return startUserId;
}
public String getAssignee() {
return assignee;
}
public String getCompletedBy() {
return completedBy;
}
public String getReferenceId() {
return referenceId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public interface HistoricPlanItemInstanceEntity extends Entity, HasRevision, His

void setStartUserId(String startUserId);

void setAssignee(String assignee);

void setCompletedBy(String completedBy);

void setReferenceId(String referenceId);

void setReferenceType(String referenceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class HistoricPlanItemInstanceEntityImpl extends AbstractCmmnEngineEntity
protected Date endedTime;
protected Date lastUpdatedTime;
protected String startUserId;
protected String assignee;
protected String completedBy;
protected String referenceId;
protected String referenceType;
protected String entryCriterionId;
Expand All @@ -80,6 +82,8 @@ public HistoricPlanItemInstanceEntityImpl(PlanItemInstance planItemInstance) {
this.planItemDefinitionId = planItemInstance.getPlanItemDefinitionId();
this.planItemDefinitionType = planItemInstance.getPlanItemDefinitionType();
this.startUserId = planItemInstance.getStartUserId();
this.assignee = planItemInstance.getAssignee();
this.completedBy = planItemInstance.getCompletedBy();
this.referenceId = planItemInstance.getReferenceId();
this.referenceType = planItemInstance.getReferenceType();
this.createTime = planItemInstance.getCreateTime();
Expand Down Expand Up @@ -128,6 +132,8 @@ public Object getPersistentState() {
persistentState.put("endedTime", endedTime);
persistentState.put("lastUpdatedTime", lastUpdatedTime);
persistentState.put("startUserId", startUserId);
persistentState.put("assignee", assignee);
persistentState.put("completedBy", completedBy);
persistentState.put("referenceId", referenceId);
persistentState.put("referenceType", referenceType);
persistentState.put("planItemDefinitionId", planItemDefinitionId);
Expand Down Expand Up @@ -383,6 +389,26 @@ public void setStartUserId(String startUserId) {
this.startUserId = startUserId;
}

@Override
public String getAssignee() {
return assignee;
}

@Override
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 getReferenceId() {
return referenceId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public class PlanItemInstanceEntityImpl extends AbstractCmmnEngineVariableScopeE
protected Date exitTime;
protected Date endedTime;
protected String startUserId;
protected String assignee;
protected String completedBy;
protected String referenceId;
protected String referenceType;
protected boolean completable;
Expand Down Expand Up @@ -126,6 +128,8 @@ public PlanItemInstanceEntityImpl(HistoricPlanItemInstance historicPlanItemInsta
setExitTime(historicPlanItemInstance.getExitTime());
setEndedTime(historicPlanItemInstance.getEndedTime());
setStartUserId(historicPlanItemInstance.getStartUserId());
setAssignee(historicPlanItemInstance.getAssignee());
setCompletedBy(historicPlanItemInstance.getCompletedBy());
setReferenceId(historicPlanItemInstance.getReferenceId());
setReferenceType(historicPlanItemInstance.getReferenceType());
setEntryCriterionId(historicPlanItemInstance.getEntryCriterionId());
Expand Down Expand Up @@ -161,6 +165,8 @@ public Object getPersistentState() {
persistentState.put("exitTime", exitTime);
persistentState.put("endedTime", endedTime);
persistentState.put("startUserId", startUserId);
persistentState.put("assignee", assignee);
persistentState.put("completedBy", completedBy);
persistentState.put("referenceId", referenceId);
persistentState.put("referenceType", referenceType);
persistentState.put("completeable", completable);
Expand Down Expand Up @@ -400,6 +406,22 @@ public void setStartUserId(String startUserId) {
this.startUserId = startUserId;
}
@Override
public String getCompletedBy() {
return completedBy;
}
@Override
public void setCompletedBy(String completedBy) {
this.completedBy = completedBy;
}
@Override
public String getAssignee() {
return assignee;
}
@Override
public void setAssignee(String assignee) {
this.assignee = assignee;
}
@Override
public String getReferenceId() {
return referenceId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.flowable.cmmn.api.runtime.PlanItemInstanceQuery;
import org.flowable.cmmn.engine.impl.runtime.PlanItemInstanceQueryImpl;
import org.flowable.common.engine.impl.persistence.entity.EntityManager;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;

/**
* @author Joram Barrez
Expand Down Expand Up @@ -48,6 +49,10 @@ public interface PlanItemInstanceEntityManager extends EntityManager<PlanItemIns
List<PlanItemInstanceEntity> findByCaseInstanceIdAndPlanItemId(String caseInstanceId, String planItemId);

List<PlanItemInstanceEntity> findByStageInstanceIdAndPlanItemId(String stageInstanceId, String planItemId);

PlanItemInstanceEntity updateHumanTaskPlanItemInstanceAssignee(TaskEntity taskEntity, String assignee);

PlanItemInstanceEntity updateHumanTaskPlanItemInstanceCompletedBy(TaskEntity taskEntity, String assignee);

void updatePlanItemInstancesCaseDefinitionId(String caseInstanceId, String caseDefinitionId);

Expand Down
Loading

0 comments on commit aedc94c

Please sign in to comment.