提交 93d4b932 编写于 作者: M Miguel Ruiz 提交者: mergify[bot]

[AAE-785] Add application version field to processes and tasks in Activiti Core (#3001)

* AAE-785: Added appVersion, refactor, tests

* AAE-785: Fixed schema version number

* AAE-785: Increased value column size

* AAE-785: Addressed CRs
上级 d51a9c64
......@@ -16,6 +16,8 @@
package org.activiti.runtime.api.model.impl;
import java.util.Objects;
import org.activiti.api.process.model.ProcessDefinition;
import org.activiti.api.runtime.model.impl.ProcessDefinitionImpl;
import org.activiti.bpmn.model.BpmnModel;
......@@ -37,6 +39,7 @@ public class APIProcessDefinitionConverter extends ListConverter<org.activiti.en
processDefinition.setDescription(internalProcessDefinition.getDescription());
processDefinition.setVersion(internalProcessDefinition.getVersion());
processDefinition.setKey(internalProcessDefinition.getKey());
processDefinition.setAppVersion(Objects.toString(internalProcessDefinition.getAppVersion(), null));
BpmnModel model = repositoryService.getBpmnModel(internalProcessDefinition.getId());
processDefinition.setFormKey(model.getStartFormKey(internalProcessDefinition.getKey()));
return processDefinition;
......
......@@ -16,6 +16,8 @@
package org.activiti.runtime.api.model.impl;
import java.util.Objects;
import org.activiti.api.process.model.ProcessInstance;
import org.activiti.api.runtime.model.impl.ProcessInstanceImpl;
......@@ -37,6 +39,7 @@ public class APIProcessInstanceConverter extends ListConverter<org.activiti.engi
processInstance.setBusinessKey(internalProcessInstance.getBusinessKey());
processInstance.setStatus(calculateStatus(internalProcessInstance));
processInstance.setProcessDefinitionVersion(internalProcessInstance.getProcessDefinitionVersion());
processInstance.setAppVersion(Objects.toString(internalProcessInstance.getAppVersion(), null));
return processInstance;
}
......
......@@ -28,7 +28,8 @@ import org.mockito.Mock;
import static org.activiti.runtime.api.model.impl.MockProcessDefinitionBuilder.processDefinitionBuilderBuilder;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.MockitoAnnotations.initMocks;
public class APIProcessDefinitionConverterTest {
......@@ -53,11 +54,11 @@ public class APIProcessDefinitionConverterTest {
BpmnModel model = new BpmnModel();
model.addProcess(process);
when(repositoryService.getBpmnModel("anId")).thenReturn(model);
given(repositoryService.getBpmnModel(any())).willReturn(model);
}
@Test
public void convertFromProcessDefinitionShouldSetAllFieldsInTheConvertedProcessDefinition() {
public void should_convertFromProcessDefinition_when_allFieldsAreSet() {
ProcessDefinition convertedProcessDefinition = processDefinitionConverter.from(
processDefinitionBuilderBuilder()
.withId("anId")
......@@ -65,10 +66,10 @@ public class APIProcessDefinitionConverterTest {
.withName("Process Name")
.withDescription("process description")
.withVersion(3)
.withAppVersion(1)
.build()
);
//THEN
assertThat(convertedProcessDefinition)
.isNotNull()
.extracting(ProcessDefinition::getId,
......@@ -76,6 +77,7 @@ public class APIProcessDefinitionConverterTest {
ProcessDefinition::getName,
ProcessDefinition::getDescription,
ProcessDefinition::getVersion,
ProcessDefinition::getAppVersion,
ProcessDefinition::getFormKey)
.containsExactly(
"anId",
......@@ -83,6 +85,21 @@ public class APIProcessDefinitionConverterTest {
"Process Name",
"process description",
3,
"1",
"AFormKey");
}
@Test
public void should_convertProcessDefinition_when_appVersionNull() {
ProcessDefinition convertedProcessDefinition = processDefinitionConverter.from(
processDefinitionBuilderBuilder()
.withKey("processKey")
.withAppVersion(null)
.build());
assertThat(convertedProcessDefinition)
.isNotNull()
.extracting(ProcessDefinition::getAppVersion)
.isNull();
}
}
......@@ -38,56 +38,60 @@ public class APIProcessInstanceConverterTest {
private static final String PROCESS_DEFINITION_KEY = "processDefinitionKey";
private static final String PROCESS_DEFINITION_ID = "processDefinitionId";
private static final String PROCESS_INSTANCE_ID = "processInstanceId";
public static final int APP_VERSION = 1;
private static final String APP_VERSION_STRING = "1";
private static final Date START_TIME = new Date();
private APIProcessInstanceConverter subject = new APIProcessInstanceConverter();
private Date startTime = new Date();
@Test
public void shouldConvertFromInternalProcessInstanceWithRunningStatus() {
//given
ExecutionEntity internalProcessInstance = anInternalProcessInstance(startTime);
public void should_convertFromInternalProcessInstance_when_withRunningStatus() {
ExecutionEntity internalProcessInstance = anInternalProcessInstance(APP_VERSION);
internalProcessInstance.setActive(true);
//when
ProcessInstance result = subject.from(internalProcessInstance);
//then
assertValidProcessInstanceResult(result);
assertThat(result.getStatus()).isEqualTo(ProcessInstanceStatus.RUNNING);
}
@Test
public void shouldConvertFromInternalProcessInstanceWithSuspendedStatus() {
//given
ExecutionEntity internalProcessInstance = anInternalProcessInstance(startTime);
public void should_convertFromInternalProcessInstance_when_withSuspendedStatus() {
ExecutionEntity internalProcessInstance = anInternalProcessInstance(APP_VERSION);
internalProcessInstance.setSuspensionState(SuspensionState.SUSPENDED.getStateCode());
//when
ProcessInstance result = subject.from(internalProcessInstance);
//then
assertValidProcessInstanceResult(result);
assertThat(result.getStatus()).isEqualTo(ProcessInstanceStatus.SUSPENDED);
}
@Test
public void shouldConvertFromInternalProcessInstanceWithCompletedStatus() {
//given
ExecutionEntity internalProcessInstance = anInternalProcessInstance(startTime);
public void should_convertFromInternalProcessInstance_when_withCompletedStatus() {
ExecutionEntity internalProcessInstance = anInternalProcessInstance(APP_VERSION);
internalProcessInstance.setEnded(true);
//when
ProcessInstance result = subject.from(internalProcessInstance);
//then
assertValidProcessInstanceResult(result);
assertThat(result.getStatus()).isEqualTo(ProcessInstanceStatus.COMPLETED);
}
private void assertValidProcessInstanceResult(ProcessInstance result) {
@Test
public void should_convertFromInternalProcessInstance_when_appVersionIsNotSet() {
ExecutionEntity internalProcessInstance = anInternalProcessInstance(null);
ProcessInstance result = subject.from(internalProcessInstance);
assertValidProcessInstanceResult(result, null);
}
private static void assertValidProcessInstanceResult(ProcessInstance result) {
assertValidProcessInstanceResult(result, APP_VERSION_STRING);
}
private static void assertValidProcessInstanceResult(ProcessInstance result, String appVersionString) {
assertThat(result).isNotNull();
assertThat(result.getId()).isEqualTo(PROCESS_INSTANCE_ID);
assertThat(result.getBusinessKey()).isEqualTo(BUSINESS_KEY);
......@@ -98,10 +102,11 @@ public class APIProcessInstanceConverterTest {
assertThat(result.getName()).isEqualTo(NAME);
assertThat(result.getParentId()).isEqualTo(PARENT_PROCESS_INSTANCE_ID);
assertThat(result.getInitiator()).isEqualTo(START_USER_ID);
assertThat(result.getStartDate()).isEqualTo(startTime);
assertThat(result.getStartDate()).isEqualTo(START_TIME);
assertThat(result.getAppVersion()).isEqualTo(appVersionString);
}
private ExecutionEntity anInternalProcessInstance(Date startTime) {
private ExecutionEntity anInternalProcessInstance(Integer appVersion) {
ExecutionEntity internalProcessInstance = new ExecutionEntityImpl();
internalProcessInstance.setId(PROCESS_INSTANCE_ID);
......@@ -113,8 +118,9 @@ public class APIProcessInstanceConverterTest {
internalProcessInstance.setName(NAME);
internalProcessInstance.setDescription(DESCRIPTION);
internalProcessInstance.setStartUserId(START_USER_ID);
internalProcessInstance.setStartTime(startTime);
internalProcessInstance.setStartTime(START_TIME);
internalProcessInstance.setActive(true);
internalProcessInstance.setAppVersion(appVersion);
return internalProcessInstance;
}
......
......@@ -61,6 +61,11 @@ public class MockProcessDefinitionBuilder {
return this;
}
public MockProcessDefinitionBuilder withAppVersion(Integer appVersion) {
when(processDefinition.getAppVersion()).thenReturn(appVersion);
return this;
}
public ProcessDefinition build() {
return processDefinition;
}
......
......@@ -16,6 +16,8 @@
package org.activiti.runtime.api.model.impl;
import java.util.Objects;
import org.activiti.api.task.model.Task;
import org.activiti.api.task.model.impl.TaskImpl;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
......@@ -45,6 +47,7 @@ public class APITaskConverter extends ListConverter<org.activiti.engine.task.Tas
task.setPriority(internalTask.getPriority());
task.setFormKey(internalTask.getFormKey());
task.setTaskDefinitionKey(internalTask.getTaskDefinitionKey());
task.setAppVersion(Objects.toString(internalTask.getAppVersion(), null));
return task;
}
......
......@@ -43,8 +43,7 @@ public class APITaskConverterTest {
}
@Test
public void convertFromTaskShouldSetAllFieldsInTheConvertedTask() {
//WHEN
public void should_convertTask_when_allFieldsAreSet() {
Date now = new Date();
Task convertedTask = taskConverter.from(
taskBuilder()
......@@ -61,10 +60,10 @@ public class APITaskConverterTest {
.withParentTaskId("testParentTaskId")
.withFormKey("testFormKey")
.withTaskDefinitionKey("taskDefinitionKey")
.withAppVersion(1)
.build()
);
//THEN
assertThat(convertedTask)
.isNotNull()
.extracting(Task::getId,
......@@ -80,7 +79,8 @@ public class APITaskConverterTest {
Task::getParentTaskId,
Task::getFormKey,
Task::getStatus,
Task::getTaskDefinitionKey)
Task::getTaskDefinitionKey,
Task::getAppVersion)
.containsExactly("testTaskId",
"testUser",
"testTaskName",
......@@ -94,7 +94,17 @@ public class APITaskConverterTest {
"testParentTaskId",
"testFormKey",
ASSIGNED,
"taskDefinitionKey");
"taskDefinitionKey",
"1");
}
@Test
public void should_convertTask_when_appVersionNull() {
Task convertedTask = taskConverter.from(taskBuilder().withAppVersion(null).build());
assertThat(convertedTask)
.isNotNull()
.extracting(Task::getAppVersion)
.isNull();
}
@Test
......
......@@ -132,6 +132,11 @@ public class MockTaskBuilder {
return this;
}
public MockTaskBuilder withAppVersion(Integer appVersion) {
when(task.getAppVersion()).thenReturn(appVersion);
return this;
}
public Task build() {
return task;
}
......
......@@ -39,7 +39,7 @@ import org.activiti.engine.api.internal.Internal;
public interface ProcessEngine {
/** the version of the activiti library */
public static String VERSION = "7.1.0.0"; // Note the extra .x at the end. To cater for snapshot releases with different database changes
public static String VERSION = "7.1.0-M6"; // Note the extra -x at the end. To cater for snapshot releases with different database changes
/**
* The name as specified in 'process-engine-name' in the activiti.cfg.xml configuration file. The default name for a process engine is 'default
......
......@@ -67,7 +67,8 @@ public class UserTaskActivityBehavior extends TaskActivityBehavior {
TaskEntityManager taskEntityManager = commandContext.getTaskEntityManager();
TaskEntity task = taskEntityManager.create();
task.setExecution((ExecutionEntity) execution);
ExecutionEntity executionEntity = (ExecutionEntity) execution;
task.setExecution(executionEntity);
task.setTaskDefinitionKey(userTask.getId());
String activeTaskName = null;
......@@ -197,8 +198,9 @@ public class UserTaskActivityBehavior extends TaskActivityBehavior {
}
}
task.setAppVersion(executionEntity.getProcessInstance().getAppVersion());
taskEntityManager.insert(task, (ExecutionEntity) execution);
taskEntityManager.insert(task, executionEntity);
task.setVariablesLocal(calculateInputVariables(execution));
......
......@@ -80,6 +80,8 @@ public class BpmnDeployer implements Deployer {
getPreviousVersionsOfProcessDefinitions(parsedDeployment);
setProcessDefinitionVersionsAndIds(parsedDeployment,
mapOfNewProcessDefinitionToPreviousVersion);
setProcessDefinitionAppVersion(parsedDeployment);
persistProcessDefinitionsAndAuthorizations(parsedDeployment);
updateTimersAndEvents(parsedDeployment,
mapOfNewProcessDefinitionToPreviousVersion);
......@@ -437,6 +439,15 @@ public class BpmnDeployer implements Deployer {
return isEqual;
}
private void setProcessDefinitionAppVersion(ParsedDeployment parsedDeployment) {
if (parsedDeployment.getDeployment().getProjectReleaseVersion() != null) {
Integer version = parsedDeployment.getDeployment().getVersion();
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
processDefinition.setAppVersion(version);
}
}
}
protected boolean localizeDataObjectElements(List<ValuedDataObject> dataObjects,
ObjectNode infoNode) {
boolean localizationValuesChanged = false;
......
......@@ -82,7 +82,7 @@ public class DeployCmd<T> implements Command<Deployment>, Serializable {
existingDeployment)) {
return existingDeployment;
} else {
deployment.setVersion(existingDeployment.getVersion() != null? existingDeployment.getVersion() + 1 : 2);
deployment.setVersion(existingDeployment.getVersion() + 1);
}
}
}
......
......@@ -13,20 +13,20 @@
package org.activiti.engine.impl.cmd;
import java.io.Serializable;
import java.util.Optional;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.DeploymentEntity;
import org.activiti.engine.impl.persistence.entity.DeploymentEntityManager;
import org.activiti.engine.impl.persistence.entity.TaskEntity;
import org.activiti.engine.task.Task;
/**
*/
public class NewTaskCmd implements Command<Task>, Serializable {
private static final long serialVersionUID = 1L;
protected String taskId;
private final String taskId;
public NewTaskCmd(String taskId) {
this.taskId = taskId;
......@@ -36,7 +36,14 @@ public class NewTaskCmd implements Command<Task>, Serializable {
TaskEntity task = commandContext.getTaskEntityManager().create();
task.setId(taskId);
task.setRevision(0);
findAppVersionFromDeployment(commandContext.getDeploymentEntityManager())
.ifPresent(task::setAppVersion);
return task;
}
private Optional<Integer> findAppVersionFromDeployment(DeploymentEntityManager deploymentEntityManager) {
DeploymentEntity deployment = deploymentEntityManager.findLatestDeploymentByName("SpringAutoDeployment");
return Optional.ofNullable(deployment)
.map(DeploymentEntity::getVersion);
}
}
......@@ -32,8 +32,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.ActivitiOptimisticLockingException;
......@@ -68,16 +66,10 @@ import org.apache.ibatis.session.SqlSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*/
public class DbSqlSession implements Session {
private static final Logger log = LoggerFactory.getLogger(DbSqlSession.class);
protected static final Pattern CLEAN_VERSION_REGEX = Pattern.compile("\\d\\.\\d*");
protected static final String LAST_V5_VERSION = "5.99.0.0";
protected static final List<ActivitiVersion> ACTIVITI_VERSIONS = new ArrayList<ActivitiVersion>();
......@@ -141,6 +133,7 @@ public class DbSqlSession implements Session {
// Version 7
ACTIVITI_VERSIONS.add(new ActivitiVersion("7.0.0.0"));
ACTIVITI_VERSIONS.add(new ActivitiVersion("7.1.0.0"));
/* Current */
ACTIVITI_VERSIONS.add(new ActivitiVersion(ProcessEngine.VERSION));
......@@ -1191,49 +1184,6 @@ public class DbSqlSession implements Session {
}
}
protected boolean isUpgradeNeeded(String versionInDatabase) {
if (ProcessEngine.VERSION.equals(versionInDatabase)) {
return false;
}
String cleanDbVersion = getCleanVersion(versionInDatabase);
String[] cleanDbVersionSplitted = cleanDbVersion.split("\\.");
int dbMajorVersion = Integer.valueOf(cleanDbVersionSplitted[0]);
int dbMinorVersion = Integer.valueOf(cleanDbVersionSplitted[1]);
String cleanEngineVersion = getCleanVersion(ProcessEngine.VERSION);
String[] cleanEngineVersionSplitted = cleanEngineVersion.split("\\.");
int engineMajorVersion = Integer.valueOf(cleanEngineVersionSplitted[0]);
int engineMinorVersion = Integer.valueOf(cleanEngineVersionSplitted[1]);
if ((dbMajorVersion > engineMajorVersion) || ((dbMajorVersion <= engineMajorVersion) && (dbMinorVersion > engineMinorVersion))) {
throw new ActivitiException("Version of activiti database (" + versionInDatabase + ") is more recent than the engine (" + ProcessEngine.VERSION + ")");
} else if (cleanDbVersion.compareTo(cleanEngineVersion) == 0) {
// Versions don't match exactly, possibly snapshot is being used
log.warn("Engine-version is the same, but not an exact match: {} vs. {}. Not performing database-upgrade.",
versionInDatabase,
ProcessEngine.VERSION);
return false;
}
return true;
}
protected String getCleanVersion(String versionString) {
Matcher matcher = CLEAN_VERSION_REGEX.matcher(versionString);
if (!matcher.find()) {
throw new ActivitiException("Illegal format for version: " + versionString);
}
String cleanString = matcher.group();
try {
Double.parseDouble(cleanString); // try to parse it, to see if it is
// really a number
return cleanString;
} catch (NumberFormatException nfe) {
throw new ActivitiException("Illegal format for version: " + versionString);
}
}
protected String prependDatabaseTablePrefix(String tableName) {
return dbSqlSessionFactory.getDatabaseTablePrefix() + tableName;
}
......
......@@ -22,8 +22,6 @@ import org.activiti.engine.impl.db.HasRevision;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.ProcessInstance;
/**
*/
@Internal
public interface ExecutionEntity extends DelegateExecution, Execution, ProcessInstance, Entity, HasRevision {
......
......@@ -31,14 +31,6 @@ import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.CountingExecutionEntity;
import org.activiti.engine.impl.util.ProcessDefinitionUtil;
/**
*/
public class ExecutionEntityImpl extends VariableScopeImpl implements ExecutionEntity, CountingExecutionEntity {
private static final long serialVersionUID = 1L;
......@@ -200,6 +192,8 @@ public class ExecutionEntityImpl extends VariableScopeImpl implements ExecutionE
protected String parentProcessInstanceId;
private Integer appVersion;
public ExecutionEntityImpl() {
}
......@@ -940,6 +934,15 @@ public class ExecutionEntityImpl extends VariableScopeImpl implements ExecutionE
this.identityLinkCount = identityLinkCount;
}
@Override
public void setAppVersion(Integer appVersion) {
this.appVersion = appVersion;
}
@Override
public Integer getAppVersion() {
return appVersion;
}
//toString /////////////////////////////////////////////////////////////////
......
......@@ -217,6 +217,7 @@ public class ExecutionEntityManagerImpl extends AbstractEntityManager<ExecutionE
processInstanceExecution.setProcessDefinitionKey(processDefinition.getKey());
processInstanceExecution.setProcessDefinitionName(processDefinition.getName());
processInstanceExecution.setProcessDefinitionVersion(processDefinition.getVersion());
processInstanceExecution.setAppVersion(processDefinition.getAppVersion());
processInstanceExecution.setBusinessKey(businessKey);
processInstanceExecution.setScope(true); // process instance is always a scope for all child executions
......@@ -296,6 +297,7 @@ public class ExecutionEntityManagerImpl extends AbstractEntityManager<ExecutionE
subProcessInstance.setScope(true); // process instance is always a scope for all child executions
subProcessInstance.setStartUserId(Authentication.getAuthenticatedUserId());
subProcessInstance.setBusinessKey(businessKey);
subProcessInstance.setAppVersion(processDefinition.getAppVersion());
// Store in database
insert(subProcessInstance, false);
......
......@@ -18,10 +18,6 @@ import org.activiti.engine.api.internal.Internal;
import org.activiti.engine.impl.db.HasRevision;
import org.activiti.engine.repository.ProcessDefinition;
/**
*/
@Internal
public interface ProcessDefinitionEntity extends ProcessDefinition, Entity, HasRevision {
......
......@@ -22,10 +22,6 @@ import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.impl.bpmn.data.IOSpecification;
import org.activiti.engine.impl.context.Context;
/**
*/
public class ProcessDefinitionEntityImpl extends AbstractEntity implements ProcessDefinitionEntity, Serializable {
private static final long serialVersionUID = 1L;
......@@ -47,6 +43,7 @@ public class ProcessDefinitionEntityImpl extends AbstractEntity implements Proce
protected boolean isIdentityLinksInitialized;
protected List<IdentityLinkEntity> definitionIdentityLinkEntities = new ArrayList<IdentityLinkEntity>();
protected IOSpecification ioSpecification;
protected Integer appVersion;
// Backwards compatibility
protected String engineVersion;
......@@ -218,4 +215,12 @@ public class ProcessDefinitionEntityImpl extends AbstractEntity implements Proce
return "ProcessDefinitionEntity[" + id + "]";
}
public void setAppVersion(Integer appVersion){
this.appVersion = appVersion;
}
public Integer getAppVersion(){
return this.appVersion;
}
}
......@@ -92,6 +92,8 @@ public class TaskEntityImpl extends VariableScopeImpl implements TaskEntity, Ser
protected Date claimTime;
protected Integer appVersion;
public TaskEntityImpl() {
}
......@@ -600,6 +602,14 @@ public class TaskEntityImpl extends VariableScopeImpl implements TaskEntity, Ser
this.claimTime = claimTime;
}
public Integer getAppVersion(){
return this.appVersion;
}
public void setAppVersion (Integer appVersion){
this.appVersion = appVersion;
}
public String toString() {
return "Task[id=" + id + ", name=" + name + "]";
}
......
......@@ -80,6 +80,7 @@ public class TaskEntityManagerImpl extends AbstractEntityManager<TaskEntity> imp
taskEntity.setExecutionId(execution.getId());
taskEntity.setProcessInstanceId(execution.getProcessInstanceId());
taskEntity.setProcessDefinitionId(execution.getProcessDefinitionId());
taskEntity.setAppVersion(execution.getAppVersion());
getHistoryManager().recordTaskExecutionIdChange(taskEntity.getId(), taskEntity.getExecutionId());
}
......
......@@ -218,6 +218,9 @@ public class ProcessInstanceHelper {
}
ExecutionEntity execution = processInstance.getExecutions().get(0); // There will always be one child execution created
execution.setAppVersion(processInstance.getAppVersion());
commandContext.getAgenda().planContinueProcessOperation(execution);
if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
......
......@@ -78,4 +78,8 @@ public interface ProcessDefinition {
/** The engine version for this process definition (5 or 6) */
String getEngineVersion();
void setAppVersion(Integer appVersion);
Integer getAppVersion();
}
......@@ -99,4 +99,8 @@ public interface ProcessInstance extends Execution {
* Returns the user id of this process instance.
*/
String getStartUserId();
void setAppVersion(Integer appVersion);
Integer getAppVersion();
}
......@@ -79,4 +79,8 @@ public interface Task extends TaskInfo {
/** Indicates whether this task is suspended or not. */
boolean isSuspended();
Integer getAppVersion();
void setAppVersion(Integer appVersion);
}
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '7.0.0.0', 1);
values ('schema.version', '7.1.0-M6', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(7.0.0.0)', 1);
values ('schema.history', 'create(7.1.0-M6)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......@@ -32,7 +32,7 @@ create table ACT_RE_DEPLOYMENT (
TENANT_ID_ varchar(255) default '',
DEPLOY_TIME_ timestamp,
ENGINE_VERSION_ varchar(255),
VERSION_ integer,
VERSION_ integer default 1,
PROJECT_RELEASE_VERSION_ varchar(255),
primary key (ID_)
);
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ integer,
VAR_COUNT_ integer,
ID_LINK_COUNT_ integer,
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ integer,
TENANT_ID_ varchar(255) not null default '',
ENGINE_VERSION_ varchar(255),
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ varchar(255) default '',
FORM_KEY_ varchar(255),
CLAIM_TIME_ timestamp,
APP_VERSION_ integer,
primary key (ID_)
);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '7.1.0.0', 1);
values ('schema.version', '7.1.0-M6', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(7.1.0.0)', 1);
values ('schema.history', 'create(7.1.0-M6)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......@@ -32,7 +32,7 @@ create table ACT_RE_DEPLOYMENT (
TENANT_ID_ varchar(255) default '',
DEPLOY_TIME_ timestamp,
ENGINE_VERSION_ varchar(255),
VERSION_ integer,
VERSION_ integer default 1,
PROJECT_RELEASE_VERSION_ varchar(255),
primary key (ID_)
);
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ integer,
VAR_COUNT_ integer,
ID_LINK_COUNT_ integer,
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ integer,
TENANT_ID_ varchar(255) default '',
ENGINE_VERSION_ varchar(255),
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ varchar(255) default '',
FORM_KEY_ varchar(255),
CLAIM_TIME_ timestamp,
APP_VERSION_ integer,
primary key (ID_)
);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '7.0.0.0', 1);
values ('schema.version', '7.1.0-M6', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(7.0.0.0)', 1);
values ('schema.history', 'create(7.1.0-M6)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......@@ -32,7 +32,7 @@ create table ACT_RE_DEPLOYMENT (
TENANT_ID_ varchar(255) default '',
DEPLOY_TIME_ timestamp,
ENGINE_VERSION_ varchar(255),
VERSION_ integer,
VERSION_ integer DEFAULT 1,
PROJECT_RELEASE_VERSION_ varchar(255),
primary key (ID_)
);
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ integer,
VAR_COUNT_ integer,
ID_LINK_COUNT_ integer,
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ integer,
TENANT_ID_ varchar(255) default '',
ENGINE_VERSION_ varchar(255),
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ varchar(255) default '',
FORM_KEY_ varchar(255),
CLAIM_TIME_ timestamp,
APP_VERSION_ integer,
primary key (ID_)
);
......
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ int,
VAR_COUNT_ int,
ID_LINK_COUNT_ int,
APP_VERSION_ int,
primary key (ID_)
);
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ tinyint,
TENANT_ID_ nvarchar(255) default '',
ENGINE_VERSION_ nvarchar(255),
APP_VERSION_ int,
primary key (ID_)
);
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ nvarchar(255) default '',
FORM_KEY_ nvarchar(255),
CLAIM_TIME_ datetime,
APP_VERSION_ int,
primary key (ID_)
);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
insert into ACT_GE_PROPERTY
values ('schema.version', '7.0.0.0', 1);
values ('schema.version', '7.1.0-M6', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(7.0.0.0)', 1);
values ('schema.history', 'create(7.1.0-M6)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......@@ -32,7 +32,7 @@ create table ACT_RE_DEPLOYMENT (
TENANT_ID_ varchar(255) default '',
DEPLOY_TIME_ timestamp(3) NULL,
ENGINE_VERSION_ varchar(255),
VERSION_ integer,
VERSION_ integer default 1,
PROJECT_RELEASE_VERSION_ varchar(255),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ integer,
VAR_COUNT_ integer,
ID_LINK_COUNT_ integer,
APP_VERSION_ integer,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ integer,
TENANT_ID_ varchar(255) default '',
ENGINE_VERSION_ varchar(255),
APP_VERSION_ integer,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ varchar(255) default '',
FORM_KEY_ varchar(255),
CLAIM_TIME_ datetime(3),
APP_VERSION_ integer,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......
......@@ -32,7 +32,7 @@ create table ACT_RE_DEPLOYMENT (
TENANT_ID_ varchar(255) default '',
DEPLOY_TIME_ timestamp NULL,
ENGINE_VERSION_ varchar(255),
VERSION_ integer,
VERSION_ integer default 1,
PROJECT_RELEASE_VERSION_ varchar(255),
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ integer,
VAR_COUNT_ integer,
ID_LINK_COUNT_ integer,
APP_VERSION_ integer,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ integer,
TENANT_ID_ varchar(255) default '',
ENGINE_VERSION_ varchar(255),
APP_VERSION_ integer,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ varchar(255) default '',
FORM_KEY_ varchar(255),
CLAIM_TIME_ datetime,
APP_VERSION_ integer,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
......
......@@ -32,7 +32,7 @@ create table ACT_RE_DEPLOYMENT (
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
DEPLOY_TIME_ TIMESTAMP(6),
ENGINE_VERSION_ NVARCHAR2(255),
VERSION_ INTEGER,
VERSION_ INTEGER DEFAULT 1,
PROJECT_RELEASE_VERSION_ NVARCHAR2(255),
primary key (ID_)
);
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ INTEGER,
VAR_COUNT_ INTEGER,
ID_LINK_COUNT_ INTEGER,
APP_VERSION_ INTEGER,
primary key (ID_)
);
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ INTEGER,
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
ENGINE_VERSION_ NVARCHAR2(255),
APP_VERSION_ INTEGER,
primary key (ID_)
);
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ NVARCHAR2(255) DEFAULT '',
FORM_KEY_ NVARCHAR2(255),
CLAIM_TIME_ TIMESTAMP(6),
APP_VERSION_ INTEGER,
primary key (ID_)
);
......
......@@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY (
);
insert into ACT_GE_PROPERTY
values ('schema.version', '7.0.0.0', 1);
values ('schema.version', '7.1.0-M6', 1);
insert into ACT_GE_PROPERTY
values ('schema.history', 'create(7.0.0.0)', 1);
values ('schema.history', 'create(7.1.0-M6)', 1);
insert into ACT_GE_PROPERTY
values ('next.dbid', '1', 1);
......@@ -32,7 +32,7 @@ create table ACT_RE_DEPLOYMENT (
TENANT_ID_ varchar(255) default '',
DEPLOY_TIME_ timestamp,
ENGINE_VERSION_ varchar(255),
VERSION_ integer,
VERSION_ integer default 1,
PROJECT_RELEASE_VERSION_ varchar(255),
primary key (ID_)
);
......@@ -85,6 +85,7 @@ create table ACT_RU_EXECUTION (
DEADLETTER_JOB_COUNT_ integer,
VAR_COUNT_ integer,
ID_LINK_COUNT_ integer,
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -183,6 +184,7 @@ create table ACT_RE_PROCDEF (
SUSPENSION_STATE_ integer,
TENANT_ID_ varchar(255) default '',
ENGINE_VERSION_ varchar(255),
APP_VERSION_ integer,
primary key (ID_)
);
......@@ -207,6 +209,7 @@ create table ACT_RU_TASK (
TENANT_ID_ varchar(255) default '',
FORM_KEY_ varchar(255),
CLAIM_TIME_ timestamp,
APP_VERSION_ integer,
primary key (ID_)
);
......
......@@ -7,7 +7,7 @@
<!-- EXECUTION INSERT -->
<insert id="insertExecution" parameterType="org.activiti.engine.impl.persistence.entity.ExecutionEntityImpl">
insert into ${prefix}ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, IS_MI_ROOT_, PARENT_ID_, SUPER_EXEC_, ROOT_PROC_INST_ID_, SUSPENSION_STATE_, TENANT_ID_, NAME_, START_TIME_, START_USER_ID_, IS_COUNT_ENABLED_, EVT_SUBSCR_COUNT_, TASK_COUNT_, JOB_COUNT_, TIMER_JOB_COUNT_, SUSP_JOB_COUNT_, DEADLETTER_JOB_COUNT_, VAR_COUNT_, ID_LINK_COUNT_)
insert into ${prefix}ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, IS_MI_ROOT_, PARENT_ID_, SUPER_EXEC_, ROOT_PROC_INST_ID_, SUSPENSION_STATE_, TENANT_ID_, NAME_, START_TIME_, START_USER_ID_, IS_COUNT_ENABLED_, EVT_SUBSCR_COUNT_, TASK_COUNT_, JOB_COUNT_, TIMER_JOB_COUNT_, SUSP_JOB_COUNT_, DEADLETTER_JOB_COUNT_, VAR_COUNT_, ID_LINK_COUNT_, APP_VERSION_)
values (
#{id ,jdbcType=VARCHAR},
1,
......@@ -36,12 +36,13 @@
#{suspendedJobCount, jdbcType=INTEGER},
#{deadLetterJobCount, jdbcType=INTEGER},
#{variableCount, jdbcType=INTEGER},
#{identityLinkCount, jdbcType=INTEGER}
#{identityLinkCount, jdbcType=INTEGER},
#{appVersion, jdbcType=INTEGER}
)
</insert>
<insert id="bulkInsertExecution" parameterType="java.util.List">
insert into ${prefix}ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, IS_MI_ROOT_, PARENT_ID_, SUPER_EXEC_, ROOT_PROC_INST_ID_, SUSPENSION_STATE_, TENANT_ID_, NAME_, START_TIME_, START_USER_ID_, IS_COUNT_ENABLED_, EVT_SUBSCR_COUNT_, TASK_COUNT_, JOB_COUNT_, TIMER_JOB_COUNT_, SUSP_JOB_COUNT_, DEADLETTER_JOB_COUNT_, VAR_COUNT_, ID_LINK_COUNT_)
insert into ${prefix}ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, IS_MI_ROOT_, PARENT_ID_, SUPER_EXEC_, ROOT_PROC_INST_ID_, SUSPENSION_STATE_, TENANT_ID_, NAME_, START_TIME_, START_USER_ID_, IS_COUNT_ENABLED_, EVT_SUBSCR_COUNT_, TASK_COUNT_, JOB_COUNT_, TIMER_JOB_COUNT_, SUSP_JOB_COUNT_, DEADLETTER_JOB_COUNT_, VAR_COUNT_, ID_LINK_COUNT_, APP_VERSION_)
values
<foreach collection="list" item="execution" index="index" separator=",">
(#{execution.id ,jdbcType=VARCHAR},
......@@ -71,7 +72,8 @@
#{execution.suspendedJobCount, jdbcType=INTEGER},
#{execution.deadLetterJobCount, jdbcType=INTEGER},
#{execution.variableCount, jdbcType=INTEGER},
#{execution.identityLinkCount, jdbcType=INTEGER})
#{execution.identityLinkCount, jdbcType=INTEGER},
#{execution.appVersion, jdbcType=INTEGER})
</foreach>
</insert>
......@@ -138,7 +140,8 @@
SUSP_JOB_COUNT_ = #{suspendedJobCount, jdbcType=INTEGER},
DEADLETTER_JOB_COUNT_ = #{deadLetterJobCount, jdbcType=INTEGER},
VAR_COUNT_ = #{variableCount, jdbcType=INTEGER},
ID_LINK_COUNT_ = #{identityLinkCount, jdbcType=INTEGER}
ID_LINK_COUNT_ = #{identityLinkCount, jdbcType=INTEGER},
APP_VERSION_ = #{appVersion, jdbcType=INTEGER}
where ID_ = #{id, jdbcType=VARCHAR}
and REV_ = #{revision, jdbcType=INTEGER}
</update>
......@@ -240,6 +243,7 @@
<result property="deadLetterJobCount" column="DEADLETTER_JOB_COUNT_" jdbcType="INTEGER" />
<result property="variableCount" column="VAR_COUNT_" jdbcType="INTEGER" />
<result property="identityLinkCount" column="ID_LINK_COUNT_" jdbcType="INTEGER" />
<result property="appVersion" column="APP_VERSION_" jdbcType="INTEGER" />
<result property="parentProcessInstanceId" column="PARENT_PROC_INST_ID_" jdbcType="VARCHAR"/>
</resultMap>
......@@ -280,6 +284,7 @@
<result property="deadLetterJobCount" column="DEADLETTER_JOB_COUNT_" jdbcType="INTEGER" />
<result property="variableCount" column="VAR_COUNT_" jdbcType="INTEGER" />
<result property="identityLinkCount" column="ID_LINK_COUNT_" jdbcType="INTEGER" />
<result property="appVersion" column="APP_VERSION_" jdbcType="INTEGER" />
<result property="parentProcessInstanceId" column="PARENT_PROC_INST_ID_" jdbcType="VARCHAR"/>
</resultMap>
......@@ -364,6 +369,7 @@
<result property="deadLetterJobCount" column="DEADLETTER_JOB_COUNT_" jdbcType="INTEGER" />
<result property="variableCount" column="VAR_COUNT_" jdbcType="INTEGER" />
<result property="identityLinkCount" column="ID_LINK_COUNT_" jdbcType="INTEGER" />
<result property="appVersion" column="APP_VERSION_" jdbcType="INTEGER" />
<result property="parentProcessInstanceId" column="PARENT_PROC_INST_ID_" jdbcType="VARCHAR"/>
<collection property="queryVariables" column="EXECUTION_ID_" javaType="ArrayList" ofType="org.activiti.engine.impl.persistence.entity.VariableInstanceEntityImpl">
<id property="id" column="VAR_ID_"/>
......
......@@ -7,7 +7,7 @@
<!-- PROCESSDEFINITION INSERT -->
<insert id="insertProcessDefinition" parameterType="org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntityImpl">
insert into ${prefix}ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_ , SUSPENSION_STATE_, TENANT_ID_, ENGINE_VERSION_)
insert into ${prefix}ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_ , SUSPENSION_STATE_, TENANT_ID_, ENGINE_VERSION_, APP_VERSION_)
values (#{id, jdbcType=VARCHAR},
1,
#{category, jdbcType=VARCHAR},
......@@ -22,11 +22,12 @@
#{isGraphicalNotationDefined, jdbcType=BOOLEAN},
#{suspensionState, jdbcType=INTEGER},
#{tenantId, jdbcType=VARCHAR},
#{engineVersion, jdbcType=VARCHAR})
#{engineVersion, jdbcType=VARCHAR},
#{appVersion, jdbcType=INTEGER})
</insert>
<insert id="bulkInsertProcessDefinition" parameterType="java.util.List">
INSERT INTO ${prefix}ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_ , SUSPENSION_STATE_, TENANT_ID_, ENGINE_VERSION_)
INSERT INTO ${prefix}ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_ , SUSPENSION_STATE_, TENANT_ID_, ENGINE_VERSION_, APP_VERSION_)
VALUES
<foreach collection="list" item="processDefinition" index="index" separator=",">
(#{processDefinition.id, jdbcType=VARCHAR},
......@@ -43,7 +44,8 @@
#{processDefinition.isGraphicalNotationDefined, jdbcType=BOOLEAN},
#{processDefinition.suspensionState, jdbcType=INTEGER},
#{processDefinition.tenantId, jdbcType=VARCHAR},
#{processDefinition.engineVersion, jdbcType=VARCHAR})
#{processDefinition.engineVersion, jdbcType=VARCHAR},
#{processDefinition.appVersion, jdbcType=INTEGER})
</foreach>
</insert>
......@@ -117,6 +119,7 @@
<result property="isGraphicalNotationDefined" column="HAS_GRAPHICAL_NOTATION_" jdbcType="BOOLEAN" />
<result property="suspensionState" column="SUSPENSION_STATE_" jdbcType="INTEGER"/>
<result property="engineVersion" column="ENGINE_VERSION_" jdbcType="VARCHAR" />
<result property="appVersion" column="APP_VERSION_" jdbcType="INTEGER" />
</resultMap>
<!-- PROCESSDEFINITION SELECT -->
......
......@@ -23,7 +23,7 @@
<insert id="insertTask" parameterType="org.activiti.engine.impl.persistence.entity.TaskEntityImpl">
insert into ${prefix}ACT_RU_TASK (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_,
ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_)
ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_, APP_VERSION_)
values (#{id, jdbcType=VARCHAR},
1,
#{name, jdbcType=VARCHAR},
......@@ -43,13 +43,14 @@
#{suspensionState, jdbcType=INTEGER},
#{tenantId, jdbcType=VARCHAR},
#{formKey, jdbcType=VARCHAR},
#{claimTime, jdbcType=TIMESTAMP}
#{claimTime, jdbcType=TIMESTAMP},
#{appVersion, jdbcType=INTEGER}
)
</insert>
<insert id="bulkInsertTask" parameterType="java.util.List">
INSERT INTO ${prefix}ACT_RU_TASK (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_,
ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_)
ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_, APP_VERSION_)
VALUES
<foreach collection="list" item="task" index="index" separator=",">
(#{task.id, jdbcType=VARCHAR},
......@@ -71,7 +72,8 @@
#{task.suspensionState, jdbcType=INTEGER},
#{task.tenantId, jdbcType=VARCHAR},
#{task.formKey, jdbcType=VARCHAR},
#{task.claimTime, jdbcType=TIMESTAMP})
#{task.claimTime, jdbcType=TIMESTAMP},
#{task.appVersion, jdbcType=INTEGER})
</foreach>
</insert>
......@@ -80,7 +82,7 @@
<foreach collection="list" item="task" index="index">
INTO ${prefix}ACT_RU_TASK (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_,
ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_,
SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_) VALUES
SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_, CLAIM_TIME_, APP_VERSION_) VALUES
(#{task.id, jdbcType=VARCHAR},
1,
#{task.name, jdbcType=VARCHAR},
......@@ -100,7 +102,8 @@
#{task.suspensionState, jdbcType=INTEGER},
#{task.tenantId, jdbcType=VARCHAR},
#{task.formKey, jdbcType=VARCHAR},
#{task.claimTime, jdbcType=TIMESTAMP})
#{task.claimTime, jdbcType=TIMESTAMP},
#{task.appVersion, jdbcType=INTEGER})
</foreach>
SELECT * FROM dual
</insert>
......@@ -199,6 +202,7 @@
<result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR" />
<result property="formKey" column="FORM_KEY_" jdbcType="VARCHAR" />
<result property="claimTime" column="CLAIM_TIME_" jdbcType="TIMESTAMP" />
<result property="appVersion" column="APP_VERSION_" jdbcType="INTEGER" />
</resultMap>
<resultMap id="taskAndVariablesResultMap" type="org.activiti.engine.impl.persistence.entity.TaskEntityImpl">
......@@ -222,6 +226,7 @@
<result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR" />
<result property="formKey" column="FORM_KEY_" jdbcType="VARCHAR" />
<result property="claimTime" column="CLAIM_TIME_" jdbcType="TIMESTAMP" />
<result property="appVersion" column="APP_VERSION_" jdbcType="INTEGER" />
<collection property="queryVariables" column="TASK_ID_" javaType="ArrayList" ofType="org.activiti.engine.impl.persistence.entity.VariableInstanceEntityImpl">
<id property="id" column="VAR_ID_"/>
<result property="name" column="VAR_NAME_" javaType="String" jdbcType="VARCHAR" />
......
update ACT_GE_PROPERTY set VALUE_ = '7.1.0.0' where NAME_ = 'schema.version';
alter table ACT_RE_DEPLOYMENT add column VERSION_ integer set default 1;
alter table ACT_RE_DEPLOYMENT add column PROJECT_RELEASE_VERSION_ varchar(255);
update ACT_GE_PROPERTY set VALUE_ = '7.1.0-M6' where NAME_ = 'schema.version';
alter table ACT_RE_PROCDEF add column APP_VERSION_ integer;
alter table ACT_RU_TASK add column APP_VERSION_ integer;
alter table ACT_RU_EXECUTION add column APP_VERSION_ integer;
update ACT_GE_PROPERTY set VALUE_ = '7.1.0.0' where NAME_ = 'schema.version';
alter table ACT_RE_DEPLOYMENT add column VERSION_ integer;
alter table ACT_RE_DEPLOYMENT add column VERSION_ integer set default 1;
alter table ACT_RE_DEPLOYMENT add column PROJECT_RELEASE_VERSION_ varchar(255);
......
update ACT_GE_PROPERTY set VALUE_ = '7.1.0-M6' where NAME_ = 'schema.version';
alter table ACT_RE_PROCDEF add column APP_VERSION_ integer;
alter table ACT_RU_TASK add column APP_VERSION_ integer;
alter table ACT_RU_EXECUTION add column APP_VERSION_ integer;
......@@ -47,7 +47,7 @@ public class ManagementServiceTest extends PluggableActivitiTestCase {
TableMetaData tableMetaData = managementService.getTableMetaData(tablePrefix+"ACT_RU_TASK");
assertEquals(tableMetaData.getColumnNames().size(), tableMetaData.getColumnTypes().size());
assertEquals(20, tableMetaData.getColumnNames().size());
assertEquals(21, tableMetaData.getColumnNames().size());
int assigneeIndex = tableMetaData.getColumnNames().indexOf("ASSIGNEE_");
int createTimeIndex = tableMetaData.getColumnNames().indexOf("CREATE_TIME_");
......
package org.activiti.spring.boot.process;
import java.util.List;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.mockito.Mockito.spy;
......@@ -659,4 +662,33 @@ public class ProcessRuntimeIT {
processAdminRuntimeMock.delete(ProcessPayloadBuilder.delete(processInstancePage.getContent().get(0).getId()));
}
@Test
public void should_processInstanceAlwaysHaveAppVersion(){
securityUtil.logInAs("user");
ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder.start()
.withProcessDefinitionKey(SUPER_PROCESS)
.build());
assertThat(processInstance.getAppVersion()).isEqualTo("1");
}
@Test
public void should_processDefinitionAlwaysHaveAppVersion(){
securityUtil.logInAs("user");
Page<ProcessDefinition> processDefinitionPage = processRuntime.processDefinitions(Pageable.of(0,
50));
assertThat(processDefinitionPage.getContent()).isNotEmpty();
List<ProcessDefinition> processDefinitions = processDefinitionPage.getContent().stream()
.filter(c -> c.getKey().equals(SUPER_PROCESS))
.collect(Collectors.toList());
assertThat(processDefinitions).hasSize(1);
ProcessDefinition result = processDefinitions.get(0);
assertThat(result.getAppVersion()).isEqualTo("1");
}
}
package org.activiti.spring.boot.process;
import org.activiti.api.process.model.ProcessInstance;
import org.activiti.api.process.model.builders.ProcessPayloadBuilder;
import org.activiti.api.process.runtime.ProcessRuntime;
import org.activiti.api.runtime.shared.query.Page;
import org.activiti.api.runtime.shared.query.Pageable;
import org.activiti.api.task.model.Task;
import org.activiti.api.task.model.builders.TaskPayloadBuilder;
import org.activiti.api.task.runtime.TaskRuntime;
import org.activiti.spring.boot.security.util.SecurityUtil;
import org.activiti.spring.boot.test.util.ProcessCleanUpUtil;
import org.activiti.spring.boot.test.util.TaskCleanUpUtil;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
public class ProcessRuntimeTasksIT {
private static final String SINGLE_TASK_PROCESS = "SingleTaskProcess";
@Autowired
private ProcessRuntime processRuntime;
@Autowired
private TaskRuntime taskRuntime;
@Autowired
private SecurityUtil securityUtil;
@Autowired
private ProcessCleanUpUtil processCleanUpUtil;
@Autowired
private TaskCleanUpUtil taskCleanUpUtil;
@After
public void cleanUp() {
processCleanUpUtil.cleanUpWithAdmin();
taskCleanUpUtil.cleanUpWithAdmin();
}
@Test
public void should_taskAlwaysHaveAppVersion() {
securityUtil.logInAs("garth");
ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder.start()
.withProcessDefinitionKey(SINGLE_TASK_PROCESS)
.build());
Page<Task> tasks = taskRuntime.tasks(Pageable.of(0, 50),
TaskPayloadBuilder
.tasks()
.withProcessInstanceId(processInstance.getId())
.build());
assertThat(tasks.getContent()).hasSize(1);
Task result = tasks.getContent().get(0);
assertThat(result.getName()).isEqualTo("my-task");
assertThat(result.getAppVersion()).isEqualTo("1");
}
}
package org.activiti.spring.boot.tasks;
import org.activiti.api.runtime.shared.query.Page;
import org.activiti.api.runtime.shared.query.Pageable;
import org.activiti.api.task.model.Task;
import org.activiti.api.task.model.builders.TaskPayloadBuilder;
import org.activiti.api.task.runtime.TaskRuntime;
import org.activiti.spring.boot.security.util.SecurityUtil;
import org.activiti.spring.boot.test.util.TaskCleanUpUtil;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
public class TaskRuntimeAppVersionIT {
@Autowired
private TaskRuntime taskRuntime;
@Autowired
private SecurityUtil securityUtil;
@Autowired
private TaskCleanUpUtil taskCleanUpUtil;
@After
public void taskCleanUp() {
taskCleanUpUtil.cleanUpWithAdmin();
}
@Test
public void should_standaloneTaskAlwaysHaveAppVersion() {
securityUtil.logInAs("user");
taskRuntime.create(TaskPayloadBuilder.create()
.withName("new task")
.build());
Page<Task> tasks = taskRuntime.tasks(Pageable.of(0, 50));
assertThat(tasks.getContent()).hasSize(1);
Task result = tasks.getContent().get(0);
assertThat(result.getName()).isEqualTo("new task");
assertThat(result.getAppVersion()).isEqualTo("1");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册