Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
071acf3c
F
Flowable Engine
项目概览
开发团队
/
Flowable Engine
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flowable Engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
071acf3c
编写于
1月 15, 2014
作者:
J
Joram Barrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ACT-1890: Multi tenancy support: historic entities
上级
a99b225c
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
390 addition
and
19 deletion
+390
-19
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricActivityInstance.java
...org/activiti/engine/history/HistoricActivityInstance.java
+3
-0
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricActivityInstanceQuery.java
...ctiviti/engine/history/HistoricActivityInstanceQuery.java
+15
-0
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricProcessInstance.java
.../org/activiti/engine/history/HistoricProcessInstance.java
+5
-0
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricProcessInstanceQuery.java
...activiti/engine/history/HistoricProcessInstanceQuery.java
+12
-0
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricTaskInstance.java
...ava/org/activiti/engine/history/HistoricTaskInstance.java
+3
-0
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricTaskInstanceQuery.java
...rg/activiti/engine/history/HistoricTaskInstanceQuery.java
+15
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricActivityInstanceQueryImpl.java
...tiviti/engine/impl/HistoricActivityInstanceQueryImpl.java
+31
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricActivityInstanceQueryProperty.java
...ti/engine/impl/HistoricActivityInstanceQueryProperty.java
+1
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricProcessInstanceQueryImpl.java
...ctiviti/engine/impl/HistoricProcessInstanceQueryImpl.java
+28
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricProcessInstanceQueryProperty.java
...iti/engine/impl/HistoricProcessInstanceQueryProperty.java
+1
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java
...g/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java
+30
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryProperty.java
...tiviti/engine/impl/HistoricTaskInstanceQueryProperty.java
+1
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/history/DefaultHistoryManager.java
...g/activiti/engine/impl/history/DefaultHistoryManager.java
+11
-4
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/HistoricActivityInstanceEntity.java
...pl/persistence/entity/HistoricActivityInstanceEntity.java
+12
-2
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/HistoricProcessInstanceEntity.java
...mpl/persistence/entity/HistoricProcessInstanceEntity.java
+16
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/HistoricTaskInstanceEntity.java
...e/impl/persistence/entity/HistoricTaskInstanceEntity.java
+14
-1
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.db2.create.history.sql
...es/org/activiti/db/create/activiti.db2.create.history.sql
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.h2.create.history.sql
...ces/org/activiti/db/create/activiti.h2.create.history.sql
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mssql.create.history.sql
.../org/activiti/db/create/activiti.mssql.create.history.sql
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mysql.create.history.sql
.../org/activiti/db/create/activiti.mysql.create.history.sql
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mysql55.create.history.sql
...rg/activiti/db/create/activiti.mysql55.create.history.sql
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.oracle.create.history.sql
...org/activiti/db/create/activiti.oracle.create.history.sql
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.postgres.create.history.sql
...g/activiti/db/create/activiti.postgres.create.history.sql
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricActivityInstance.xml
...g/activiti/db/mapping/entity/HistoricActivityInstance.xml
+14
-2
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricProcessInstance.xml
...rg/activiti/db/mapping/entity/HistoricProcessInstance.xml
+15
-2
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricTaskInstance.xml
...s/org/activiti/db/mapping/entity/HistoricTaskInstance.xml
+15
-2
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.db2.upgradestep.514.to.515.history.sql
...b/upgrade/activiti.db2.upgradestep.514.to.515.history.sql
+17
-1
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.h2.upgradestep.514.to.515.history.sql
...db/upgrade/activiti.h2.upgradestep.514.to.515.history.sql
+10
-1
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.mssql.upgradestep.514.to.515.history.sql
...upgrade/activiti.mssql.upgradestep.514.to.515.history.sql
+9
-0
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.mysql.upgradestep.514.to.515.history.sql
...upgrade/activiti.mysql.upgradestep.514.to.515.history.sql
+9
-0
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.mysql55.upgradestep.514.to.515.history.sql
...grade/activiti.mysql55.upgradestep.514.to.515.history.sql
+10
-1
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.oracle.upgradestep.514.to.515.history.sql
...pgrade/activiti.oracle.upgradestep.514.to.515.history.sql
+10
-1
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.postgres.upgradestep.514.to.515.history.sql
...rade/activiti.postgres.upgradestep.514.to.515.history.sql
+10
-1
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/tenant/TenancyTest.java
...java/org/activiti/engine/test/api/tenant/TenancyTest.java
+52
-0
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricActivityInstance.java
浏览文件 @
071acf3c
...
...
@@ -61,4 +61,7 @@ public interface HistoricActivityInstance {
/** Difference between {@link #getEndTime()} and {@link #getStartTime()}. */
Long
getDurationInMillis
();
/** Returns the tenant identifier for the historic activity */
String
getTenantId
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricActivityInstanceQuery.java
浏览文件 @
071acf3c
...
...
@@ -20,6 +20,7 @@ import org.activiti.engine.query.Query;
* Programmatic querying for {@link HistoricActivityInstance}s.
*
* @author Tom Baeyens
* @author Joram Barrez
*/
public
interface
HistoricActivityInstanceQuery
extends
Query
<
HistoricActivityInstanceQuery
,
HistoricActivityInstance
>{
...
...
@@ -53,6 +54,16 @@ public interface HistoricActivityInstanceQuery extends Query<HistoricActivityIns
/** Only select historic activity instances that are not finished yet. */
HistoricActivityInstanceQuery
unfinished
();
/** Only select historic activity instances that have the given tenant id. */
HistoricActivityInstanceQuery
activityTenantId
(
String
tenantId
);
/** Only select historic activity instances with a tenant id like the given one. */
HistoricActivityInstanceQuery
activityTenantIdLike
(
String
tenantIdLike
);
/** Only select historic activity instances that do not have a tenant id. */
HistoricActivityInstanceQuery
activityWithoutTenantId
();
// ordering /////////////////////////////////////////////////////////////////
/** Order by id (needs to be followed by {@link #asc()} or {@link #desc()}). */
...
...
@@ -84,4 +95,8 @@ public interface HistoricActivityInstanceQuery extends Query<HistoricActivityIns
/** Order by processDefinitionId (needs to be followed by {@link #asc()} or {@link #desc()}). */
HistoricActivityInstanceQuery
orderByProcessDefinitionId
();
/** Order by tenant id (needs to be followed by {@link #asc()} or {@link #desc()}). */
HistoricActivityInstanceQuery
orderByTenantId
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricProcessInstance.java
浏览文件 @
071acf3c
...
...
@@ -67,6 +67,11 @@ public interface HistoricProcessInstance {
*/
String
getSuperProcessInstanceId
();
/**
* The tenant identifier for the process instance.
*/
String
getTenantId
();
/** Returns the process variables if requested in the process instance query */
Map
<
String
,
Object
>
getProcessVariables
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricProcessInstanceQuery.java
浏览文件 @
071acf3c
...
...
@@ -157,6 +157,15 @@ public interface HistoricProcessInstanceQuery extends Query<HistoricProcessInsta
/** Only select historic process instance that are started by the given user. */
HistoricProcessInstanceQuery
startedBy
(
String
userId
);
/** Only select process instances that have the given tenant id. */
HistoricProcessInstanceQuery
processInstanceTenantId
(
String
tenantId
);
/** Only select process instances with a tenant id like the given one. */
HistoricProcessInstanceQuery
processInstanceTenantIdLike
(
String
tenantIdLike
);
/** Only select process instances that do not have a tenant id. */
HistoricProcessInstanceQuery
processInstanceWithoutTenantId
();
/** Order by the process instance id (needs to be followed by {@link #asc()} or {@link #desc()}). */
HistoricProcessInstanceQuery
orderByProcessInstanceId
();
...
...
@@ -176,6 +185,9 @@ public interface HistoricProcessInstanceQuery extends Query<HistoricProcessInsta
/** Order by the duration of the process instance (needs to be followed by {@link #asc()} or {@link #desc()}). */
HistoricProcessInstanceQuery
orderByProcessInstanceDuration
();
/** Order by tenant id (needs to be followed by {@link #asc()} or {@link #desc()}). */
HistoricProcessInstanceQuery
orderByTenantId
();
/** Only select historic process instances started by the given process
* instance. {@link ProcessInstance) ids and {@link HistoricProcessInstance}
* ids match. */
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricTaskInstance.java
浏览文件 @
071acf3c
...
...
@@ -87,6 +87,9 @@ public interface HistoricTaskInstance {
/** The parent task of this task, in case this task was a subtask */
String
getParentTaskId
();
/** Returns the tenant identifier for this historic task */
String
getTenantId
();
/** Returns the local task variables if requested in the task query */
Map
<
String
,
Object
>
getTaskLocalVariables
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricTaskInstanceQuery.java
浏览文件 @
071acf3c
...
...
@@ -17,6 +17,7 @@ import java.io.Serializable;
import
java.util.Date
;
import
java.util.List
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.query.Query
;
import
org.activiti.engine.task.Task
;
...
...
@@ -25,6 +26,7 @@ import org.activiti.engine.task.Task;
* Allows programmatic querying for {@link HistoricTaskInstance}s.
*
* @author Tom Baeyens
* @author Joram Barrez
*/
public
interface
HistoricTaskInstanceQuery
extends
Query
<
HistoricTaskInstanceQuery
,
HistoricTaskInstance
>
{
...
...
@@ -419,6 +421,15 @@ public interface HistoricTaskInstanceQuery extends Query<HistoricTaskInstanceQu
* (string%), ends with (%string) or contains (%string%). */
HistoricTaskInstanceQuery
processVariableValueLike
(
String
name
,
String
value
);
/** Only select tasks that have the given tenant id. */
HistoricTaskInstanceQuery
taskTenantId
(
String
tenantId
);
/** Only select tasks with a tenant id like the given one. */
HistoricTaskInstanceQuery
taskTenantIdLike
(
String
tenantIdLike
);
/** Only select tasks that do not have a tenant id. */
HistoricTaskInstanceQuery
taskWithoutTenantId
();
/**
* Include local task variables in the task query result
*/
...
...
@@ -484,4 +495,8 @@ public interface HistoricTaskInstanceQuery extends Query<HistoricTaskInstanceQu
/** Order by task priority key (needs to be followed by {@link #asc()} or {@link #desc()}). */
HistoricTaskInstanceQuery
orderByTaskPriority
();
/** Order by tenant id (needs to be followed by {@link #asc()} or {@link #desc()}). */
HistoricTaskInstanceQuery
orderByTenantId
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricActivityInstanceQueryImpl.java
浏览文件 @
071acf3c
...
...
@@ -15,6 +15,7 @@ package org.activiti.engine.impl;
import
java.util.List
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.history.HistoricActivityInstance
;
import
org.activiti.engine.history.HistoricActivityInstanceQuery
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
...
...
@@ -36,6 +37,9 @@ public class HistoricActivityInstanceQueryImpl extends AbstractQuery<HistoricAct
protected
String
activityName
;
protected
String
activityType
;
protected
String
assignee
;
protected
String
tenantId
;
protected
String
tenantIdLike
;
protected
boolean
withoutTenantId
;
protected
boolean
finished
;
protected
boolean
unfinished
;
...
...
@@ -110,6 +114,28 @@ public class HistoricActivityInstanceQueryImpl extends AbstractQuery<HistoricAct
this
.
unfinished
=
true
;
return
this
;
}
public
HistoricActivityInstanceQueryImpl
activityTenantId
(
String
tenantId
)
{
if
(
tenantId
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"activity tenant id is null"
);
}
this
.
tenantId
=
tenantId
;
return
this
;
}
public
HistoricActivityInstanceQueryImpl
activityTenantIdLike
(
String
tenantIdLike
)
{
if
(
tenantIdLike
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"activity tenant id is null"
);
}
this
.
tenantIdLike
=
tenantIdLike
;
return
this
;
}
public
HistoricActivityInstanceQueryImpl
activityWithoutTenantId
()
{
this
.
withoutTenantId
=
true
;
return
this
;
}
// ordering /////////////////////////////////////////////////////////////////
...
...
@@ -162,6 +188,11 @@ public class HistoricActivityInstanceQueryImpl extends AbstractQuery<HistoricAct
orderBy
(
HistoricActivityInstanceQueryProperty
.
ACTIVITY_TYPE
);
return
this
;
}
public
HistoricActivityInstanceQueryImpl
orderByTenantId
()
{
orderBy
(
HistoricActivityInstanceQueryProperty
.
TENANT_ID
);
return
this
;
}
public
HistoricActivityInstanceQueryImpl
activityInstanceId
(
String
activityInstanceId
)
{
this
.
activityInstanceId
=
activityInstanceId
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricActivityInstanceQueryProperty.java
浏览文件 @
071acf3c
...
...
@@ -41,6 +41,7 @@ public class HistoricActivityInstanceQueryProperty implements QueryProperty {
public
static
final
HistoricActivityInstanceQueryProperty
START
=
new
HistoricActivityInstanceQueryProperty
(
"START_TIME_"
);
public
static
final
HistoricActivityInstanceQueryProperty
END
=
new
HistoricActivityInstanceQueryProperty
(
"END_TIME_"
);
public
static
final
HistoricActivityInstanceQueryProperty
DURATION
=
new
HistoricActivityInstanceQueryProperty
(
"DURATION_"
);
public
static
final
HistoricActivityInstanceQueryProperty
TENANT_ID
=
new
HistoricActivityInstanceQueryProperty
(
"TENANT_ID_"
);
private
String
name
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricProcessInstanceQueryImpl.java
浏览文件 @
071acf3c
...
...
@@ -50,6 +50,9 @@ public class HistoricProcessInstanceQueryImpl extends AbstractVariableQueryImpl<
protected
Set
<
String
>
processInstanceIds
;
protected
String
involvedUser
;
protected
boolean
includeProcessVariables
;
protected
String
tenantId
;
protected
String
tenantIdLike
;
protected
boolean
withoutTenantId
;
public
HistoricProcessInstanceQueryImpl
()
{
}
...
...
@@ -156,6 +159,27 @@ public class HistoricProcessInstanceQueryImpl extends AbstractVariableQueryImpl<
return
this
;
}
public
HistoricProcessInstanceQuery
processInstanceTenantId
(
String
tenantId
)
{
if
(
tenantId
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"process instance tenant id is null"
);
}
this
.
tenantId
=
tenantId
;
return
this
;
}
public
HistoricProcessInstanceQuery
processInstanceTenantIdLike
(
String
tenantIdLike
)
{
if
(
tenantIdLike
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"process instance tenant id is null"
);
}
this
.
tenantIdLike
=
tenantIdLike
;
return
this
;
}
public
HistoricProcessInstanceQuery
processInstanceWithoutTenantId
()
{
this
.
withoutTenantId
=
true
;
return
this
;
}
public
HistoricProcessInstanceQuery
orderByProcessInstanceBusinessKey
()
{
return
orderBy
(
HistoricProcessInstanceQueryProperty
.
BUSINESS_KEY
);
}
...
...
@@ -180,6 +204,10 @@ public class HistoricProcessInstanceQueryImpl extends AbstractVariableQueryImpl<
return
orderBy
(
HistoricProcessInstanceQueryProperty
.
PROCESS_INSTANCE_ID_
);
}
public
HistoricProcessInstanceQuery
orderByTenantId
()
{
return
orderBy
(
HistoricProcessInstanceQueryProperty
.
TENANT_ID
);
}
public
String
getMssqlOrDB2OrderBy
()
{
String
specialOrderBy
=
super
.
getOrderBy
();
if
(
specialOrderBy
!=
null
&&
specialOrderBy
.
length
()
>
0
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricProcessInstanceQueryProperty.java
浏览文件 @
071acf3c
...
...
@@ -36,6 +36,7 @@ public class HistoricProcessInstanceQueryProperty implements QueryProperty {
public
static
final
HistoricProcessInstanceQueryProperty
START_TIME
=
new
HistoricProcessInstanceQueryProperty
(
"RES.START_TIME_"
);
public
static
final
HistoricProcessInstanceQueryProperty
END_TIME
=
new
HistoricProcessInstanceQueryProperty
(
"RES.END_TIME_"
);
public
static
final
HistoricProcessInstanceQueryProperty
DURATION
=
new
HistoricProcessInstanceQueryProperty
(
"RES.DURATION_"
);
public
static
final
HistoricProcessInstanceQueryProperty
TENANT_ID
=
new
HistoricProcessInstanceQueryProperty
(
"RES.TENANT_ID_"
);
private
String
name
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java
浏览文件 @
071acf3c
...
...
@@ -78,6 +78,9 @@ public class HistoricTaskInstanceQueryImpl extends AbstractVariableQueryImpl<His
protected
Date
completedAfterDate
;
protected
Date
completedBeforeDate
;
protected
String
category
;
protected
String
tenantId
;
protected
String
tenantIdLike
;
protected
boolean
withoutTenantId
;
protected
boolean
includeTaskLocalVariables
=
false
;
protected
boolean
includeProcessVariables
=
false
;
...
...
@@ -457,6 +460,28 @@ public class HistoricTaskInstanceQueryImpl extends AbstractVariableQueryImpl<His
return
this
;
}
public
HistoricTaskInstanceQuery
taskTenantId
(
String
tenantId
)
{
if
(
tenantId
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"task tenant id is null"
);
}
this
.
tenantId
=
tenantId
;
return
this
;
}
public
HistoricTaskInstanceQuery
taskTenantIdLike
(
String
tenantIdLike
)
{
if
(
tenantIdLike
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"task tenant id is null"
);
}
this
.
tenantIdLike
=
tenantIdLike
;
return
this
;
}
public
HistoricTaskInstanceQuery
taskWithoutTenantId
()
{
this
.
withoutTenantId
=
true
;
return
this
;
}
public
HistoricTaskInstanceQuery
includeTaskLocalVariables
()
{
this
.
includeTaskLocalVariables
=
true
;
return
this
;
...
...
@@ -555,6 +580,11 @@ public class HistoricTaskInstanceQueryImpl extends AbstractVariableQueryImpl<His
return
this
;
}
public
HistoricTaskInstanceQuery
orderByTenantId
()
{
orderBy
(
HistoricTaskInstanceQueryProperty
.
TENANT_ID_
);
return
this
;
}
public
String
getMssqlOrDB2OrderBy
()
{
String
specialOrderBy
=
super
.
getOrderBy
();
if
(
specialOrderBy
!=
null
&&
specialOrderBy
.
length
()
>
0
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryProperty.java
浏览文件 @
071acf3c
...
...
@@ -43,6 +43,7 @@ public class HistoricTaskInstanceQueryProperty implements QueryProperty {
public
static
final
HistoricTaskInstanceQueryProperty
DURATION
=
new
HistoricTaskInstanceQueryProperty
(
"RES.DURATION_"
);
public
static
final
HistoricTaskInstanceQueryProperty
TASK_PRIORITY
=
new
HistoricTaskInstanceQueryProperty
(
"RES.PRIORITY_"
);
public
static
final
HistoricTaskInstanceQueryProperty
TASK_DUE_DATE
=
new
HistoricTaskInstanceQueryProperty
(
"RES.DUE_DATE_"
);
public
static
final
HistoricTaskInstanceQueryProperty
TENANT_ID_
=
new
HistoricTaskInstanceQueryProperty
(
"RES.TENANT_ID_"
);
private
String
name
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/history/DefaultHistoryManager.java
浏览文件 @
071acf3c
...
...
@@ -21,7 +21,6 @@ import org.activiti.engine.history.HistoricActivityInstance;
import
org.activiti.engine.impl.HistoricActivityInstanceQueryImpl
;
import
org.activiti.engine.impl.cfg.IdGenerator
;
import
org.activiti.engine.impl.context.Context
;
import
org.activiti.engine.impl.db.DbSqlSession
;
import
org.activiti.engine.impl.form.TaskFormHandler
;
import
org.activiti.engine.impl.identity.Authentication
;
import
org.activiti.engine.impl.persistence.AbstractManager
;
...
...
@@ -42,7 +41,6 @@ import org.activiti.engine.impl.pvm.process.ActivityImpl;
import
org.activiti.engine.impl.pvm.runtime.InterpretableExecution
;
import
org.activiti.engine.impl.util.ClockUtil
;
import
org.activiti.engine.task.Event
;
import
org.activiti.engine.task.IdentityLink
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -133,8 +131,12 @@ public void recordProcessInstanceStart(ExecutionEntity processInstance) {
Date
now
=
ClockUtil
.
getCurrentTime
();
historicActivityInstance
.
setStartTime
(
now
);
getDbSqlSession
()
.
insert
(
historicActivityInstance
);
// Inherit tenant id (if applicable)
if
(
processInstance
.
getTenantId
()
!=
null
)
{
historicActivityInstance
.
setTenantId
(
processInstance
.
getTenantId
());
}
getDbSqlSession
().
insert
(
historicActivityInstance
);
}
}
...
...
@@ -206,6 +208,11 @@ public void recordActivityStart(ExecutionEntity executionEntity) {
historicActivityInstance
.
setActivityType
((
String
)
executionEntity
.
getActivity
().
getProperty
(
"type"
));
historicActivityInstance
.
setStartTime
(
ClockUtil
.
getCurrentTime
());
// Inherit tenant id (if applicable)
if
(
executionEntity
.
getTenantId
()
!=
null
)
{
historicActivityInstance
.
setTenantId
(
executionEntity
.
getTenantId
());
}
getDbSqlSession
().
insert
(
historicActivityInstance
);
}
}
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/HistoricActivityInstanceEntity.java
浏览文件 @
071acf3c
...
...
@@ -21,6 +21,7 @@ import org.activiti.engine.history.HistoricActivityInstance;
/**
* @author Christian Stettler
* @author Joram Barrez
*/
public
class
HistoricActivityInstanceEntity
extends
HistoricScopeInstanceEntity
implements
HistoricActivityInstance
{
...
...
@@ -33,6 +34,7 @@ public class HistoricActivityInstanceEntity extends HistoricScopeInstanceEntity
protected
String
assignee
;
protected
String
taskId
;
protected
String
calledProcessInstanceId
;
protected
String
tenantId
;
public
Object
getPersistentState
()
{
Map
<
String
,
Object
>
persistentState
=
(
Map
<
String
,
Object
>)
new
HashMap
<
String
,
Object
>();
...
...
@@ -95,9 +97,17 @@ public class HistoricActivityInstanceEntity extends HistoricScopeInstanceEntity
this
.
calledProcessInstanceId
=
calledProcessInstanceId
;
}
// common methods //////////////////////////////////////////////////////////
public
String
getTenantId
()
{
return
tenantId
;
}
@Override
public
void
setTenantId
(
String
tenantId
)
{
this
.
tenantId
=
tenantId
;
}
// common methods //////////////////////////////////////////////////////////
@Override
public
String
toString
()
{
return
"HistoricActivityInstanceEntity[activityId="
+
activityId
+
", activityName="
+
activityName
+
"]"
;
}
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/HistoricProcessInstanceEntity.java
浏览文件 @
071acf3c
...
...
@@ -26,6 +26,7 @@ import org.activiti.engine.impl.util.ClockUtil;
/**
* @author Tom Baeyens
* @author Christian Stettler
* @author Joram Barrez
*/
public
class
HistoricProcessInstanceEntity
extends
HistoricScopeInstanceEntity
implements
HistoricProcessInstance
{
...
...
@@ -36,6 +37,7 @@ public class HistoricProcessInstanceEntity extends HistoricScopeInstanceEntity i
protected
String
startUserId
;
protected
String
startActivityId
;
protected
String
superProcessInstanceId
;
protected
String
tenantId
;
protected
List
<
HistoricVariableInstanceEntity
>
queryVariables
;
public
HistoricProcessInstanceEntity
()
{
...
...
@@ -50,6 +52,11 @@ public class HistoricProcessInstanceEntity extends HistoricScopeInstanceEntity i
startUserId
=
Authentication
.
getAuthenticatedUserId
();
startActivityId
=
processInstance
.
getActivityId
();
superProcessInstanceId
=
processInstance
.
getSuperExecution
()
!=
null
?
processInstance
.
getSuperExecution
().
getProcessInstanceId
()
:
null
;
// Inherit tenant id (if applicable)
if
(
processInstance
.
getTenantId
()
!=
null
)
{
tenantId
=
processInstance
.
getTenantId
();
}
}
...
...
@@ -103,7 +110,15 @@ public class HistoricProcessInstanceEntity extends HistoricScopeInstanceEntity i
this
.
superProcessInstanceId
=
superProcessInstanceId
;
}
public
Map
<
String
,
Object
>
getProcessVariables
()
{
public
String
getTenantId
()
{
return
tenantId
;
}
public
void
setTenantId
(
String
tenantId
)
{
this
.
tenantId
=
tenantId
;
}
public
Map
<
String
,
Object
>
getProcessVariables
()
{
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
if
(
queryVariables
!=
null
)
{
for
(
HistoricVariableInstanceEntity
variableInstance:
queryVariables
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/HistoricTaskInstanceEntity.java
浏览文件 @
071acf3c
...
...
@@ -26,6 +26,7 @@ import org.activiti.engine.impl.util.ClockUtil;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public
class
HistoricTaskInstanceEntity
extends
HistoricScopeInstanceEntity
implements
HistoricTaskInstance
,
PersistentObject
{
...
...
@@ -43,6 +44,7 @@ public class HistoricTaskInstanceEntity extends HistoricScopeInstanceEntity impl
protected
Date
dueDate
;
protected
Date
claimTime
;
protected
String
category
;
protected
String
tenantId
;
protected
List
<
HistoricVariableInstanceEntity
>
queryVariables
;
public
HistoricTaskInstanceEntity
()
{
...
...
@@ -65,6 +67,11 @@ public class HistoricTaskInstanceEntity extends HistoricScopeInstanceEntity impl
this
.
setPriority
(
task
.
getPriority
());
this
.
setDueDate
(
task
.
getDueDate
());
// Inherit tenant id (if applicable)
if
(
task
.
getTenantId
()
!=
null
)
{
tenantId
=
task
.
getTenantId
();
}
}
// persistence //////////////////////////////////////////////////////////////
...
...
@@ -167,7 +174,13 @@ public class HistoricTaskInstanceEntity extends HistoricScopeInstanceEntity impl
public
void
setClaimTime
(
Date
claimTime
)
{
this
.
claimTime
=
claimTime
;
}
public
Long
getWorkTimeInMillis
()
{
public
String
getTenantId
()
{
return
tenantId
;
}
public
void
setTenantId
(
String
tenantId
)
{
this
.
tenantId
=
tenantId
;
}
public
Long
getWorkTimeInMillis
()
{
if
(
endTime
==
null
||
claimTime
==
null
)
{
return
null
;
}
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.db2.create.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,6 +11,7 @@ create table ACT_HI_PROCINST (
END_ACT_ID_
varchar
(
255
),
SUPER_PROCESS_INSTANCE_ID_
varchar
(
64
),
DELETE_REASON_
varchar
(
4000
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -31,6 +32,7 @@ create table ACT_HI_ACTINST (
START_TIME_
timestamp
not
null
,
END_TIME_
timestamp
,
DURATION_
bigint
,
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -54,6 +56,7 @@ create table ACT_HI_TASKINST (
DUE_DATE_
timestamp
,
FORM_KEY_
varchar
(
255
),
CATEGORY_
varchar
(
255
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.h2.create.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,6 +11,7 @@ create table ACT_HI_PROCINST (
END_ACT_ID_
varchar
(
255
),
SUPER_PROCESS_INSTANCE_ID_
varchar
(
64
),
DELETE_REASON_
varchar
(
4000
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
),
unique
(
PROC_INST_ID_
)
);
...
...
@@ -29,6 +30,7 @@ create table ACT_HI_ACTINST (
START_TIME_
timestamp
not
null
,
END_TIME_
timestamp
,
DURATION_
bigint
,
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -52,6 +54,7 @@ create table ACT_HI_TASKINST (
DUE_DATE_
timestamp
,
FORM_KEY_
varchar
(
255
),
CATEGORY_
varchar
(
255
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mssql.create.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,6 +11,7 @@ create table ACT_HI_PROCINST (
END_ACT_ID_
nvarchar
(
255
),
SUPER_PROCESS_INSTANCE_ID_
nvarchar
(
64
),
DELETE_REASON_
nvarchar
(
4000
),
TENANT_ID_
nvarchar
(
255
),
primary
key
(
ID_
),
unique
(
PROC_INST_ID_
)
);
...
...
@@ -29,6 +30,7 @@ create table ACT_HI_ACTINST (
START_TIME_
datetime
not
null
,
END_TIME_
datetime
,
DURATION_
numeric
(
19
,
0
),
TENANT_ID_
nvarchar
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -52,6 +54,7 @@ create table ACT_HI_TASKINST (
DUE_DATE_
datetime
,
FORM_KEY_
nvarchar
(
255
),
CATEGORY_
nvarchar
(
255
),
TENANT_ID_
nvarchar
(
255
),
primary
key
(
ID_
)
);
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mysql.create.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,6 +11,7 @@ create table ACT_HI_PROCINST (
END_ACT_ID_
varchar
(
255
),
SUPER_PROCESS_INSTANCE_ID_
varchar
(
64
),
DELETE_REASON_
varchar
(
4000
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
),
unique
(
PROC_INST_ID_
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
utf8_bin
;
...
...
@@ -29,6 +30,7 @@ create table ACT_HI_ACTINST (
START_TIME_
datetime
(
3
)
not
null
,
END_TIME_
datetime
(
3
),
DURATION_
bigint
,
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
utf8_bin
;
...
...
@@ -52,6 +54,7 @@ create table ACT_HI_TASKINST (
DUE_DATE_
datetime
(
3
),
FORM_KEY_
varchar
(
255
),
CATEGORY_
varchar
(
255
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
utf8_bin
;
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.mysql55.create.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,6 +11,7 @@ create table ACT_HI_PROCINST (
END_ACT_ID_
varchar
(
255
),
SUPER_PROCESS_INSTANCE_ID_
varchar
(
64
),
DELETE_REASON_
varchar
(
4000
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
),
unique
(
PROC_INST_ID_
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
utf8_bin
;
...
...
@@ -29,6 +30,7 @@ create table ACT_HI_ACTINST (
START_TIME_
datetime
not
null
,
END_TIME_
datetime
,
DURATION_
bigint
,
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
utf8_bin
;
...
...
@@ -52,6 +54,7 @@ create table ACT_HI_TASKINST (
DUE_DATE_
datetime
,
FORM_KEY_
varchar
(
255
),
CATEGORY_
varchar
(
255
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COLLATE
utf8_bin
;
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.oracle.create.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,6 +11,7 @@ create table ACT_HI_PROCINST (
END_ACT_ID_
NVARCHAR2
(
255
),
SUPER_PROCESS_INSTANCE_ID_
NVARCHAR2
(
64
),
DELETE_REASON_
NVARCHAR2
(
2000
),
TENANT_ID_
NVARCHAR2
(
255
),
primary
key
(
ID_
),
unique
(
PROC_INST_ID_
)
);
...
...
@@ -29,6 +30,7 @@ create table ACT_HI_ACTINST (
START_TIME_
TIMESTAMP
(
6
)
not
null
,
END_TIME_
TIMESTAMP
(
6
),
DURATION_
NUMBER
(
19
,
0
),
TENANT_ID_
NVARCHAR2
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -52,6 +54,7 @@ create table ACT_HI_TASKINST (
DUE_DATE_
TIMESTAMP
(
6
),
FORM_KEY_
NVARCHAR2
(
255
),
CATEGORY_
NVARCHAR2
(
255
),
TENANT_ID_
NVARCHAR2
(
255
),
primary
key
(
ID_
)
);
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/create/activiti.postgres.create.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,6 +11,7 @@ create table ACT_HI_PROCINST (
END_ACT_ID_
varchar
(
255
),
SUPER_PROCESS_INSTANCE_ID_
varchar
(
64
),
DELETE_REASON_
varchar
(
4000
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
),
unique
(
PROC_INST_ID_
)
);
...
...
@@ -29,6 +30,7 @@ create table ACT_HI_ACTINST (
START_TIME_
timestamp
not
null
,
END_TIME_
timestamp
,
DURATION_
bigint
,
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
@@ -52,6 +54,7 @@ create table ACT_HI_TASKINST (
DUE_DATE_
timestamp
,
FORM_KEY_
varchar
(
255
),
CATEGORY_
varchar
(
255
),
TENANT_ID_
varchar
(
255
),
primary
key
(
ID_
)
);
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricActivityInstance.xml
浏览文件 @
071acf3c
...
...
@@ -34,7 +34,8 @@
ASSIGNEE_,
START_TIME_,
END_TIME_,
DURATION_
DURATION_,
TENANT_ID_
) values (
#{id ,jdbcType=VARCHAR},
#{processDefinitionId, jdbcType=VARCHAR},
...
...
@@ -48,7 +49,8 @@
#{assignee ,jdbcType=VARCHAR},
#{startTime, jdbcType=TIMESTAMP},
#{endTime, jdbcType=TIMESTAMP},
#{durationInMillis ,jdbcType=BIGINT}
#{durationInMillis ,jdbcType=BIGINT},
#{tenantId, jdbcType=VARCHAR}
)
</insert>
...
...
@@ -85,6 +87,7 @@
<result
property=
"startTime"
column=
"START_TIME_"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"endTime"
column=
"END_TIME_"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"durationInMillis"
column=
"DURATION_"
jdbcType=
"BIGINT"
/>
<result
property=
"tenantId"
column=
"TENANT_ID_"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!-- HISTORIC ACTIVITY INSTANCE SELECT -->
...
...
@@ -133,6 +136,15 @@
<if
test=
"assignee != null"
>
and RES.ASSIGNEE_ = #{assignee}
</if>
<if
test=
"tenantId != null"
>
and RES.TENANT_ID_ = #{tenantId}
</if>
<if
test=
"tenantIdLike != null"
>
and RES.TENANT_ID_ like #{tenantIdLike}
</if>
<if
test=
"withoutTenantId"
>
and RES.TENANT_ID_ is null
</if>
<if
test=
"unfinished"
>
and RES.END_TIME_ is null
</if>
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricProcessInstance.xml
浏览文件 @
071acf3c
...
...
@@ -33,7 +33,8 @@
START_ACT_ID_,
END_ACT_ID_,
SUPER_PROCESS_INSTANCE_ID_,
DELETE_REASON_
DELETE_REASON_,
TENANT_ID_
) values (
#{id ,jdbcType=VARCHAR},
#{processInstanceId, jdbcType=VARCHAR},
...
...
@@ -46,7 +47,8 @@
#{startActivityId, jdbcType=VARCHAR},
#{endActivityId, jdbcType=VARCHAR},
#{superProcessInstanceId, jdbcType=VARCHAR},
#{deleteReason, jdbcType=VARCHAR}
#{deleteReason, jdbcType=VARCHAR},
#{tenantId, jdbcType=VARCHAR}
)
</insert>
...
...
@@ -85,6 +87,7 @@
<result
property=
"endActivityId"
column=
"END_ACT_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"superProcessInstanceId"
column=
"SUPER_PROCESS_INSTANCE_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"deleteReason"
column=
"DELETE_REASON_"
jdbcType=
"VARCHAR"
/>
<result
property=
"tenantId"
column=
"TENANT_ID_"
jdbcType=
"VARCHAR"
/>
</resultMap>
<resultMap
id=
"historicProcessInstanceAndVariablesResultMap"
type=
"org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity"
>
...
...
@@ -100,6 +103,7 @@
<result
property=
"endActivityId"
column=
"END_ACT_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"superProcessInstanceId"
column=
"SUPER_PROCESS_INSTANCE_ID_"
jdbcType=
"VARCHAR"
/>
<result
property=
"deleteReason"
column=
"DELETE_REASON_"
jdbcType=
"VARCHAR"
/>
<result
property=
"tenantId"
column=
"TENANT_ID_"
jdbcType=
"VARCHAR"
/>
<collection
property=
"queryVariables"
column=
"EXECUTION_ID_"
javaType=
"ArrayList"
ofType=
"org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity"
>
<id
property=
"id"
column=
"VAR_ID_"
/>
<result
property=
"name"
column=
"VAR_NAME_"
javaType=
"String"
jdbcType=
"VARCHAR"
/>
...
...
@@ -280,6 +284,15 @@
<if
test=
"excludeSubprocesses"
>
and RES.SUPER_PROCESS_INSTANCE_ID_ is null
</if>
<if
test=
"tenantId != null"
>
and RES.TENANT_ID_ = #{tenantId}
</if>
<if
test=
"tenantIdLike != null"
>
and RES.TENANT_ID_ like #{tenantIdLike}
</if>
<if
test=
"withoutTenantId"
>
and RES.TENANT_ID_ is null
</if>
<foreach
collection=
"queryVariableValues"
index=
"index"
item=
"queryVariableValue"
>
<if
test=
"queryVariableValue.name != null"
>
<!-- Match-all variable-names when name is null -->
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricTaskInstance.xml
浏览文件 @
071acf3c
...
...
@@ -40,7 +40,8 @@
FORM_KEY_,
PRIORITY_,
DUE_DATE_,
CATEGORY_
CATEGORY_,
TENANT_ID_
) values (
#{id ,jdbcType=VARCHAR},
#{processDefinitionId, jdbcType=VARCHAR},
...
...
@@ -60,7 +61,8 @@
#{formKey ,jdbcType=VARCHAR},
#{priority, jdbcType=INTEGER},
#{dueDate, jdbcType=TIMESTAMP},
#{category, jdbcType=VARCHAR}
#{category, jdbcType=VARCHAR},
#{tenantId, jdbcType=VARCHAR}
)
</insert>
...
...
@@ -114,6 +116,7 @@
<result
property=
"priority"
column=
"PRIORITY_"
jdbcType=
"INTEGER"
/>
<result
property=
"dueDate"
column=
"DUE_DATE_"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"category"
column=
"CATEGORY_"
jdbcType=
"VARCHAR"
/>
<result
property=
"tenantId"
column=
"TENANT_ID_"
jdbcType=
"VARCHAR"
/>
</resultMap>
<resultMap
id=
"historicTaskInstanceAndVariablesResultMap"
type=
"org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity"
>
...
...
@@ -136,6 +139,7 @@
<result
property=
"priority"
column=
"PRIORITY_"
jdbcType=
"INTEGER"
/>
<result
property=
"dueDate"
column=
"DUE_DATE_"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"category"
column=
"CATEGORY_"
jdbcType=
"VARCHAR"
/>
<result
property=
"tenantId"
column=
"TENANT_ID_"
jdbcType=
"VARCHAR"
/>
<collection
property=
"queryVariables"
column=
"TASK_ID_"
javaType=
"ArrayList"
ofType=
"org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity"
>
<id
property=
"id"
column=
"VAR_ID_"
/>
<result
property=
"name"
column=
"VAR_NAME_"
javaType=
"String"
jdbcType=
"VARCHAR"
/>
...
...
@@ -388,6 +392,15 @@
<if
test=
"category != null"
>
and RES.CATEGORY_ = #{category}
</if>
<if
test=
"tenantId != null"
>
and RES.TENANT_ID_ = #{tenantId}
</if>
<if
test=
"tenantIdLike != null"
>
and RES.TENANT_ID_ like #{tenantIdLike}
</if>
<if
test=
"withoutTenantId"
>
and RES.TENANT_ID_ is null
</if>
<if
test=
"candidateUser != null || candidateGroups != null"
>
and RES.ASSIGNEE_ is null
and HI.TYPE_ = 'candidate'
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.db2.upgradestep.514.to.515.history.sql
浏览文件 @
071acf3c
...
...
@@ -15,4 +15,20 @@ alter table ACT_HI_VARINST
-- This means that for DB2 the columns will remain as they are (they won't be used)
-- alter table ACT_HI_PROCINST drop colum UNI_BUSINESS_KEY;
-- alter table ACT_HI_PROCINST drop colum UNI_PROC_DEF_ID;
-- Call Sysproc.admin_cmd ('REORG TABLE ACT_HI_PROCINST');
\ No newline at end of file
-- Call Sysproc.admin_cmd ('REORG TABLE ACT_HI_PROCINST');
alter
table
ACT_HI_PROCINST
add
TENANT_ID_
varchar
(
255
);
Call
Sysproc
.
admin_cmd
(
'REORG TABLE ACT_HI_PROCINST'
);
alter
table
ACT_HI_ACTINST
add
TENANT_ID_
varchar
(
255
);
Call
Sysproc
.
admin_cmd
(
'REORG TABLE ACT_HI_ACTINST'
);
alter
table
ACT_HI_TASKINST
add
TENANT_ID_
varchar
(
255
);
Call
Sysproc
.
admin_cmd
(
'REORG TABLE ACT_HI_TASKINST'
);
\ No newline at end of file
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.h2.upgradestep.514.to.515.history.sql
浏览文件 @
071acf3c
...
...
@@ -7,4 +7,13 @@ alter table ACT_HI_VARINST
add
CREATE_TIME_
timestamp
;
alter
table
ACT_HI_VARINST
add
LAST_UPDATED_TIME_
timestamp
;
\ No newline at end of file
add
LAST_UPDATED_TIME_
timestamp
;
alter
table
ACT_HI_PROCINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_ACTINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_TASKINST
add
TENANT_ID_
varchar
(
255
);
\ No newline at end of file
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.mssql.upgradestep.514.to.515.history.sql
浏览文件 @
071acf3c
...
...
@@ -8,4 +8,13 @@ alter table ACT_HI_VARINST
alter
table
ACT_HI_VARINST
add
LAST_UPDATED_TIME_
datetime
;
alter
table
ACT_HI_PROCINST
add
TENANT_ID_
nvarchar
(
255
);
alter
table
ACT_HI_ACTINST
add
TENANT_ID_
nvarchar
(
255
);
alter
table
ACT_HI_TASKINST
add
TENANT_ID_
nvarchar
(
255
);
\ No newline at end of file
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.mysql.upgradestep.514.to.515.history.sql
浏览文件 @
071acf3c
...
...
@@ -90,4 +90,13 @@ alter table ACT_HI_VARINST
alter
table
ACT_HI_VARINST
add
LAST_UPDATED_TIME_
datetime
(
3
);
alter
table
ACT_HI_PROCINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_ACTINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_TASKINST
add
TENANT_ID_
varchar
(
255
);
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.mysql55.upgradestep.514.to.515.history.sql
浏览文件 @
071acf3c
...
...
@@ -11,4 +11,13 @@ alter table ACT_HI_VARINST
add
CREATE_TIME_
datetime
;
alter
table
ACT_HI_VARINST
add
LAST_UPDATED_TIME_
datetime
;
\ No newline at end of file
add
LAST_UPDATED_TIME_
datetime
;
alter
table
ACT_HI_PROCINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_ACTINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_TASKINST
add
TENANT_ID_
varchar
(
255
);
\ No newline at end of file
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.oracle.upgradestep.514.to.515.history.sql
浏览文件 @
071acf3c
...
...
@@ -7,4 +7,13 @@ alter table ACT_HI_VARINST
add
CREATE_TIME_
TIMESTAMP
(
6
);
alter
table
ACT_HI_VARINST
add
LAST_UPDATED_TIME_
TIMESTAMP
(
6
);
\ No newline at end of file
add
LAST_UPDATED_TIME_
TIMESTAMP
(
6
);
alter
table
ACT_HI_PROCINST
add
TENANT_ID_
NVARCHAR2
(
255
);
alter
table
ACT_HI_ACTINST
add
TENANT_ID_
NVARCHAR2
(
255
);
alter
table
ACT_HI_TASKINST
add
TENANT_ID_
NVARCHAR2
(
255
);
\ No newline at end of file
modules/activiti-engine/src/main/resources/org/activiti/db/upgrade/activiti.postgres.upgradestep.514.to.515.history.sql
浏览文件 @
071acf3c
...
...
@@ -7,4 +7,13 @@ alter table ACT_HI_VARINST
add
CREATE_TIME_
timestamp
;
alter
table
ACT_HI_VARINST
add
LAST_UPDATED_TIME_
timestamp
;
\ No newline at end of file
add
LAST_UPDATED_TIME_
timestamp
;
alter
table
ACT_HI_PROCINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_ACTINST
add
TENANT_ID_
varchar
(
255
);
alter
table
ACT_HI_TASKINST
add
TENANT_ID_
varchar
(
255
);
\ No newline at end of file
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/tenant/TenancyTest.java
浏览文件 @
071acf3c
...
...
@@ -3,10 +3,12 @@ package org.activiti.engine.test.api.tenant;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.activiti.engine.history.HistoricActivityInstance
;
import
org.activiti.engine.impl.test.PluggableActivitiTestCase
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.Model
;
import
org.activiti.engine.runtime.Job
;
import
org.activiti.engine.task.Task
;
/**
* A test case for the various implications of the tenancy support (tenant id column to entities + query support)
...
...
@@ -407,5 +409,55 @@ public class TenancyTest extends PluggableActivitiTestCase {
// clean up
repositoryService
.
deleteDeployment
(
deploymentId
,
true
);
}
public
void
testHistoryTenancy
()
{
// Generate 3 tasks with tenant
String
processDefinitionIdWithTenant
=
deployTestProcessWithTestTenant
();
int
nrOfProcessInstancesWithTenant
=
3
;
for
(
int
i
=
0
;
i
<
nrOfProcessInstancesWithTenant
;
i
++)
{
runtimeService
.
startProcessInstanceById
(
processDefinitionIdWithTenant
);
}
// Generate 2 tasks without tenant
String
processDefinitionIdNoTenant
=
deployOneTaskTestProcess
();
int
nrOfProcessInstancesNoTenant
=
2
;
for
(
int
i
=
0
;
i
<
nrOfProcessInstancesNoTenant
;
i
++)
{
runtimeService
.
startProcessInstanceById
(
processDefinitionIdNoTenant
);
}
// Complete all tasks
for
(
Task
task
:
taskService
.
createTaskQuery
().
list
())
{
taskService
.
complete
(
task
.
getId
());
}
// Verify process instances
assertEquals
(
TEST_TENANT_ID
,
historyService
.
createHistoricProcessInstanceQuery
().
processDefinitionId
(
processDefinitionIdWithTenant
).
list
().
get
(
0
).
getTenantId
());
assertEquals
(
null
,
historyService
.
createHistoricProcessInstanceQuery
().
processDefinitionId
(
processDefinitionIdNoTenant
).
list
().
get
(
0
).
getTenantId
());
assertEquals
(
nrOfProcessInstancesWithTenant
+
nrOfProcessInstancesNoTenant
,
historyService
.
createHistoricProcessInstanceQuery
().
list
().
size
());
assertEquals
(
nrOfProcessInstancesWithTenant
,
historyService
.
createHistoricProcessInstanceQuery
().
processInstanceTenantId
(
TEST_TENANT_ID
).
list
().
size
());
assertEquals
(
nrOfProcessInstancesWithTenant
,
historyService
.
createHistoricProcessInstanceQuery
().
processInstanceTenantIdLike
(
"%e%"
).
list
().
size
());
assertEquals
(
nrOfProcessInstancesNoTenant
,
historyService
.
createHistoricProcessInstanceQuery
().
processInstanceWithoutTenantId
().
list
().
size
());
// verify tasks
assertEquals
(
TEST_TENANT_ID
,
historyService
.
createHistoricTaskInstanceQuery
().
processDefinitionId
(
processDefinitionIdWithTenant
).
list
().
get
(
0
).
getTenantId
());
assertEquals
(
null
,
historyService
.
createHistoricTaskInstanceQuery
().
processDefinitionId
(
processDefinitionIdNoTenant
).
list
().
get
(
0
).
getTenantId
());
assertEquals
(
nrOfProcessInstancesWithTenant
+
nrOfProcessInstancesNoTenant
,
historyService
.
createHistoricTaskInstanceQuery
().
list
().
size
());
assertEquals
(
nrOfProcessInstancesWithTenant
,
historyService
.
createHistoricTaskInstanceQuery
().
taskTenantId
(
TEST_TENANT_ID
).
list
().
size
());
assertEquals
(
nrOfProcessInstancesWithTenant
,
historyService
.
createHistoricTaskInstanceQuery
().
taskTenantIdLike
(
"my%"
).
list
().
size
());
assertEquals
(
nrOfProcessInstancesNoTenant
,
historyService
.
createHistoricTaskInstanceQuery
().
taskWithoutTenantId
().
list
().
size
());
// verify activities
List
<
HistoricActivityInstance
>
activityInstances
=
historyService
.
createHistoricActivityInstanceQuery
().
processDefinitionId
(
processDefinitionIdWithTenant
).
list
();
for
(
HistoricActivityInstance
historicActivityInstance
:
activityInstances
)
{
assertEquals
(
TEST_TENANT_ID
,
historicActivityInstance
.
getTenantId
());
}
assertEquals
(
null
,
historyService
.
createHistoricActivityInstanceQuery
().
processDefinitionId
(
processDefinitionIdNoTenant
).
list
().
get
(
0
).
getTenantId
());
assertEquals
(
3
*
(
nrOfProcessInstancesWithTenant
+
nrOfProcessInstancesNoTenant
),
historyService
.
createHistoricActivityInstanceQuery
().
list
().
size
());
assertEquals
(
3
*
nrOfProcessInstancesWithTenant
,
historyService
.
createHistoricActivityInstanceQuery
().
activityTenantId
(
TEST_TENANT_ID
).
list
().
size
());
assertEquals
(
3
*
nrOfProcessInstancesWithTenant
,
historyService
.
createHistoricActivityInstanceQuery
().
activityTenantIdLike
(
"my%"
).
list
().
size
());
assertEquals
(
3
*
nrOfProcessInstancesNoTenant
,
historyService
.
createHistoricActivityInstanceQuery
().
activityWithoutTenantId
().
list
().
size
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录