Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
c97ade38
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,发现更多精彩内容 >>
提交
c97ade38
编写于
9月 20, 2010
作者:
J
jbarrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ACT-104: first cut of refactoring query API
上级
9cc07a09
变更
51
隐藏空白更改
内联
并排
Showing
51 changed file
with
1978 addition
and
342 deletion
+1978
-342
modules/activiti-engine/src/main/java/org/activiti/engine/RuntimeService.java
...ine/src/main/java/org/activiti/engine/RuntimeService.java
+1
-4
modules/activiti-engine/src/main/java/org/activiti/engine/TaskService.java
...engine/src/main/java/org/activiti/engine/TaskService.java
+0
-28
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricActivityInstanceQuery.java
...ctiviti/engine/history/HistoricActivityInstanceQuery.java
+0
-4
modules/activiti-engine/src/main/java/org/activiti/engine/impl/DeploymentQueryImpl.java
...in/java/org/activiti/engine/impl/DeploymentQueryImpl.java
+67
-7
modules/activiti-engine/src/main/java/org/activiti/engine/impl/Direction.java
...ine/src/main/java/org/activiti/engine/impl/Direction.java
+1
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java
...ain/java/org/activiti/engine/impl/ExecutionQueryImpl.java
+88
-9
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricActivityInstanceQueryImpl.java
...tiviti/engine/impl/HistoricActivityInstanceQueryImpl.java
+0
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ProcessInstanceQueryImpl.java
...va/org/activiti/engine/impl/ProcessInstanceQueryImpl.java
+96
-24
modules/activiti-engine/src/main/java/org/activiti/engine/impl/RuntimeServiceImpl.java
...ain/java/org/activiti/engine/impl/RuntimeServiceImpl.java
+0
-10
modules/activiti-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java
...src/main/java/org/activiti/engine/impl/TaskQueryImpl.java
+158
-32
modules/activiti-engine/src/main/java/org/activiti/engine/impl/TaskServiceImpl.java
...c/main/java/org/activiti/engine/impl/TaskServiceImpl.java
+0
-16
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/RuntimeSession.java
...ain/java/org/activiti/engine/impl/cfg/RuntimeSession.java
+3
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/db/DbRuntimeSession.java
...in/java/org/activiti/engine/impl/db/DbRuntimeSession.java
+10
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/repository/DeploymentQueryProperty.java
...iviti/engine/impl/repository/DeploymentQueryProperty.java
+60
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/ExecutionQueryProperty.java
.../activiti/engine/impl/runtime/ExecutionQueryProperty.java
+49
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/ProcessInstanceQueryProperty.java
...iti/engine/impl/runtime/ProcessInstanceQueryProperty.java
+49
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskEntity.java
...c/main/java/org/activiti/engine/impl/task/TaskEntity.java
+4
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskQueryProperty.java
...java/org/activiti/engine/impl/task/TaskQueryProperty.java
+64
-0
modules/activiti-engine/src/main/java/org/activiti/engine/repository/DeploymentQuery.java
.../java/org/activiti/engine/repository/DeploymentQuery.java
+25
-9
modules/activiti-engine/src/main/java/org/activiti/engine/runtime/Execution.java
.../src/main/java/org/activiti/engine/runtime/Execution.java
+2
-2
modules/activiti-engine/src/main/java/org/activiti/engine/runtime/ExecutionQuery.java
...main/java/org/activiti/engine/runtime/ExecutionQuery.java
+26
-0
modules/activiti-engine/src/main/java/org/activiti/engine/runtime/ProcessInstanceQuery.java
...ava/org/activiti/engine/runtime/ProcessInstanceQuery.java
+68
-15
modules/activiti-engine/src/main/java/org/activiti/engine/task/Task.java
...i-engine/src/main/java/org/activiti/engine/task/Task.java
+2
-0
modules/activiti-engine/src/main/java/org/activiti/engine/task/TaskQuery.java
...ine/src/main/java/org/activiti/engine/task/TaskQuery.java
+67
-22
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/repository.mapping.xml
...n/resources/org/activiti/db/ibatis/repository.mapping.xml
+3
-0
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/runtime.mapping.xml
...main/resources/org/activiti/db/ibatis/runtime.mapping.xml
+27
-4
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/task.mapping.xml
...rc/main/resources/org/activiti/db/ibatis/task.mapping.xml
+18
-3
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/repository/DeploymentQueryTest.java
...iviti/engine/test/api/repository/DeploymentQueryTest.java
+168
-0
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/runtime/ExecutionQueryTest.java
.../activiti/engine/test/api/runtime/ExecutionQueryTest.java
+164
-0
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/runtime/ProcessInstanceQueryTest.java
...iti/engine/test/api/runtime/ProcessInstanceQueryTest.java
+199
-0
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/runtime/RuntimeServiceTest.java
.../activiti/engine/test/api/runtime/RuntimeServiceTest.java
+0
-23
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/task/TaskQueryTest.java
...java/org/activiti/engine/test/api/task/TaskQueryTest.java
+365
-0
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/task/TaskServiceTest.java
...va/org/activiti/engine/test/api/task/TaskServiceTest.java
+8
-8
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/callactivity/CallActivityAdvancedTest.java
...gine/test/bpmn/callactivity/CallActivityAdvancedTest.java
+2
-1
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/subprocess/SubProcessTest.java
.../activiti/engine/test/bpmn/subprocess/SubProcessTest.java
+11
-7
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/usertask/TaskAssignmentExtensionsTest.java
...gine/test/bpmn/usertask/TaskAssignmentExtensionsTest.java
+8
-8
modules/activiti-engine/src/test/java/org/activiti/engine/test/processinstance/ProcessInstanceQueryTest.java
...engine/test/processinstance/ProcessInstanceQueryTest.java
+0
-80
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/callactivity/CallActivityTest.java
...activiti/examples/bpmn/callactivity/CallActivityTest.java
+7
-1
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/gateway/ParallelGatewayTest.java
...g/activiti/examples/bpmn/gateway/ParallelGatewayTest.java
+4
-2
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/subprocess/SubProcessTest.java
...org/activiti/examples/bpmn/subprocess/SubProcessTest.java
+2
-1
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/usertask/FinancialReportProcessTest.java
...ti/examples/bpmn/usertask/FinancialReportProcessTest.java
+3
-3
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/usertask/taskcandidate/TaskCandidateTest.java
...amples/bpmn/usertask/taskcandidate/TaskCandidateTest.java
+11
-11
modules/activiti-engine/src/test/java/org/activiti/examples/task/StandaloneTaskTest.java
...t/java/org/activiti/examples/task/StandaloneTaskTest.java
+5
-5
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/concurrentExecution.bpmn20.xml
...ti/engine/test/api/runtime/concurrentExecution.bpmn20.xml
+36
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/nestedSubProcess.bpmn20.xml
...iviti/engine/test/api/runtime/nestedSubProcess.bpmn20.xml
+24
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/nestedsuperProcess.bpmn20.xml
...iti/engine/test/api/runtime/nestedsuperProcess.bpmn20.xml
+24
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/oneTaskProcess.bpmn20.xml
...ctiviti/engine/test/api/runtime/oneTaskProcess.bpmn20.xml
+0
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml
...tiviti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml
+0
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/subProcess.bpmn20.xml
...rg/activiti/engine/test/api/runtime/subProcess.bpmn20.xml
+24
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/superProcess.bpmn20.xml
.../activiti/engine/test/api/runtime/superProcess.bpmn20.xml
+24
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/tasks/TaskGet.java
...st/src/main/java/org/activiti/rest/api/tasks/TaskGet.java
+1
-1
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/RuntimeService.java
浏览文件 @
c97ade38
...
...
@@ -68,10 +68,7 @@ public interface RuntimeService {
/** Creates a new {@link ExecutionQuery} instance,
* that can be used to query the executions and process instances. */
ExecutionQuery
createExecutionQuery
();
/** Return the execution for the given id. Returns null if no execution is found. */
Execution
findExecutionById
(
String
executionId
);
/** Finds the activity ids for all executions that are waiting in activities.
* This is a list because a single activity can be active multiple times.
* @param executionId id of the execution, cannot be null.
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/TaskService.java
浏览文件 @
c97ade38
...
...
@@ -13,7 +13,6 @@
package
org.activiti.engine
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
org.activiti.engine.task.Task
;
...
...
@@ -44,12 +43,6 @@ public interface TaskService {
*/
void
saveTask
(
Task
task
);
/**
* Returns the task with given id. Returns null when no task with the given id is found.
* @param taskId the id of the task, cannot be null.
*/
Task
findTask
(
String
taskId
);
/**
* Deletes the given task.
* @param taskId The id of the task that will be deleted, cannot be null. If no task
...
...
@@ -64,27 +57,6 @@ public interface TaskService {
*/
void
deleteTasks
(
Collection
<
String
>
taskIds
);
/**
* Retrieves the list of tasks that potentially can be done by the given user.
*
* This means that the returned tasks are not yet directly assigned to the user,
* but rather to a certain role or group.
*
* To move a task from the 'candidate' task list to the 'personal' task list,
* call the <i>claim()</i> operation.
*
* @param userId
*/
List
<
Task
>
findUnassignedTasks
(
String
userId
);
/**
* Same as <i>findUnassignedTasks</i>, but paged.
*
* @param page allows to retrieve only a part of the results.
* if null, no paging will be applied.
*/
List
<
Task
>
findUnassignedTasks
(
String
userId
,
int
firstResult
,
int
maxResults
);
/**
* Claim responsibility for a task: the given user is made assignee for the task.
* When the task is already assigned to the given user, this operation does nothing.
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricActivityInstanceQuery.java
浏览文件 @
c97ade38
...
...
@@ -84,10 +84,6 @@ public interface HistoricActivityInstanceQuery {
/** Order the results descending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
HistoricActivityInstanceQuery
desc
();
/** Order the results according to the given direction
* (needs to come after a call to one of the orderByXxxx methods). */
HistoricActivityInstanceQuery
direction
(
Direction
direction
);
/** Executes the query and get a list of {@link HistoricProcessInstance}s as the result. */
List
<
HistoricActivityInstance
>
list
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/DeploymentQueryImpl.java
浏览文件 @
c97ade38
...
...
@@ -15,19 +15,24 @@ package org.activiti.engine.impl;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.repository.DeploymentQueryProperty
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.DeploymentQuery
;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public
class
DeploymentQueryImpl
extends
AbstractQuery
<
Deployment
>
implements
DeploymentQuery
{
protected
String
deploymentId
;
protected
String
name
;
protected
String
nameLike
;
protected
DeploymentQueryProperty
orderProperty
;
public
DeploymentQueryImpl
()
{
}
...
...
@@ -37,43 +42,98 @@ public class DeploymentQueryImpl extends AbstractQuery<Deployment> implements De
}
public
DeploymentQueryImpl
deploymentId
(
String
deploymentId
)
{
if
(
deploymentId
==
null
)
{
throw
new
ActivitiException
(
"Deployment id is null"
);
}
this
.
deploymentId
=
deploymentId
;
return
this
;
}
public
DeploymentQuery
name
(
String
name
)
{
if
(
name
==
null
)
{
throw
new
ActivitiException
(
"Deployment name is null"
);
}
this
.
name
=
name
;
return
this
;
}
public
DeploymentQueryImpl
nameLike
(
String
nameLike
)
{
if
(
nameLike
==
null
)
{
throw
new
ActivitiException
(
"Namelike is null"
);
}
this
.
nameLike
=
nameLike
;
return
this
;
}
public
DeploymentQueryImpl
orderAsc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_ASC
);
//sorting ////////////////////////////////////////////////////////
public
DeploymentQueryImpl
orderByDeploymentId
()
{
return
orderBy
(
DeploymentQueryProperty
.
DEPLOYMENT_ID_
);
}
public
DeploymentQuery
orderByDeploymenTime
()
{
return
orderBy
(
DeploymentQueryProperty
.
DEPLOY_TIME
);
}
public
DeploymentQuery
orderByDeploymentName
()
{
return
orderBy
(
DeploymentQueryProperty
.
NAME
);
}
public
DeploymentQueryImpl
orderBy
(
DeploymentQueryProperty
property
)
{
this
.
orderProperty
=
property
;
return
this
;
}
public
DeploymentQueryImpl
orderDesc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_DESC
);
public
DeploymentQuery
asc
()
{
return
direction
(
Direction
.
ASCENDING
);
}
public
DeploymentQuery
desc
()
{
return
direction
(
Direction
.
DESCENDING
);
}
public
DeploymentQuery
direction
(
Direction
direction
)
{
if
(
orderProperty
==
null
)
{
throw
new
ActivitiException
(
"You should call any of the orderBy methods first before specifying a direction"
);
}
addOrder
(
orderProperty
.
getName
(),
direction
.
getName
());
orderProperty
=
null
;
return
this
;
}
//results ////////////////////////////////////////////////////////
@Override
public
long
executeCount
(
CommandContext
commandContext
)
{
checkQueryOk
();
return
commandContext
.
getRepositorySession
()
.
findDeploymentCountByQueryCriteria
(
this
);
}
@SuppressWarnings
(
"unchecked"
)
@Override
public
List
<
Deployment
>
executeList
(
CommandContext
commandContext
,
Page
page
)
{
return
(
List
)
commandContext
checkQueryOk
();
return
commandContext
.
getRepositorySession
()
.
findDeploymentsByQueryCriteria
(
this
,
page
);
}
protected
void
checkQueryOk
()
{
if
(
orderProperty
!=
null
)
{
throw
new
ActivitiException
(
"Invalid query: please call asc() or desc() after using orderByXX()"
);
}
}
//getters ////////////////////////////////////////////////////////
public
String
getDeploymentId
()
{
return
deploymentId
;
}
public
String
getName
()
{
return
name
;
}
public
String
getNameLike
()
{
return
nameLike
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/
history
/Direction.java
→
modules/activiti-engine/src/main/java/org/activiti/engine/
impl
/Direction.java
浏览文件 @
c97ade38
...
...
@@ -11,7 +11,7 @@
* limitations under the License.
*/
package
org.activiti.engine.
history
;
package
org.activiti.engine.
impl
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java
浏览文件 @
c97ade38
...
...
@@ -14,8 +14,10 @@ package org.activiti.engine.impl;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.runtime.ExecutionQueryProperty
;
import
org.activiti.engine.runtime.Execution
;
import
org.activiti.engine.runtime.ExecutionQuery
;
...
...
@@ -25,11 +27,16 @@ import org.activiti.engine.runtime.ExecutionQuery;
*/
public
class
ExecutionQueryImpl
extends
AbstractQuery
<
Execution
>
implements
ExecutionQuery
{
protected
boolean
onlyProcessInstances
;
protected
String
processDefinitionId
;
protected
String
processDefinitionKey
;
protected
String
activityId
;
protected
String
executionId
;
protected
String
processInstanceId
;
protected
ExecutionQueryProperty
orderProperty
;
// Not used by end-users, but needed for dynamic ibatis query
protected
String
superProcessInstanceId
;
protected
String
subProcessInstanceId
;
protected
CommandExecutor
commandExecutor
;
...
...
@@ -41,46 +48,93 @@ public class ExecutionQueryImpl extends AbstractQuery<Execution> implements Exec
}
public
boolean
isProcessInstancesOnly
()
{
return
false
;
return
false
;
// see dynamic query
}
public
ExecutionQueryImpl
processDefinitionId
(
String
processDefinitionId
)
{
if
(
processDefinitionId
==
null
)
{
throw
new
ActivitiException
(
"Process definition id is null"
);
}
this
.
processDefinitionId
=
processDefinitionId
;
return
this
;
}
public
ExecutionQueryImpl
processDefinitionKey
(
String
processDefinitionKey
)
{
if
(
processDefinitionKey
==
null
)
{
throw
new
ActivitiException
(
"Process definition key is null"
);
}
this
.
processDefinitionKey
=
processDefinitionKey
;
return
this
;
}
public
ExecutionQueryImpl
processInstanceId
(
String
processInstanceId
)
{
this
.
executionId
=
processInstanceId
;
this
.
onlyProcessInstances
=
true
;
if
(
processInstanceId
==
null
)
{
throw
new
ActivitiException
(
"Process instance id is null"
);
}
this
.
processInstanceId
=
processInstanceId
;
return
this
;
}
public
ExecutionQueryImpl
executionId
(
String
executionId
)
{
if
(
executionId
==
null
)
{
throw
new
ActivitiException
(
"Execution id is null"
);
}
this
.
executionId
=
executionId
;
return
this
;
}
public
ExecutionQueryImpl
activityId
(
String
activityId
)
{
if
(
activityId
==
null
)
{
throw
new
ActivitiException
(
"Activity id is null"
);
}
this
.
activityId
=
activityId
;
return
this
;
}
public
ExecutionQueryImpl
orderAsc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_ASC
);
//ordering ////////////////////////////////////////////////////
public
ExecutionQueryImpl
orderByProcessInstanceId
()
{
this
.
orderProperty
=
ExecutionQueryProperty
.
PROCESS_INSTANCE_ID
;
return
this
;
}
public
ExecutionQueryImpl
orderByProcessDefinitionId
()
{
this
.
orderProperty
=
ExecutionQueryProperty
.
PROCESS_DEFINITION_ID
;
return
this
;
}
public
ExecutionQueryImpl
orderDesc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_DESC
);
public
ExecutionQueryImpl
orderByProcessDefinitionKey
()
{
this
.
orderProperty
=
ExecutionQueryProperty
.
PROCESS_DEFINITION_KEY
;
return
this
;
}
public
ExecutionQueryImpl
orderBy
(
ExecutionQueryProperty
property
)
{
this
.
orderProperty
=
property
;
return
this
;
}
public
ExecutionQueryImpl
asc
()
{
return
direction
(
Direction
.
ASCENDING
);
}
public
ExecutionQueryImpl
desc
()
{
return
direction
(
Direction
.
DESCENDING
);
}
public
ExecutionQueryImpl
direction
(
Direction
direction
)
{
if
(
orderProperty
==
null
)
{
throw
new
ActivitiException
(
"You should call any of the orderBy methods first before specifying a direction"
);
}
addOrder
(
orderProperty
.
getName
(),
direction
.
getName
());
orderProperty
=
null
;
return
this
;
}
//results ////////////////////////////////////////////////////
public
long
executeCount
(
CommandContext
commandContext
)
{
checkQueryOk
();
return
commandContext
.
getRuntimeSession
()
.
findExecutionCountByQueryCriteria
(
this
);
...
...
@@ -88,13 +142,22 @@ public class ExecutionQueryImpl extends AbstractQuery<Execution> implements Exec
@SuppressWarnings
(
"unchecked"
)
public
List
<
Execution
>
executeList
(
CommandContext
commandContext
,
Page
page
)
{
checkQueryOk
();
return
(
List
)
commandContext
.
getRuntimeSession
()
.
findExecutionsByQueryCriteria
(
this
,
page
);
}
protected
void
checkQueryOk
()
{
if
(
orderProperty
!=
null
)
{
throw
new
ActivitiException
(
"Invalid query: please call asc() or desc() after using orderByXX()"
);
}
}
//getters ////////////////////////////////////////////////////
public
boolean
getOnlyProcessInstances
()
{
return
onlyProcessInstances
;
return
false
;
}
public
String
getProcessDefinitionKey
()
{
...
...
@@ -105,8 +168,24 @@ public class ExecutionQueryImpl extends AbstractQuery<Execution> implements Exec
return
processDefinitionId
;
}
public
String
getActivityId
()
{
return
activityId
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
String
getExecutionId
()
{
return
executionId
;
}
public
String
getSuperProcessInstanceId
()
{
return
superProcessInstanceId
;
}
public
String
getSubProcessInstanceId
()
{
return
subProcessInstanceId
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricActivityInstanceQueryImpl.java
浏览文件 @
c97ade38
...
...
@@ -16,7 +16,6 @@ package org.activiti.engine.impl;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.history.Direction
;
import
org.activiti.engine.history.HistoricActivityInstance
;
import
org.activiti.engine.history.HistoricActivityInstanceQuery
;
import
org.activiti.engine.history.HistoricActivityInstanceQueryProperty
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/ProcessInstanceQueryImpl.java
浏览文件 @
c97ade38
...
...
@@ -15,21 +15,29 @@ package org.activiti.engine.impl;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.runtime.ProcessInstanceQueryProperty
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.runtime.ProcessInstanceQuery
;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public
class
ProcessInstanceQueryImpl
extends
AbstractQuery
<
ProcessInstance
>
implements
ProcessInstanceQuery
{
protected
String
executionId
;
protected
String
processDefinitionId
;
protected
String
processDefinitionKey
;
protected
String
executionId
;
protected
String
activityId
;
protected
ProcessInstanceQueryProperty
orderProperty
;
protected
String
superProcessInstanceId
;
protected
String
subProcessInstanceId
;
// Unused, see dynamic query
protected
String
activityId
;
protected
CommandExecutor
commandExecutor
;
...
...
@@ -40,66 +48,130 @@ public class ProcessInstanceQueryImpl extends AbstractQuery<ProcessInstance> imp
super
(
commandExecutor
);
}
public
boolean
isProcessInstancesOnly
()
{
return
true
;
public
ProcessInstanceQueryImpl
processInstanceId
(
String
processInstanceId
)
{
if
(
processInstanceId
==
null
)
{
throw
new
ActivitiException
(
"Process instance id is null"
);
}
this
.
executionId
=
processInstanceId
;
return
this
;
}
public
ProcessInstanceQueryImpl
processDefinitionId
(
String
processDefinitionId
)
{
if
(
processDefinitionId
==
null
)
{
throw
new
ActivitiException
(
"Process definition id is null"
);
}
this
.
processDefinitionId
=
processDefinitionId
;
return
this
;
}
public
ProcessInstanceQueryImpl
processDefinitionKey
(
String
processDefinitionKey
)
{
if
(
processDefinitionKey
==
null
)
{
throw
new
ActivitiException
(
"Process definition key is null"
);
}
this
.
processDefinitionKey
=
processDefinitionKey
;
return
this
;
}
public
ProcessInstanceQueryImpl
processInstanceId
(
String
processInstanceId
)
{
this
.
executionId
=
processInstanceId
;
public
ProcessInstanceQuery
superProcessInstance
(
String
superProcessInstanceId
)
{
if
(
superProcessInstanceId
==
null
)
{
throw
new
ActivitiException
(
"Super process instance id is null"
);
}
this
.
superProcessInstanceId
=
superProcessInstanceId
;
return
this
;
}
public
ProcessInstanceQueryImpl
activityId
(
String
activityId
)
{
this
.
activityId
=
activityId
;
public
ProcessInstanceQuery
subProcessInstance
(
String
subProcessInstanceId
)
{
if
(
subProcessInstanceId
==
null
)
{
throw
new
ActivitiException
(
"Sub process instance id is null"
);
}
this
.
subProcessInstanceId
=
subProcessInstanceId
;
return
this
;
}
public
ProcessInstanceQueryImpl
orderAsc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_ASC
);
//ordering //////////////////////////////////////////////
public
ProcessInstanceQuery
orderByProcessInstanceId
()
{
this
.
orderProperty
=
ProcessInstanceQueryProperty
.
PROCESS_INSTANCE_ID
;
return
this
;
}
public
ProcessInstanceQuery
Impl
orderDesc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_DESC
)
;
public
ProcessInstanceQuery
orderByProcessDefinitionId
(
)
{
this
.
orderProperty
=
ProcessInstanceQueryProperty
.
PROCESS_DEFINITION_ID
;
return
this
;
}
public
ProcessInstanceQuery
orderByProcessDefinitionKey
()
{
this
.
orderProperty
=
ProcessInstanceQueryProperty
.
PROCESS_DEFINITION_KEY
;
return
this
;
}
public
ProcessInstanceQuery
orderBy
(
ProcessInstanceQueryProperty
property
)
{
this
.
orderProperty
=
property
;
return
this
;
}
public
ProcessInstanceQuery
asc
()
{
return
direction
(
Direction
.
ASCENDING
);
}
public
ProcessInstanceQuery
desc
()
{
return
direction
(
Direction
.
DESCENDING
);
}
public
ProcessInstanceQuery
direction
(
Direction
direction
)
{
if
(
orderProperty
==
null
)
{
throw
new
ActivitiException
(
"You should call any of the orderBy methods first before specifying a direction"
);
}
addOrder
(
orderProperty
.
getName
(),
direction
.
getName
());
orderProperty
=
null
;
return
this
;
}
//results /////////////////////////////////////////////////////////////////
public
long
executeCount
(
CommandContext
commandContext
)
{
checkQueryOk
();
return
commandContext
.
getRuntimeSession
()
.
find
Execution
CountByQueryCriteria
(
this
);
.
find
ProcessInstance
CountByQueryCriteria
(
this
);
}
@SuppressWarnings
(
"unchecked"
)
public
List
<
ProcessInstance
>
executeList
(
CommandContext
commandContext
,
Page
page
)
{
return
(
List
)
commandContext
checkQueryOk
();
return
commandContext
.
getRuntimeSession
()
.
find
Executions
ByQueryCriteria
(
this
,
page
);
.
find
ProcessInstance
ByQueryCriteria
(
this
,
page
);
}
public
boolean
getOnlyProcessInstances
()
{
return
true
;
protected
void
checkQueryOk
()
{
if
(
orderProperty
!=
null
)
{
throw
new
ActivitiException
(
"Invalid query: please call asc() or desc() after using orderByXX()"
);
}
}
public
String
getProcessDefinitionKey
()
{
return
processDefinitionKey
;
}
//getters /////////////////////////////////////////////////////////////////
public
String
getExecutionId
()
{
public
boolean
getOnlyProcessInstances
()
{
return
true
;
// See dynamic query in runtime.mapping.xml
}
public
String
getProcessInstanceId
()
{
return
executionId
;
}
public
String
getProcessDefinitionId
()
{
return
processDefinitionId
;
}
public
String
getProcessDefinitionKey
()
{
return
processDefinitionKey
;
}
public
String
getActivityId
()
{
return
null
;
// Unused, see dynamic query
}
public
String
getSuperProcessInstanceId
()
{
return
superProcessInstanceId
;
}
public
String
getSubProcessInstanceId
()
{
return
subProcessInstanceId
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/RuntimeServiceImpl.java
浏览文件 @
c97ade38
...
...
@@ -88,16 +88,6 @@ public class RuntimeServiceImpl extends ServiceImpl implements RuntimeService {
return
new
ProcessInstanceQueryImpl
(
commandExecutor
);
}
public
Execution
findExecutionById
(
String
executionId
)
{
if
(
executionId
==
null
)
{
throw
new
ActivitiException
(
"executionId is null"
);
}
return
new
ExecutionQueryImpl
(
commandExecutor
)
.
executionId
(
executionId
)
.
singleResult
();
}
public
List
<
String
>
findActiveActivityIds
(
String
executionId
)
{
return
commandExecutor
.
execute
(
new
FindActiveActivityIdsCmd
(
executionId
));
}
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java
浏览文件 @
c97ade38
...
...
@@ -20,6 +20,7 @@ import org.activiti.engine.ActivitiException;
import
org.activiti.engine.impl.identity.GroupEntity
;
import
org.activiti.engine.impl.interceptor.CommandContext
;
import
org.activiti.engine.impl.interceptor.CommandExecutor
;
import
org.activiti.engine.impl.task.TaskQueryProperty
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.task.TaskQuery
;
...
...
@@ -29,12 +30,18 @@ import org.activiti.engine.task.TaskQuery;
*/
public
class
TaskQueryImpl
extends
AbstractQuery
<
Task
>
implements
TaskQuery
{
protected
String
taskId
;
protected
String
name
;
protected
String
nameLike
;
protected
String
description
;
protected
String
descriptionLike
;
protected
Integer
priority
;
protected
String
assignee
;
protected
String
candidateUser
;
protected
String
candidateGroup
;
protected
String
processInstanceId
;
protected
String
executionId
;
protected
TaskQueryProperty
orderProperty
;
public
TaskQueryImpl
()
{
}
...
...
@@ -43,29 +50,66 @@ public class TaskQueryImpl extends AbstractQuery<Task> implements TaskQuery {
super
(
commandExecutor
);
}
public
List
<
Task
>
executeList
(
CommandContext
commandContext
,
Page
page
)
{
return
commandContext
.
getTaskSession
()
.
findTasksByQueryCriteria
(
this
,
page
);
}
public
long
executeCount
(
CommandContext
commandContext
)
{
return
commandContext
.
getTaskSession
()
.
findTaskCountByQueryCriteria
(
this
);
public
TaskQueryImpl
taskId
(
String
taskId
)
{
if
(
taskId
==
null
)
{
throw
new
ActivitiException
(
"Task id is null"
);
}
this
.
taskId
=
taskId
;
return
this
;
}
public
TaskQueryImpl
name
(
String
name
)
{
if
(
name
==
null
)
{
throw
new
ActivitiException
(
"Task name is null"
);
}
this
.
name
=
name
;
return
this
;
}
public
TaskQueryImpl
nameLike
(
String
nameLike
)
{
if
(
nameLike
==
null
)
{
throw
new
ActivitiException
(
"Task namelike is null"
);
}
this
.
nameLike
=
nameLike
;
return
this
;
}
public
TaskQueryImpl
description
(
String
description
)
{
if
(
description
==
null
)
{
throw
new
ActivitiException
(
"Task description is null"
);
}
this
.
description
=
description
;
return
this
;
}
public
TaskQuery
descriptionLike
(
String
descriptionLike
)
{
if
(
descriptionLike
==
null
)
{
throw
new
ActivitiException
(
"Task descriptionlike is null"
);
}
this
.
descriptionLike
=
descriptionLike
;
return
this
;
}
public
TaskQuery
priority
(
Integer
priority
)
{
if
(
priority
==
null
)
{
throw
new
ActivitiException
(
"Task priority is null"
);
}
this
.
priority
=
priority
;
return
this
;
}
public
TaskQueryImpl
assignee
(
String
assignee
)
{
if
(
assignee
==
null
)
{
throw
new
ActivitiException
(
"Task assignee is null"
);
}
this
.
assignee
=
assignee
;
return
this
;
}
public
TaskQueryImpl
candidateUser
(
String
candidateUser
)
{
if
(
candidateUser
==
null
)
{
throw
new
ActivitiException
(
"Task candidateUser is null"
);
}
if
(
candidateGroup
!=
null
)
{
throw
new
ActivitiException
(
"Invalid query usage: cannot set both candidateUser and candidateGroup"
);
}
...
...
@@ -74,6 +118,9 @@ public class TaskQueryImpl extends AbstractQuery<Task> implements TaskQuery {
}
public
TaskQueryImpl
candidateGroup
(
String
candidateGroup
)
{
if
(
candidateGroup
==
null
)
{
throw
new
ActivitiException
(
"Task candidateGroup is null"
);
}
if
(
candidateUser
!=
null
)
{
throw
new
ActivitiException
(
"Invalid query usage: cannot set both candidateUser and candidateGroup"
);
}
...
...
@@ -82,25 +129,21 @@ public class TaskQueryImpl extends AbstractQuery<Task> implements TaskQuery {
}
public
TaskQueryImpl
processInstanceId
(
String
processInstanceId
)
{
if
(
processInstanceId
==
null
)
{
throw
new
ActivitiException
(
"Process instance id is null"
);
}
this
.
processInstanceId
=
processInstanceId
;
return
this
;
}
public
TaskQueryImpl
executionId
(
String
executionId
)
{
if
(
executionId
==
null
)
{
throw
new
ActivitiException
(
"Execution id is null"
);
}
this
.
executionId
=
executionId
;
return
this
;
}
public
TaskQueryImpl
orderAsc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_ASC
);
return
this
;
}
public
TaskQueryImpl
orderDesc
(
String
column
)
{
super
.
addOrder
(
column
,
SORTORDER_DESC
);
return
this
;
}
public
List
<
String
>
getCandidateGroups
()
{
if
(
candidateGroup
!=
null
)
{
return
Collections
.
singletonList
(
candidateGroup
);
...
...
@@ -121,35 +164,118 @@ public class TaskQueryImpl extends AbstractQuery<Task> implements TaskQuery {
}
return
groupIds
;
}
//ordering ////////////////////////////////////////////////////////////////
public
TaskQuery
orderByTaskId
()
{
return
orderBy
(
TaskQueryProperty
.
TASK_ID
);
}
public
TaskQuery
orderByName
()
{
return
orderBy
(
TaskQueryProperty
.
NAME
);
}
public
TaskQuery
orderByDescription
()
{
return
orderBy
(
TaskQueryProperty
.
DESCRIPTION
);
}
public
TaskQuery
orderByPriority
()
{
return
orderBy
(
TaskQueryProperty
.
PRIORITY
);
}
public
TaskQuery
orderByProcessInstanceId
()
{
return
orderBy
(
TaskQueryProperty
.
PROCESS_INSTANCE_ID
);
}
public
TaskQuery
orderByExecutionId
()
{
return
orderBy
(
TaskQueryProperty
.
EXECUTION_ID
);
}
public
TaskQuery
orderByAssignee
()
{
return
orderBy
(
TaskQueryProperty
.
ASSIGNEE
);
}
public
TaskQueryImpl
orderBy
(
TaskQueryProperty
property
)
{
this
.
orderProperty
=
property
;
return
this
;
}
public
TaskQueryImpl
asc
()
{
return
direction
(
Direction
.
ASCENDING
);
}
public
TaskQueryImpl
desc
()
{
return
direction
(
Direction
.
DESCENDING
);
}
protected
TaskQueryImpl
direction
(
Direction
direction
)
{
if
(
orderProperty
==
null
)
{
throw
new
ActivitiException
(
"You should call any of the orderBy methods first before specifying a direction"
);
}
addOrder
(
orderProperty
.
getName
(),
direction
.
getName
());
orderProperty
=
null
;
return
this
;
}
//results ////////////////////////////////////////////////////////////////
public
List
<
Task
>
executeList
(
CommandContext
commandContext
,
Page
page
)
{
checkQuery
();
return
commandContext
.
getTaskSession
()
.
findTasksByQueryCriteria
(
this
,
page
);
}
public
long
executeCount
(
CommandContext
commandContext
)
{
checkQuery
();
return
commandContext
.
getTaskSession
()
.
findTaskCountByQueryCriteria
(
this
);
}
protected
void
checkQuery
()
{
if
(
orderProperty
!=
null
)
{
throw
new
ActivitiException
(
"You should call any of the orderBy methods first before specifying a direction"
);
}
}
//getters ////////////////////////////////////////////////////////////////
public
String
getName
()
{
return
name
;
}
public
String
getNameLike
()
{
return
nameLike
;
}
public
String
getAssignee
()
{
return
assignee
;
}
public
String
getCandidateUser
()
{
return
candidateUser
;
}
public
String
getCandidateGroup
()
{
return
candidateGroup
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
String
getExecutionId
()
{
return
executionId
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
String
getDescription
()
{
return
description
;
}
public
String
getDescriptionLike
()
{
return
descriptionLike
;
}
public
Integer
getPriority
()
{
return
priority
;
}
public
TaskQueryProperty
getOrderProperty
()
{
return
orderProperty
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/TaskServiceImpl.java
浏览文件 @
c97ade38
...
...
@@ -13,7 +13,6 @@
package
org.activiti.engine.impl
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
org.activiti.engine.TaskService
;
...
...
@@ -21,7 +20,6 @@ import org.activiti.engine.impl.cmd.AddTaskInvolvementCmd;
import
org.activiti.engine.impl.cmd.ClaimTaskCmd
;
import
org.activiti.engine.impl.cmd.CompleteTaskCmd
;
import
org.activiti.engine.impl.cmd.DeleteTaskCmd
;
import
org.activiti.engine.impl.cmd.FindSingleTaskCmd
;
import
org.activiti.engine.impl.cmd.GetFormCmd
;
import
org.activiti.engine.impl.cmd.SaveTaskCmd
;
import
org.activiti.engine.impl.cmd.SetTaskPriorityCmd
;
...
...
@@ -58,20 +56,6 @@ public class TaskServiceImpl extends ServiceImpl implements TaskService {
commandExecutor
.
execute
(
new
DeleteTaskCmd
(
taskIds
));
}
public
Task
findTask
(
String
taskId
)
{
return
commandExecutor
.
execute
(
new
FindSingleTaskCmd
(
taskId
));
}
public
List
<
Task
>
findUnassignedTasks
(
String
userId
)
{
TaskQuery
query
=
createTaskQuery
().
candidateUser
(
userId
);
return
query
.
list
();
}
public
List
<
Task
>
findUnassignedTasks
(
String
userId
,
int
firstResult
,
int
maxResults
)
{
TaskQuery
query
=
createTaskQuery
().
candidateUser
(
userId
);
return
query
.
listPage
(
firstResult
,
maxResults
);
}
public
void
setAssignee
(
String
taskId
,
String
userId
)
{
commandExecutor
.
execute
(
new
AddTaskInvolvementCmd
(
taskId
,
userId
,
null
,
TaskInvolvementType
.
ASSIGNEE
));
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/RuntimeSession.java
浏览文件 @
c97ade38
...
...
@@ -24,6 +24,7 @@ import org.activiti.engine.impl.runtime.JobEntity;
import
org.activiti.engine.impl.runtime.TimerEntity
;
import
org.activiti.engine.impl.runtime.VariableInstanceEntity
;
import
org.activiti.engine.runtime.Job
;
import
org.activiti.engine.runtime.ProcessInstance
;
/**
...
...
@@ -35,6 +36,8 @@ public interface RuntimeSession {
ExecutionEntity
findSubProcessInstanceBySuperExecutionId
(
String
superExecutionId
);
long
findExecutionCountByQueryCriteria
(
Object
executionQuery
);
List
<
ExecutionEntity
>
findExecutionsByQueryCriteria
(
Object
executionQuery
,
Page
page
);
long
findProcessInstanceCountByQueryCriteria
(
Object
executionQuery
);
List
<
ProcessInstance
>
findProcessInstanceByQueryCriteria
(
Object
executionQuery
,
Page
page
);
List
<
ExecutionEntity
>
findChildExecutionsByParentExecutionId
(
String
executionId
);
ExecutionEntity
findExecutionById
(
String
activityInstanceId
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/db/DbRuntimeSession.java
浏览文件 @
c97ade38
...
...
@@ -31,6 +31,7 @@ import org.activiti.engine.impl.runtime.VariableInstanceEntity;
import
org.activiti.engine.impl.task.TaskEntity
;
import
org.activiti.engine.impl.util.ClockUtil
;
import
org.activiti.engine.runtime.Job
;
import
org.activiti.engine.runtime.ProcessInstance
;
/**
* @author Joram Barrez
...
...
@@ -74,6 +75,15 @@ public class DbRuntimeSession implements Session, RuntimeSession {
public
List
<
ExecutionEntity
>
findExecutionsByQueryCriteria
(
Object
executionQuery
,
Page
page
)
{
return
dbSqlSession
.
selectList
(
"selectExecutionsByQueryCriteria"
,
executionQuery
,
page
);
}
public
long
findProcessInstanceCountByQueryCriteria
(
Object
executionQuery
)
{
return
(
Long
)
dbSqlSession
.
selectOne
(
"selectProcessInstanceCountByQueryCriteria"
,
executionQuery
);
}
@SuppressWarnings
(
"unchecked"
)
public
List
<
ProcessInstance
>
findProcessInstanceByQueryCriteria
(
Object
executionQuery
,
Page
page
)
{
return
dbSqlSession
.
selectList
(
"selectProcessInstanceByQueryCriteria"
,
executionQuery
,
page
);
}
public
ExecutionEntity
findExecutionById
(
String
executionId
)
{
return
(
ExecutionEntity
)
dbSqlSession
.
selectOne
(
"selectExecutionById"
,
executionId
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/repository/DeploymentQueryProperty.java
0 → 100644
浏览文件 @
c97ade38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.repository
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author Joram Barrez
*/
public
class
DeploymentQueryProperty
{
private
static
final
Map
<
String
,
DeploymentQueryProperty
>
properties
=
new
HashMap
<
String
,
DeploymentQueryProperty
>();
public
static
final
DeploymentQueryProperty
DEPLOYMENT_ID_
=
new
DeploymentQueryProperty
(
"D.ID_"
);
public
static
final
DeploymentQueryProperty
NAME
=
new
DeploymentQueryProperty
(
"D.NAME_"
);
public
static
final
DeploymentQueryProperty
DEPLOY_TIME
=
new
DeploymentQueryProperty
(
"D.DEPLOY_TIME_"
);
private
String
name
;
public
DeploymentQueryProperty
(
String
name
)
{
this
.
name
=
name
;
properties
.
put
(
name
,
this
);
}
public
String
getName
()
{
return
name
;
}
public
static
DeploymentQueryProperty
findByName
(
String
propertyName
)
{
return
properties
.
get
(
propertyName
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/ExecutionQueryProperty.java
0 → 100644
浏览文件 @
c97ade38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.runtime
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.activiti.engine.runtime.ProcessInstanceQuery
;
/**
* Contains the possible properties that can be used in a {@link ProcessInstanceQuery}.
*
* @author Joram Barrez
*/
public
class
ExecutionQueryProperty
{
private
static
final
Map
<
String
,
ExecutionQueryProperty
>
properties
=
new
HashMap
<
String
,
ExecutionQueryProperty
>();
public
static
final
ExecutionQueryProperty
PROCESS_INSTANCE_ID
=
new
ExecutionQueryProperty
(
"E.ID_"
);
public
static
final
ExecutionQueryProperty
PROCESS_DEFINITION_KEY
=
new
ExecutionQueryProperty
(
"P.KEY_"
);
public
static
final
ExecutionQueryProperty
PROCESS_DEFINITION_ID
=
new
ExecutionQueryProperty
(
"P.ID_"
);
private
String
name
;
public
ExecutionQueryProperty
(
String
name
)
{
this
.
name
=
name
;
properties
.
put
(
name
,
this
);
}
public
String
getName
()
{
return
name
;
}
public
static
ExecutionQueryProperty
findByName
(
String
propertyName
)
{
return
properties
.
get
(
propertyName
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/runtime/ProcessInstanceQueryProperty.java
0 → 100644
浏览文件 @
c97ade38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.runtime
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.activiti.engine.runtime.ProcessInstanceQuery
;
/**
* Contains the possible properties that can be used in a {@link ProcessInstanceQuery}.
*
* @author Joram Barrez
*/
public
class
ProcessInstanceQueryProperty
{
private
static
final
Map
<
String
,
ProcessInstanceQueryProperty
>
properties
=
new
HashMap
<
String
,
ProcessInstanceQueryProperty
>();
public
static
final
ProcessInstanceQueryProperty
PROCESS_INSTANCE_ID
=
new
ProcessInstanceQueryProperty
(
"E.ID_"
);
public
static
final
ProcessInstanceQueryProperty
PROCESS_DEFINITION_KEY
=
new
ProcessInstanceQueryProperty
(
"P.KEY_"
);
public
static
final
ProcessInstanceQueryProperty
PROCESS_DEFINITION_ID
=
new
ProcessInstanceQueryProperty
(
"P.ID_"
);
private
String
name
;
public
ProcessInstanceQueryProperty
(
String
name
)
{
this
.
name
=
name
;
properties
.
put
(
name
,
this
);
}
public
String
getName
()
{
return
name
;
}
public
static
ProcessInstanceQueryProperty
findByName
(
String
propertyName
)
{
return
properties
.
get
(
propertyName
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskEntity.java
浏览文件 @
c97ade38
...
...
@@ -295,6 +295,10 @@ public class TaskEntity implements Task, Serializable, PersistentObject {
public
String
getExecutionId
()
{
return
executionId
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
String
getProcessDefinitionId
()
{
return
processDefinitionId
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskQueryProperty.java
0 → 100644
浏览文件 @
c97ade38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.impl.task
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author Joram Barrez
*/
public
class
TaskQueryProperty
{
private
static
final
Map
<
String
,
TaskQueryProperty
>
properties
=
new
HashMap
<
String
,
TaskQueryProperty
>();
public
static
final
TaskQueryProperty
TASK_ID
=
new
TaskQueryProperty
(
"T.ID_"
);
public
static
final
TaskQueryProperty
NAME
=
new
TaskQueryProperty
(
"T.NAME_"
);
public
static
final
TaskQueryProperty
DESCRIPTION
=
new
TaskQueryProperty
(
"T.DESCRIPTION_"
);
public
static
final
TaskQueryProperty
PRIORITY
=
new
TaskQueryProperty
(
"T.PRIORITY_"
);
public
static
final
TaskQueryProperty
ASSIGNEE
=
new
TaskQueryProperty
(
"T.ASSIGNEE_"
);
public
static
final
TaskQueryProperty
PROCESS_INSTANCE_ID
=
new
TaskQueryProperty
(
"T.PROC_INST_ID_"
);
public
static
final
TaskQueryProperty
EXECUTION_ID
=
new
TaskQueryProperty
(
"T.EXECUTION_ID_"
);
private
String
name
;
public
TaskQueryProperty
(
String
name
)
{
this
.
name
=
name
;
properties
.
put
(
name
,
this
);
}
public
String
getName
()
{
return
name
;
}
public
static
TaskQueryProperty
findByName
(
String
propertyName
)
{
return
properties
.
get
(
propertyName
);
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/repository/DeploymentQuery.java
浏览文件 @
c97ade38
...
...
@@ -16,6 +16,7 @@ package org.activiti.engine.repository;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.repository.DeploymentQueryProperty
;
/**
...
...
@@ -24,25 +25,40 @@ import org.activiti.engine.ActivitiException;
* @author Tom Baeyens
*/
public
interface
DeploymentQuery
{
String
PROPERTY_ID
=
"ID_"
;
String
PROPERTY_NAME
=
"NAME_"
;
String
PROPERTY_DEPLOY_TIME
=
"DEPLOY_TIME_"
;
/** Only select deployments with the given deployment id. */
DeploymentQuery
deploymentId
(
String
deploymentId
);
/** Only select deployments with the given name. */
DeploymentQuery
name
(
String
name
);
/** Only select deployments with a name like the given string. */
DeploymentQuery
nameLike
(
String
nameLike
);
/** Order the results ascending on the given property as
* defined in this class. */
DeploymentQuery
orderAsc
(
String
property
);
//sorting ////////////////////////////////////////////////////////
/** Order by deployment id (needs to be followed by {@link #asc()} or {@link #desc()}). */
DeploymentQuery
orderByDeploymentId
();
/** Order by deployment name (needs to be followed by {@link #asc()} or {@link #desc()}). */
DeploymentQuery
orderByDeploymentName
();
/** Order by deployment time (needs to be followed by {@link #asc()} or {@link #desc()}). */
DeploymentQuery
orderByDeploymenTime
();
/** Order by the given property (needs to be followed by {@link #asc()} or {@link #desc()}). */
DeploymentQuery
orderBy
(
DeploymentQueryProperty
property
);
/** Order the results ascending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
DeploymentQuery
asc
();
/** Order the results descending on the given property as
* defined in this class. */
DeploymentQuery
orderDesc
(
String
property
);
* defined in this class
(needs to come after a call to one of the orderByXxxx methods)
. */
DeploymentQuery
desc
(
);
//results ////////////////////////////////////////////////////////
/** Executes the query and counts number of {@link Deployment}s in the result. */
long
count
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/runtime/Execution.java
浏览文件 @
c97ade38
...
...
@@ -24,12 +24,12 @@ package org.activiti.engine.runtime;
public
interface
Execution
{
/**
* The unique identifier of the
process instance
.
* The unique identifier of the
execution
.
*/
String
getId
();
/**
* Indicates if the
process instance
is ended.
* Indicates if the
execution
is ended.
*/
boolean
isEnded
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/runtime/ExecutionQuery.java
浏览文件 @
c97ade38
...
...
@@ -15,6 +15,7 @@ package org.activiti.engine.runtime;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.runtime.ExecutionQueryProperty
;
...
...
@@ -38,6 +39,31 @@ public interface ExecutionQuery {
/** Only select executions which contain an activity with the given id. **/
ExecutionQuery
activityId
(
String
activityId
);
//ordering //////////////////////////////////////////////////////////////
/** Order by id (needs to be followed by {@link #asc()} or {@link #desc()}). */
ExecutionQuery
orderByProcessInstanceId
();
/** Order by process definition key (needs to be followed by {@link #asc()} or {@link #desc()}). */
ExecutionQuery
orderByProcessDefinitionKey
();
/** Order by process definition id (needs to be followed by {@link #asc()} or {@link #desc()}). */
ExecutionQuery
orderByProcessDefinitionId
();
/** Order by the given property (needs to be followed by {@link #asc()} or {@link #desc()}). */
ExecutionQuery
orderBy
(
ExecutionQueryProperty
property
);
/** Order the results ascending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
ExecutionQuery
asc
();
/** Order the results descending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
ExecutionQuery
desc
();
//results //////////////////////////////////////////////////////////////
/** Executes the query and get a list of {@link Execution}s as the result. */
List
<
Execution
>
list
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/runtime/ProcessInstanceQuery.java
浏览文件 @
c97ade38
...
...
@@ -15,36 +15,89 @@ package org.activiti.engine.runtime;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.runtime.ProcessInstanceQueryProperty
;
/** Allows programmatic querying of {@link ProcessInstance}s.
/**
* Allows programmatic querying of {@link ProcessInstance}s.
*
* @author Joram Barrez
*/
public
interface
ProcessInstanceQuery
{
/**
Only s
elect the process instance with the given id */
/**
S
elect the process instance with the given id */
ProcessInstanceQuery
processInstanceId
(
String
processInstanceId
);
/** Only select the process instances which are defined by a process definition
* with the given key.
/**
* Select the process instances which are defined by a process definition with
* the given key.
*/
ProcessInstanceQuery
processDefinitionKey
(
String
processDefinitionKey
);
/**
* Selects the process instances which are defined by a process definition
* with the given id.
*/
ProcessInstanceQuery
processDefinitionId
(
String
processDefinitionId
);
/**
* Select the process instances which are a sub process instance of the given
* super process instance.
*/
ProcessInstanceQuery
superProcessInstance
(
String
superProcessInstanceId
);
/**
* Select the process instance that have as sub process instance the given
* process instance. Note that there will always be maximum only <b>one</b>
* such process instance that can be the result of this query.
*/
ProcessInstanceQuery
subProcessInstance
(
String
subProcessInstanceId
);
/** Executes the query and get a list of {@link ProcessInstance}s as the result. */
List
<
ProcessInstance
>
list
();
//ordering /////////////////////////////////////////////////////////////////
/** Executes the query and get a list of {@link ProcessInstance}s as the result. */
List
<
ProcessInstance
>
listPage
(
int
firstResult
,
int
maxResults
);
/** Order by id (needs to be followed by {@link #asc()} or {@link #desc()}). */
ProcessInstanceQuery
orderByProcessInstanceId
();
/** Order by process definition key (needs to be followed by {@link #asc()} or {@link #desc()}). */
ProcessInstanceQuery
orderByProcessDefinitionKey
();
/** Order by process definition id (needs to be followed by {@link #asc()} or {@link #desc()}). */
ProcessInstanceQuery
orderByProcessDefinitionId
();
/** Order by the given property (needs to be followed by {@link #asc()} or {@link #desc()}). */
ProcessInstanceQuery
orderBy
(
ProcessInstanceQueryProperty
property
);
/** Order the results ascending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
ProcessInstanceQuery
asc
();
/** Order the results descending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
ProcessInstanceQuery
desc
();
//results /////////////////////////////////////////////////////////////////
/**
* Executes the query and get a list of {@link ProcessInstance}s as the
* result.
*/
List
<
ProcessInstance
>
list
();
/**
* Executes the query and get a list of {@link ProcessInstance}s as the
* result.
*/
List
<
ProcessInstance
>
listPage
(
int
firstResult
,
int
maxResults
);
/**
* Executes the query and returns the {@link ProcessInstance}.
* @throws ActivitiException when the query results in more
* than one process instance.
*
* @throws ActivitiException
* when the query results in more than one process instance.
*/
ProcessInstance
singleResult
();
/** Executes the query and returns the number of results */
long
count
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/task/Task.java
浏览文件 @
c97ade38
...
...
@@ -36,6 +36,8 @@ public interface Task {
String
getAssignee
();
String
getProcessInstanceId
();
String
getExecutionId
();
String
getProcessDefinitionId
();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/task/TaskQuery.java
浏览文件 @
c97ade38
...
...
@@ -15,7 +15,7 @@ package org.activiti.engine.task;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.task.TaskQueryProperty
;
/**
* Allows programmatic querying of {@link Task}s;
...
...
@@ -23,50 +23,95 @@ import org.activiti.engine.ActivitiException;
* @author Joram Barrez
*/
public
interface
TaskQuery
{
final
String
PROPERTY_NAME
=
"NAME_"
;
/**
* Only select tasks with the given task id (in practice, there will be
* maximum one of this kind)
*/
TaskQuery
taskId
(
String
taskId
);
/** Only select tasks with the given name */
TaskQuery
name
(
String
name
);
/** Only select tasks with a name matching the parameter.
* The syntax is that of SQL: for example usage: nameLike(%activiti%)*/
TaskQuery
nameLike
(
String
nameLike
);
/** Only select tasks with the given description. */
TaskQuery
description
(
String
description
);
/** Only select tasks with a description matching the parameter .
* The syntax is that of SQL: for example usage: descriptionLike(%activiti%)*/
TaskQuery
descriptionLike
(
String
descriptionLike
);
/** Only select tasks with the given priority. */
TaskQuery
priority
(
Integer
priority
);
/** Only select tasks which are assigned to the given user. */
TaskQuery
assignee
(
String
assignee
);
/** Only select tasks for which the given user is a candidate. */
TaskQuery
candidateUser
(
String
candidateUser
);
/** Only select tasks for which users in the given group
* are candidates.
*/
/** Only select tasks for which users in the given group are candidates. */
TaskQuery
candidateGroup
(
String
candidateGroup
);
/** Only select tasks for the given process instance id. */
TaskQuery
processInstanceId
(
String
processInstanceId
);
/** Only select tasks for the given execution. */
TaskQuery
executionId
(
String
executionId
);
// ordering ////////////////////////////////////////////////////////////
/** Order the results ascending on the given property as
* defined in this class. */
TaskQuery
orderAsc
(
String
property
);
/** Order by task id (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderByTaskId
();
/** Order the results descending on the given property as
* defined in this class. */
TaskQuery
orderDesc
(
String
property
);
/** Order by task name (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderByName
();
/** Order by description (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderByDescription
();
/** Order by priority (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderByPriority
();
/** Order by assignee (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderByAssignee
();
/** Order by process instance id (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderByProcessInstanceId
();
/** Order by execution id (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderByExecutionId
();
/** Order by the given property (needs to be followed by {@link #asc()} or {@link #desc()}). */
TaskQuery
orderBy
(
TaskQueryProperty
property
);
/** Order the results ascending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
TaskQuery
asc
();
/** Order the results descending on the given property as
* defined in this class (needs to come after a call to one of the orderByXxxx methods). */
TaskQuery
desc
();
// results ////////////////////////////////////////////////////////////
/** Execute the query and return the number of results. */
long
count
();
/**
* Executes the query and returns the {@link Task}.
* @throws ActivitiException when the query results in more
* than one process definition.
*
* @throws ActivitiException
* when the query results in more than one process definition.
*/
Task
singleResult
();
/** Executes the query and get a list of {@link Task}s as the result. */
List
<
Task
>
list
();
/** Executes the query and get a list of {@link Task}s as the result. */
List
<
Task
>
listPage
(
int
firstResult
,
int
maxResults
);
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/repository.mapping.xml
浏览文件 @
c97ade38
...
...
@@ -48,6 +48,9 @@
<if
test=
"deploymentId != null"
>
D.ID_ = #{deploymentId}
</if>
<if
test=
"name != null"
>
D.NAME_ = #{name}
</if>
<if
test=
"nameLike != null"
>
D.NAME_ like #{nameLike}
</if>
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/runtime.mapping.xml
浏览文件 @
c97ade38
...
...
@@ -68,7 +68,7 @@
where PARENT_ID_ = #{parentExecutionId}
</select>
<select
id=
"selectExecutionsByQueryCriteria"
parameterType=
"org.activiti.engine.impl.ExecutionQueryImpl"
resultMap=
"executionResultMap"
>
<select
id=
"selectExecutionsByQueryCriteria"
parameterType=
"org.activiti.engine.impl.ExecutionQueryImpl"
resultMap=
"executionResultMap"
>
select E.*
<include
refid=
"selectExecutionsByQueryCriteriaSql"
/>
<if
test=
"orderBy != null"
>
...
...
@@ -81,11 +81,23 @@
<include
refid=
"selectExecutionsByQueryCriteriaSql"
/>
</select>
<!-- same as selectExecutionByQueryCriteria, but with different parameterType -->
<select
id=
"selectProcessInstanceByQueryCriteria"
parameterType=
"org.activiti.engine.impl.ProcessInstanceQueryImpl"
resultMap=
"executionResultMap"
>
select E.*
<include
refid=
"selectExecutionsByQueryCriteriaSql"
/>
<if
test=
"orderBy != null"
>
order by ${orderBy}
</if>
</select>
<select
id=
"selectProcessInstanceCountByQueryCriteria"
parameterType=
"org.activiti.engine.impl.ProcessInstanceQueryImpl"
resultType=
"long"
>
select count(*)
<include
refid=
"selectExecutionsByQueryCriteriaSql"
/>
</select>
<sql
id=
"selectExecutionsByQueryCriteriaSql"
>
from ACT_RU_EXECUTION E
<if
test=
"processDefinitionKey != null or processDefinitionId != null"
>
inner join ACT_RE_PROC_DEF P on E.PROC_DEF_ID_ = P.ID_
</if>
inner join ACT_RE_PROC_DEF P on E.PROC_DEF_ID_ = P.ID_
<where>
<if
test=
"onlyProcessInstances"
>
E.PARENT_ID_ is null
...
...
@@ -99,9 +111,20 @@
<if
test=
"executionId != null"
>
and E.ID_ = #{executionId}
</if>
<if
test=
"processInstanceId != null"
>
and E.PROC_INST_ID_ = #{processInstanceId}
</if>
<if
test=
"activityId != null"
>
and E.ACTIVITY_ID_ = #{activityId}
</if>
<if
test=
"superProcessInstanceId != null"
>
<!-- A sub process instance is stored under a certain execution, potentially nested.
A sub process instance is NOT stored under the process instanc, hence the following: -->
and E.SUPER_EXEC_ IN (select ID_ from ACT_RU_EXECUTION where PROC_INST_ID_ = #{superProcessInstanceId})
</if>
<if
test=
"subProcessInstanceId != null"
>
and E.ID_ = (select PROC_INST_ID_ from ACT_RU_EXECUTION where ID_ = (select SUPER_EXEC_ from ACT_RU_EXECUTION where ID_ = #{subProcessInstanceId}))
</if>
</where>
</sql>
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/ibatis/task.mapping.xml
浏览文件 @
c97ade38
...
...
@@ -90,7 +90,7 @@
select * from ACT_RU_TASK where ASSIGNEE_ = #{assignee}
</select>
<select
id=
"selectTaskByQueryCriteria"
parameterType=
"
map
"
resultMap=
"taskResultMap"
>
<select
id=
"selectTaskByQueryCriteria"
parameterType=
"
org.activiti.engine.impl.TaskQueryImpl
"
resultMap=
"taskResultMap"
>
select distinct(T.*)
<include
refid=
"selectTaskByQueryCriteriaSql"
/>
<if
test=
"orderBy != null"
>
...
...
@@ -98,7 +98,7 @@
</if>
</select>
<select
id=
"selectTaskCountByQueryCriteria"
parameterType=
"
map
"
resultType=
"long"
>
<select
id=
"selectTaskCountByQueryCriteria"
parameterType=
"
org.activiti.engine.impl.TaskQueryImpl
"
resultType=
"long"
>
select count(distinct T.ID_)
<include
refid=
"selectTaskByQueryCriteriaSql"
/>
</select>
...
...
@@ -109,9 +109,24 @@
inner join ACT_RU_TASKINVOLVEMENT I on I.TASK_ID_ = T.ID_
</if>
<where>
<if
test=
"taskId != null"
>
T.ID_ = #{taskId}
</if>
<if
test=
"name != null"
>
T.NAME_ = #{name}
and T.NAME_ = #{name}
</if>
<if
test=
"nameLike != null"
>
and T.NAME_ like #{nameLike}
</if>
<if
test=
"description != null"
>
and T.DESCRIPTION_ = #{description}
</if>
<if
test=
"descriptionLike != null"
>
and T.DESCRIPTION_ like #{descriptionLike}
</if>
<if
test=
"priority != null"
>
and T.PRIORITY_ = #{priority}
</if>
<if
test=
"assignee != null"
>
and T.ASSIGNEE_ = #{assignee}
</if>
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/repository/DeploymentQueryTest.java
→
modules/activiti-engine/src/test/java/org/activiti/engine/test/
api/
repository/DeploymentQueryTest.java
浏览文件 @
c97ade38
...
...
@@ -11,10 +11,11 @@
* limitations under the License.
*/
package
org.activiti.engine.test.repository
;
package
org.activiti.engine.test.
api.
repository
;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.test.ActivitiInternalTestCase
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.DeploymentQuery
;
...
...
@@ -24,24 +25,113 @@ import org.activiti.engine.repository.DeploymentQuery;
* @author Tom Baeyens
*/
public
class
DeploymentQueryTest
extends
ActivitiInternalTestCase
{
public
void
testDeploymentQueries
()
{
String
deploymentOneId
=
repositoryService
private
String
deploymentOneId
;
private
String
deploymentTwoId
;
@Override
protected
void
setUp
()
throws
Exception
{
deploymentOneId
=
repositoryService
.
createDeployment
()
.
name
(
"org/activiti/engine/test/repository/one.bpmn20.xml"
)
.
addClasspathResource
(
"org/activiti/engine/test/repository/one.bpmn20.xml"
)
.
deploy
()
.
getId
();
String
deploymentTwoId
=
repositoryService
deploymentTwoId
=
repositoryService
.
createDeployment
()
.
name
(
"org/activiti/engine/test/repository/two.bpmn20.xml"
)
.
addClasspathResource
(
"org/activiti/engine/test/repository/two.bpmn20.xml"
)
.
deploy
()
.
getId
();
super
.
setUp
();
}
@Override
protected
void
tearDown
()
throws
Exception
{
super
.
tearDown
();
repositoryService
.
deleteDeploymentCascade
(
deploymentOneId
);
repositoryService
.
deleteDeploymentCascade
(
deploymentTwoId
);
}
public
void
testQueryNoCriteria
()
{
DeploymentQuery
query
=
repositoryService
.
createDeploymentQuery
();
assertEquals
(
2
,
query
.
list
().
size
());
assertEquals
(
2
,
query
.
count
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByDeploymentId
()
{
DeploymentQuery
query
=
repositoryService
.
createDeploymentQuery
().
deploymentId
(
deploymentOneId
);
assertNotNull
(
query
.
singleResult
());
assertEquals
(
1
,
query
.
list
().
size
());
assertEquals
(
1
,
query
.
count
());
}
public
void
testQueryByInvalidDeploymentId
()
{
DeploymentQuery
query
=
repositoryService
.
createDeploymentQuery
().
deploymentId
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
repositoryService
.
createDeploymentQuery
().
deploymentId
(
null
);
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByName
()
{
DeploymentQuery
query
=
repositoryService
.
createDeploymentQuery
().
name
(
"org/activiti/engine/test/repository/two.bpmn20.xml"
);
assertNotNull
(
query
.
singleResult
());
assertEquals
(
1
,
query
.
list
().
size
());
assertEquals
(
1
,
query
.
count
());
}
public
void
testQueryByInvalidName
()
{
DeploymentQuery
query
=
repositoryService
.
createDeploymentQuery
().
name
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
repositoryService
.
createDeploymentQuery
().
name
(
null
);
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByNameLike
()
{
DeploymentQuery
query
=
repositoryService
.
createDeploymentQuery
().
nameLike
(
"%activiti%"
);
assertEquals
(
2
,
query
.
list
().
size
());
assertEquals
(
2
,
query
.
count
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByInvalidNameLike
()
{
DeploymentQuery
query
=
repositoryService
.
createDeploymentQuery
().
nameLike
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
repositoryService
.
createDeploymentQuery
().
nameLike
(
null
);
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testVerifyDeploymentProperties
()
{
List
<
Deployment
>
deployments
=
repositoryService
.
createDeploymentQuery
()
.
orderAsc
(
DeploymentQuery
.
PROPERTY_NAME
)
.
orderByDeploymentName
()
.
asc
()
.
list
();
Deployment
deploymentOne
=
deployments
.
get
(
0
);
...
...
@@ -54,24 +144,25 @@ public class DeploymentQueryTest extends ActivitiInternalTestCase {
deployments
=
repositoryService
.
createDeploymentQuery
()
.
nameLike
(
"%one%"
)
.
orderAsc
(
DeploymentQuery
.
PROPERTY_NAME
)
.
orderByDeploymentName
()
.
asc
()
.
list
();
assertEquals
(
"org/activiti/engine/test/repository/one.bpmn20.xml"
,
deployments
.
get
(
0
).
getName
());
assertEquals
(
1
,
deployments
.
size
());
assertEquals
(
2
,
repositoryService
.
createDeploymentQuery
()
.
orderAsc
(
DeploymentQuery
.
PROPERTY_ID
)
.
orderByDeploymentId
()
.
asc
()
.
list
()
.
size
());
assertEquals
(
2
,
repositoryService
.
createDeploymentQuery
()
.
orderAsc
(
DeploymentQuery
.
PROPERTY_DEPLOY_TIME
)
.
orderByDeploymenTime
()
.
asc
()
.
list
()
.
size
());
repositoryService
.
deleteDeploymentCascade
(
deploymentOneId
);
repositoryService
.
deleteDeploymentCascade
(
deploymentTwoId
);
}
}
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/runtime/ExecutionQueryTest.java
0 → 100644
浏览文件 @
c97ade38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.test.api.runtime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.test.ActivitiInternalTestCase
;
import
org.activiti.engine.runtime.Execution
;
import
org.activiti.engine.runtime.ExecutionQuery
;
/**
* @author Joram Barrez
*/
public
class
ExecutionQueryTest
extends
ActivitiInternalTestCase
{
private
static
String
CONCURRENT_PROCESS_KEY
=
"concurrent"
;
private
static
String
SEQUENTIAL_PROCESS_KEY
=
"oneTaskProcess"
;
private
List
<
String
>
concurrentProcessInstanceIds
;
private
List
<
String
>
sequentialProcessInstanceIds
;
protected
void
setUp
()
throws
Exception
{
super
.
setUp
();
repositoryService
.
createDeployment
()
.
addClasspathResource
(
"org/activiti/engine/test/api/runtime/oneTaskProcess.bpmn20.xml"
)
.
addClasspathResource
(
"org/activiti/engine/test/api/runtime/concurrentExecution.bpmn20.xml"
)
.
deploy
();
concurrentProcessInstanceIds
=
new
ArrayList
<
String
>();
sequentialProcessInstanceIds
=
new
ArrayList
<
String
>();
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
concurrentProcessInstanceIds
.
add
(
runtimeService
.
startProcessInstanceByKey
(
CONCURRENT_PROCESS_KEY
).
getId
());
}
sequentialProcessInstanceIds
.
add
(
runtimeService
.
startProcessInstanceByKey
(
SEQUENTIAL_PROCESS_KEY
).
getId
());
}
protected
void
tearDown
()
throws
Exception
{
for
(
org
.
activiti
.
engine
.
repository
.
Deployment
deployment
:
repositoryService
.
findDeployments
())
{
repositoryService
.
deleteDeploymentCascade
(
deployment
.
getId
());
}
super
.
tearDown
();
}
public
void
testQueryByProcessDefinitionKey
()
{
// Concurrent process with 3 executions for each process instance
assertEquals
(
12
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
list
().
size
());
assertEquals
(
1
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
SEQUENTIAL_PROCESS_KEY
).
list
().
size
());
}
public
void
testQueryByInvalidProcessDefinitionKey
()
{
ExecutionQuery
query
=
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
}
public
void
testQueryByProcessInstanceId
()
{
for
(
String
processInstanceId
:
concurrentProcessInstanceIds
)
{
ExecutionQuery
query
=
runtimeService
.
createExecutionQuery
().
processInstanceId
(
processInstanceId
);
assertEquals
(
3
,
query
.
list
().
size
());
assertEquals
(
3
,
query
.
count
());
}
assertEquals
(
1
,
runtimeService
.
createExecutionQuery
().
processInstanceId
(
sequentialProcessInstanceIds
.
get
(
0
)).
list
().
size
());
}
public
void
testQueryByInvalidProcessInstanceId
()
{
ExecutionQuery
query
=
runtimeService
.
createExecutionQuery
().
processInstanceId
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
}
public
void
testQueryExecutionId
()
{
Execution
execution
=
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
SEQUENTIAL_PROCESS_KEY
).
singleResult
();
assertNotNull
(
runtimeService
.
createExecutionQuery
().
executionId
(
execution
.
getId
()));
}
public
void
testQueryByInvalidExecutionId
()
{
ExecutionQuery
query
=
runtimeService
.
createExecutionQuery
().
executionId
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
}
public
void
testQueryByActivityId
()
{
ExecutionQuery
query
=
runtimeService
.
createExecutionQuery
().
activityId
(
"receivePayment"
);
assertEquals
(
4
,
query
.
list
().
size
());
assertEquals
(
4
,
query
.
count
());
try
{
assertNull
(
query
.
singleResult
());
fail
();
}
catch
(
ActivitiException
e
)
{
}
}
public
void
testQueryByInvalidActivityId
()
{
ExecutionQuery
query
=
runtimeService
.
createExecutionQuery
().
activityId
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
}
public
void
testQueryPaging
()
{
assertEquals
(
4
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
listPage
(
0
,
4
).
size
());
assertEquals
(
1
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
listPage
(
2
,
1
).
size
());
assertEquals
(
10
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
listPage
(
1
,
10
).
size
());
assertEquals
(
12
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
listPage
(
0
,
20
).
size
());
}
public
void
testQuerySorting
()
{
// 13 executions: 3 for each concurrent, 1 for the sequential
assertEquals
(
13
,
runtimeService
.
createExecutionQuery
().
orderByProcessInstanceId
().
asc
().
list
().
size
());
assertEquals
(
13
,
runtimeService
.
createExecutionQuery
().
orderByProcessDefinitionId
().
asc
().
list
().
size
());
assertEquals
(
13
,
runtimeService
.
createExecutionQuery
().
orderByProcessDefinitionKey
().
asc
().
list
().
size
());
assertEquals
(
13
,
runtimeService
.
createExecutionQuery
().
orderByProcessInstanceId
().
desc
().
list
().
size
());
assertEquals
(
13
,
runtimeService
.
createExecutionQuery
().
orderByProcessDefinitionId
().
desc
().
list
().
size
());
assertEquals
(
13
,
runtimeService
.
createExecutionQuery
().
orderByProcessDefinitionKey
().
desc
().
list
().
size
());
assertEquals
(
12
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
orderByProcessDefinitionId
().
asc
().
list
().
size
());
assertEquals
(
12
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
orderByProcessDefinitionId
().
desc
().
list
().
size
());
assertEquals
(
12
,
runtimeService
.
createExecutionQuery
().
processDefinitionKey
(
CONCURRENT_PROCESS_KEY
).
orderByProcessDefinitionKey
().
asc
().
orderByProcessInstanceId
().
desc
().
list
().
size
());
}
public
void
testQueryInvalidSorting
()
{
try
{
runtimeService
.
createExecutionQuery
().
orderByProcessDefinitionKey
().
list
();
fail
();
}
catch
(
ActivitiException
e
)
{
}
}
}
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/runtime/ProcessInstanceQueryTest.java
0 → 100644
浏览文件 @
c97ade38
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.test.api.runtime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.runtime.ProcessInstanceQueryProperty
;
import
org.activiti.engine.impl.test.ActivitiInternalTestCase
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.runtime.ProcessInstanceQuery
;
import
org.activiti.engine.test.Deployment
;
/**
* @author Joram Barrez
*/
public
class
ProcessInstanceQueryTest
extends
ActivitiInternalTestCase
{
private
static
String
PROCESS_KEY
=
"oneTaskProcess"
;
private
static
String
PROCESS_KEY_2
=
"oneTaskProcess2"
;
private
List
<
String
>
processInstanceIds
;
/**
* Setup starts 4 process instances of oneTaskProcess
* and 1 instance of oneTaskProcess2
*/
protected
void
setUp
()
throws
Exception
{
super
.
setUp
();
repositoryService
.
createDeployment
()
.
addClasspathResource
(
"org/activiti/engine/test/api/runtime/oneTaskProcess.bpmn20.xml"
)
.
addClasspathResource
(
"org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml"
)
.
deploy
();
processInstanceIds
=
new
ArrayList
<
String
>();
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
processInstanceIds
.
add
(
runtimeService
.
startProcessInstanceByKey
(
PROCESS_KEY
).
getId
());
}
processInstanceIds
.
add
(
runtimeService
.
startProcessInstanceByKey
(
PROCESS_KEY_2
).
getId
());
}
protected
void
tearDown
()
throws
Exception
{
for
(
org
.
activiti
.
engine
.
repository
.
Deployment
deployment
:
repositoryService
.
findDeployments
())
{
repositoryService
.
deleteDeploymentCascade
(
deployment
.
getId
());
}
super
.
tearDown
();
}
public
void
testQueryNoSpecificsList
()
{
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
();
assertEquals
(
5
,
query
.
count
());
assertEquals
(
5
,
query
.
list
().
size
());
}
public
void
testQueryNoSpecificsSingleResult
()
{
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
();
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{
// Exception is expected
}
}
public
void
testQueryByProcessDefinitionKeySingleResult
()
{
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY_2
);
assertEquals
(
1
,
query
.
count
());
assertEquals
(
1
,
query
.
list
().
size
());
assertNotNull
(
query
.
singleResult
());
}
public
void
testQueryByInvalidProcessDefinitionKey
()
{
assertNull
(
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
"invalid"
).
singleResult
());
assertEquals
(
0
,
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
"invalid"
).
list
().
size
());
}
public
void
testQueryByProcessDefinitionKeyMultipleResults
()
{
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY
);
assertEquals
(
4
,
query
.
count
());
assertEquals
(
4
,
query
.
list
().
size
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{
// Exception is expected
}
}
public
void
testQueryByProcessInstanceId
()
{
for
(
String
processInstanceId
:
processInstanceIds
)
{
assertNotNull
(
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
processInstanceId
).
singleResult
());
assertEquals
(
1
,
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
processInstanceId
).
list
().
size
());
}
}
public
void
testQueryByInvalidProcessInstanceId
()
{
assertNull
(
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
"I do not exist"
).
singleResult
());
assertEquals
(
0
,
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
"I do not exist"
).
list
().
size
());
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/api/runtime/superProcess.bpmn20.xml"
,
"org/activiti/engine/test/api/runtime/subProcess.bpmn20.xml"
})
public
void
testQueryBySuperProcessInstanceId
()
{
ProcessInstance
superProcessInstance
=
runtimeService
.
startProcessInstanceByKey
(
"subProcessQueryTest"
);
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
superProcessInstance
.
getId
());
ProcessInstance
subProcessInstance
=
query
.
singleResult
();
assertNotNull
(
subProcessInstance
);
assertEquals
(
1
,
query
.
list
().
size
());
assertEquals
(
1
,
query
.
count
());
}
public
void
testQueryByInvalidSuperProcessInstanceId
()
{
assertNull
(
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
"invalid"
).
singleResult
());
assertEquals
(
0
,
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
"invalid"
).
list
().
size
());
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/api/runtime/superProcess.bpmn20.xml"
,
"org/activiti/engine/test/api/runtime/subProcess.bpmn20.xml"
})
public
void
testQueryBySubProcessInstanceId
()
{
ProcessInstance
superProcessInstance
=
runtimeService
.
startProcessInstanceByKey
(
"subProcessQueryTest"
);
ProcessInstance
subProcessInstance
=
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
superProcessInstance
.
getId
()).
singleResult
();
assertNotNull
(
subProcessInstance
);
assertEquals
(
superProcessInstance
.
getId
(),
runtimeService
.
createProcessInstanceQuery
().
subProcessInstance
(
subProcessInstance
.
getId
()).
singleResult
().
getId
());
}
public
void
testQueryByInvalidSubProcessInstanceId
()
{
assertNull
(
runtimeService
.
createProcessInstanceQuery
().
subProcessInstance
(
"invalid"
).
singleResult
());
assertEquals
(
0
,
runtimeService
.
createProcessInstanceQuery
().
subProcessInstance
(
"invalid"
).
list
().
size
());
}
// Nested subprocess make the query complexer, hence this test
@Deployment
(
resources
=
{
"org/activiti/engine/test/api/runtime/nestedSuperProcess.bpmn20.xml"
,
"org/activiti/engine/test/api/runtime/nestedSubProcess.bpmn20.xml"
,
"org/activiti/engine/test/api/runtime/subProcess.bpmn20.xml"
})
public
void
testQueryBySuperProcessInstanceIdNested
()
{
ProcessInstance
superProcessInstance
=
runtimeService
.
startProcessInstanceByKey
(
"nestedSubProcessQueryTest"
);
ProcessInstance
subProcessInstance
=
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
superProcessInstance
.
getId
()).
singleResult
();
assertNotNull
(
subProcessInstance
);
ProcessInstance
nestedSubProcessInstance
=
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
subProcessInstance
.
getId
()).
singleResult
();
assertNotNull
(
nestedSubProcessInstance
);
}
//Nested subprocess make the query complexer, hence this test
@Deployment
(
resources
=
{
"org/activiti/engine/test/api/runtime/nestedSuperProcess.bpmn20.xml"
,
"org/activiti/engine/test/api/runtime/nestedSubProcess.bpmn20.xml"
,
"org/activiti/engine/test/api/runtime/subProcess.bpmn20.xml"
})
public
void
testQueryBySubProcessInstanceIdNested
()
{
ProcessInstance
superProcessInstance
=
runtimeService
.
startProcessInstanceByKey
(
"nestedSubProcessQueryTest"
);
ProcessInstance
subProcessInstance
=
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
superProcessInstance
.
getId
()).
singleResult
();
assertEquals
(
superProcessInstance
.
getId
(),
runtimeService
.
createProcessInstanceQuery
().
subProcessInstance
(
subProcessInstance
.
getId
()).
singleResult
().
getId
());
ProcessInstance
nestedSubProcessInstance
=
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
subProcessInstance
.
getId
()).
singleResult
();
assertEquals
(
subProcessInstance
.
getId
(),
runtimeService
.
createProcessInstanceQuery
().
subProcessInstance
(
nestedSubProcessInstance
.
getId
()).
singleResult
().
getId
());
}
public
void
testQueryPaging
()
{
assertEquals
(
2
,
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY
).
listPage
(
0
,
2
).
size
());
assertEquals
(
3
,
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY
).
listPage
(
1
,
3
).
size
());
}
public
void
testQuerySorting
()
{
assertEquals
(
5
,
runtimeService
.
createProcessInstanceQuery
().
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_INSTANCE_ID
).
asc
().
list
().
size
());
assertEquals
(
5
,
runtimeService
.
createProcessInstanceQuery
().
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_DEFINITION_ID
).
asc
().
list
().
size
());
assertEquals
(
5
,
runtimeService
.
createProcessInstanceQuery
().
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_DEFINITION_KEY
).
asc
().
list
().
size
());
assertEquals
(
5
,
runtimeService
.
createProcessInstanceQuery
().
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_INSTANCE_ID
).
desc
().
list
().
size
());
assertEquals
(
5
,
runtimeService
.
createProcessInstanceQuery
().
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_DEFINITION_ID
).
desc
().
list
().
size
());
assertEquals
(
5
,
runtimeService
.
createProcessInstanceQuery
().
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_DEFINITION_KEY
).
desc
().
list
().
size
());
assertEquals
(
4
,
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY
).
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_INSTANCE_ID
).
asc
().
list
().
size
());
assertEquals
(
4
,
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY
).
orderBy
(
ProcessInstanceQueryProperty
.
PROCESS_INSTANCE_ID
).
desc
().
list
().
size
());
}
public
void
testQueryInvalidSorting
()
{
try
{
runtimeService
.
createProcessInstanceQuery
().
orderByProcessDefinitionId
().
list
();
// asc - desc not called -> exception
fail
();
}
catch
(
ActivitiException
e
)
{}
}
}
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/runtime/RuntimeServiceTest.java
浏览文件 @
c97ade38
...
...
@@ -113,29 +113,6 @@ public class RuntimeServiceTest extends ActivitiInternalTestCase {
}
}
@Deployment
(
resources
={
"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"
})
public
void
testFindExecutionById
()
{
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
);
Execution
execution
=
runtimeService
.
findExecutionById
(
processInstance
.
getId
());
assertNotNull
(
execution
);
}
public
void
testFindExecutionByIdUnexistingId
()
{
Execution
execution
=
runtimeService
.
findExecutionById
(
"unexisting"
);
assertNull
(
execution
);
}
public
void
testFindExecutionByIdNullId
()
{
try
{
runtimeService
.
findExecutionById
(
null
);
fail
(
"ActivitiException expected"
);
}
catch
(
ActivitiException
ae
)
{
assertTextPresent
(
"executionId is null"
,
ae
.
getMessage
());
}
}
@Deployment
(
resources
={
"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"
})
public
void
testFindActiveActivityIds
()
{
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/task/TaskQueryTest.java
→
modules/activiti-engine/src/test/java/org/activiti/engine/test/
api/
task/TaskQueryTest.java
浏览文件 @
c97ade38
...
...
@@ -10,7 +10,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.test.task
;
package
org.activiti.engine.test.
api.
task
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -51,8 +51,8 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
identityService
.
deleteUser
(
"kermit"
);
taskService
.
deleteTasks
(
taskIds
);
}
public
void
testQueryNo
Specifics
()
{
public
void
testQueryNo
Criteria
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
();
assertEquals
(
12
,
query
.
count
());
assertEquals
(
12
,
query
.
list
().
size
());
...
...
@@ -63,6 +63,136 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
}
}
public
void
testQueryByTaskId
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
taskId
(
taskIds
.
get
(
0
));
assertNotNull
(
query
.
singleResult
());
assertEquals
(
1
,
query
.
list
().
size
());
assertEquals
(
1
,
query
.
count
());
}
public
void
testQueryByInvalidTaskId
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
taskId
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
taskService
.
createTaskQuery
().
taskId
(
null
);
fail
();
}
catch
(
ActivitiException
e
)
{
}
}
public
void
testQueryByName
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
name
(
"testTask"
);
assertEquals
(
6
,
query
.
list
().
size
());
assertEquals
(
6
,
query
.
count
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByInvalidName
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
name
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
taskService
.
createTaskQuery
().
name
(
null
).
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{
}
}
public
void
testQueryByNameLike
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
nameLike
(
"gonzo%"
);
assertNotNull
(
query
.
singleResult
());
assertEquals
(
1
,
query
.
list
().
size
());
assertEquals
(
1
,
query
.
count
());
}
public
void
testQueryByInvalidNameLike
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
name
(
"1"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
taskService
.
createTaskQuery
().
name
(
null
).
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{
}
}
public
void
testQueryByDescription
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
description
(
"testTask description"
);
assertEquals
(
6
,
query
.
list
().
size
());
assertEquals
(
6
,
query
.
count
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByInvalidDescription
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
description
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
taskService
.
createTaskQuery
().
description
(
null
).
list
();
fail
();
}
catch
(
ActivitiException
e
)
{
}
}
public
void
testQueryByDescriptionLike
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
descriptionLike
(
"%gonzo%"
);
assertNotNull
(
query
.
singleResult
());
assertEquals
(
1
,
query
.
list
().
size
());
assertEquals
(
1
,
query
.
count
());
}
public
void
testQueryByInvalidDescriptionLike
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
descriptionLike
(
"invalid"
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
try
{
taskService
.
createTaskQuery
().
descriptionLike
(
null
).
list
();
fail
();
}
catch
(
ActivitiException
e
)
{
}
}
public
void
testQueryByPriority
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
priority
(
10
);
assertEquals
(
2
,
query
.
list
().
size
());
assertEquals
(
2
,
query
.
count
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{}
query
=
taskService
.
createTaskQuery
().
priority
(
100
);
assertNull
(
query
.
singleResult
());
assertEquals
(
0
,
query
.
list
().
size
());
assertEquals
(
0
,
query
.
count
());
}
public
void
testQueryByInvalidPriority
()
{
try
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
priority
(
null
);
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByAssignee
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
assignee
(
"gonzo"
);
assertEquals
(
1
,
query
.
count
());
...
...
@@ -75,7 +205,14 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
assertNull
(
query
.
singleResult
());
}
public
void
testQueryByCandidate
()
{
public
void
testQueryByNullAssignee
()
{
try
{
taskService
.
createTaskQuery
().
assignee
(
null
).
list
();
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByCandidateUser
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
);
assertEquals
(
11
,
query
.
count
());
assertEquals
(
11
,
query
.
list
().
size
());
...
...
@@ -94,7 +231,14 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
}
catch
(
ActivitiException
e
)
{
}
}
public
void
testQueryByNullCandidateUser
()
{
try
{
taskService
.
createTaskQuery
().
candidateUser
(
null
).
list
();
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryByCandidateGroup
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
candidateGroup
(
"management"
);
assertEquals
(
3
,
query
.
count
());
...
...
@@ -109,8 +253,15 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
assertEquals
(
0
,
query
.
count
());
assertEquals
(
0
,
query
.
list
().
size
());
}
public
void
testQueryByNullCandidateGroup
()
{
try
{
taskService
.
createTaskQuery
().
candidateGroup
(
null
).
list
();
fail
();
}
catch
(
ActivitiException
e
)
{}
}
public
void
testQueryPag
edList
()
{
public
void
testQueryPag
ing
()
{
TaskQuery
query
=
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
);
// Verifying the un-paged results
...
...
@@ -126,10 +277,29 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
// Verifying odd usages
assertEquals
(
0
,
query
.
listPage
(-
1
,
-
1
).
size
());
assertEquals
(
0
,
query
.
listPage
(
11
,
2
).
size
());
// 10 is the last index
// with a result
assertEquals
(
11
,
query
.
listPage
(
0
,
15
).
size
());
// there are only 11
// tasks
assertEquals
(
0
,
query
.
listPage
(
11
,
2
).
size
());
// 10 is the last index with a result
assertEquals
(
11
,
query
.
listPage
(
0
,
15
).
size
());
// there are only 11 tasks
}
public
void
testQuerySorting
()
{
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByTaskId
().
asc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByName
().
asc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByPriority
().
asc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByAssignee
().
asc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByDescription
().
asc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByProcessInstanceId
().
asc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByExecutionId
().
asc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByTaskId
().
desc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByName
().
desc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByPriority
().
desc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByAssignee
().
desc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByDescription
().
desc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByProcessInstanceId
().
desc
().
list
().
size
());
assertEquals
(
12
,
taskService
.
createTaskQuery
().
orderByExecutionId
().
desc
().
list
().
size
());
assertEquals
(
6
,
taskService
.
createTaskQuery
().
orderByTaskId
().
name
(
"testTask"
).
asc
().
list
().
size
());
assertEquals
(
6
,
taskService
.
createTaskQuery
().
orderByTaskId
().
name
(
"testTask"
).
desc
().
list
().
size
());
}
/**
...
...
@@ -145,6 +315,8 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
for
(
int
i
=
0
;
i
<
6
;
i
++)
{
Task
task
=
taskService
.
newTask
();
task
.
setName
(
"testTask"
);
task
.
setDescription
(
"testTask description"
);
task
.
setPriority
(
3
);
taskService
.
saveTask
(
task
);
ids
.
add
(
task
.
getId
());
taskService
.
addCandidateUser
(
task
.
getId
(),
"kermit"
);
...
...
@@ -152,6 +324,9 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
// 1 task for gonzo
Task
task
=
taskService
.
newTask
();
task
.
setName
(
"gonzoTask"
);
task
.
setDescription
(
"gonzo description"
);
task
.
setPriority
(
4
);
taskService
.
saveTask
(
task
);
taskService
.
setAssignee
(
task
.
getId
(),
"gonzo"
);
ids
.
add
(
task
.
getId
());
...
...
@@ -159,6 +334,8 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
// 2 tasks for management group
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
task
=
taskService
.
newTask
();
task
.
setName
(
"managementTask"
);
task
.
setPriority
(
10
);
taskService
.
saveTask
(
task
);
taskService
.
addCandidateGroup
(
task
.
getId
(),
"management"
);
ids
.
add
(
task
.
getId
());
...
...
@@ -167,6 +344,8 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
// 2 tasks for accountancy group
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
task
=
taskService
.
newTask
();
task
.
setName
(
"accountancyTask"
);
task
.
setName
(
"accountancy description"
);
taskService
.
saveTask
(
task
);
taskService
.
addCandidateGroup
(
task
.
getId
(),
"accountancy"
);
ids
.
add
(
task
.
getId
());
...
...
@@ -174,6 +353,7 @@ public class TaskQueryTest extends ActivitiInternalTestCase {
// 1 task assigned to management and accountancy group
task
=
taskService
.
newTask
();
task
.
setName
(
"managementAndAccountancyTask"
);
taskService
.
saveTask
(
task
);
taskService
.
addCandidateGroup
(
task
.
getId
(),
"management"
);
taskService
.
addCandidateGroup
(
task
.
getId
(),
"accountancy"
);
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/task/TaskServiceTest.java
浏览文件 @
c97ade38
...
...
@@ -40,7 +40,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
taskService
.
saveTask
(
task
);
// Fetch the task again and update
task
=
taskService
.
findTask
(
task
.
getId
()
);
task
=
taskService
.
createTaskQuery
().
taskId
(
task
.
getId
()).
singleResult
(
);
assertEquals
(
"description"
,
task
.
getDescription
());
assertEquals
(
"taskname"
,
task
.
getName
());
assertEquals
(
0
,
task
.
getPriority
().
intValue
());
...
...
@@ -50,7 +50,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
task
.
setPriority
(
1
);
taskService
.
saveTask
(
task
);
task
=
taskService
.
findTask
(
task
.
getId
()
);
task
=
taskService
.
createTaskQuery
().
taskId
(
task
.
getId
()).
singleResult
(
);
assertEquals
(
"updateddescription"
,
task
.
getDescription
());
assertEquals
(
"updatedtaskname"
,
task
.
getName
());
assertEquals
(
1
,
task
.
getPriority
().
intValue
());
...
...
@@ -100,7 +100,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
// have been deleted.
taskService
.
deleteTasks
(
Arrays
.
asList
(
"unexistingtaskid1"
,
existingTask
.
getId
()));
existingTask
=
taskService
.
findTask
(
existingTask
.
getId
()
);
existingTask
=
taskService
.
createTaskQuery
().
taskId
(
existingTask
.
getId
()).
singleResult
(
);
assertNull
(
existingTask
);
}
...
...
@@ -180,7 +180,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
// Claim task the first time
taskService
.
claim
(
task
.
getId
(),
user
.
getId
());
task
=
taskService
.
findTask
(
task
.
getId
()
);
task
=
taskService
.
createTaskQuery
().
taskId
(
task
.
getId
()).
singleResult
(
);
// Claim the task again with the same user. No exception should be thrown
taskService
.
claim
(
task
.
getId
(),
user
.
getId
());
...
...
@@ -250,7 +250,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
taskService
.
complete
(
task
.
getId
(),
null
);
// Fetch the task again
task
=
taskService
.
findTask
(
task
.
getId
()
);
task
=
taskService
.
createTaskQuery
().
taskId
(
task
.
getId
()).
singleResult
(
);
assertNull
(
task
);
}
...
...
@@ -262,7 +262,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
taskService
.
complete
(
task
.
getId
(),
Collections
.
EMPTY_MAP
);
// Fetch the task again
task
=
taskService
.
findTask
(
task
.
getId
()
);
task
=
taskService
.
createTaskQuery
().
taskId
(
task
.
getId
()).
singleResult
(
);
assertNull
(
task
);
}
...
...
@@ -305,7 +305,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
taskService
.
setAssignee
(
task
.
getId
(),
user
.
getId
());
// Fetch task again
task
=
taskService
.
findTask
(
task
.
getId
()
);
task
=
taskService
.
createTaskQuery
().
taskId
(
task
.
getId
()).
singleResult
(
);
assertEquals
(
user
.
getId
(),
task
.
getAssignee
());
identityService
.
deleteUser
(
user
.
getId
());
...
...
@@ -564,7 +564,7 @@ public class TaskServiceTest extends ActivitiInternalTestCase {
taskService
.
setPriority
(
task
.
getId
(),
12345
);
// Fetch task again to check if the priority is set
task
=
taskService
.
findTask
(
task
.
getId
()
);
task
=
taskService
.
createTaskQuery
().
taskId
(
task
.
getId
()).
singleResult
(
);
assertEquals
(
12345
,
task
.
getPriority
().
intValue
());
taskService
.
deleteTask
(
task
.
getId
());
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/callactivity/CallActivityAdvancedTest.java
浏览文件 @
c97ade38
...
...
@@ -85,7 +85,8 @@ public class CallActivityAdvancedTest extends ActivitiInternalTestCase {
// The two tasks in the parallel subprocess should be active
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
()
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
);
.
orderByName
()
.
asc
();
List
<
Task
>
tasks
=
taskQuery
.
list
();
assertEquals
(
2
,
tasks
.
size
());
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/subprocess/SubProcessTest.java
浏览文件 @
c97ade38
...
...
@@ -43,7 +43,7 @@ public class SubProcessTest extends ActivitiInternalTestCase {
// After completing the task in the subprocess,
// the subprocess scope is destroyed and the complete process ends
taskService
.
complete
(
subProcessTask
.
getId
());
assertNull
(
runtimeService
.
findExecutionById
(
pi
.
getId
()
));
assertNull
(
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
pi
.
getId
()).
singleResult
(
));
}
/**
...
...
@@ -93,7 +93,8 @@ public class SubProcessTest extends ActivitiInternalTestCase {
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
);
.
orderByName
()
.
asc
();
Task
subProcessTask
=
taskQuery
.
singleResult
();
assertEquals
(
"Task in subprocess"
,
subProcessTask
.
getName
());
...
...
@@ -180,7 +181,7 @@ public class SubProcessTest extends ActivitiInternalTestCase {
// After starting the process, the two task in the subprocess should be active
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"simpleParallelSubProcess"
);
List
<
Task
>
subProcessTasks
=
taskService
.
createTaskQuery
().
processInstanceId
(
pi
.
getId
()).
order
Asc
(
TaskQuery
.
PROPERTY_NAME
).
list
();
List
<
Task
>
subProcessTasks
=
taskService
.
createTaskQuery
().
processInstanceId
(
pi
.
getId
()).
order
ByName
().
asc
(
).
list
();
// Tasks are ordered by name (see query)
Task
taskA
=
subProcessTasks
.
get
(
0
);
...
...
@@ -200,7 +201,7 @@ public class SubProcessTest extends ActivitiInternalTestCase {
// After staring the process, the tasks in the subprocess should be active
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"simpleParallelSubProcessWithTimer"
);
List
<
Task
>
subProcessTasks
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
order
Asc
(
TaskQuery
.
PROPERTY_NAME
).
list
();
List
<
Task
>
subProcessTasks
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
order
ByName
().
asc
(
).
list
();
// Tasks are ordered by name (see query)
Task
taskA
=
subProcessTasks
.
get
(
0
);
...
...
@@ -230,7 +231,8 @@ public class SubProcessTest extends ActivitiInternalTestCase {
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
);
.
orderByName
()
.
asc
();
List
<
Task
>
tasks
=
taskQuery
.
list
();
// After process start, both tasks in the subprocesses should be active
...
...
@@ -264,7 +266,8 @@ public class SubProcessTest extends ActivitiInternalTestCase {
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
);
.
orderByName
()
.
asc
();
List
<
Task
>
tasks
=
taskQuery
.
list
();
// After process start, both tasks in the subprocesses should be active
...
...
@@ -294,7 +297,8 @@ public class SubProcessTest extends ActivitiInternalTestCase {
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
);
.
orderByName
()
.
asc
();
List
<
Task
>
tasks
=
taskQuery
.
list
();
// After process start, both tasks in the subprocesses should be active
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/usertask/TaskAssignmentExtensionsTest.java
浏览文件 @
c97ade38
...
...
@@ -73,9 +73,9 @@ public class TaskAssignmentExtensionsTest extends ActivitiInternalTestCase {
@Deployment
public
void
testCandidateUsersExtension
()
{
runtimeService
.
startProcessInstanceByKey
(
"candidateUsersExtension"
);
List
<
Task
>
tasks
=
taskService
.
findUnassignedTasks
(
"kermit"
);
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
tasks
=
taskService
.
findUnassignedTasks
(
"gonzo"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"gonzo"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
}
...
...
@@ -85,11 +85,11 @@ public class TaskAssignmentExtensionsTest extends ActivitiInternalTestCase {
// Bugfix check: potentially the query could return 2 tasks since
// kermit is a member of the two candidate groups
List
<
Task
>
tasks
=
taskService
.
findUnassignedTasks
(
"kermit"
);
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
assertEquals
(
"make profit"
,
tasks
.
get
(
0
).
getName
());
tasks
=
taskService
.
findUnassignedTasks
(
"fozzie"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"fozzie"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
assertEquals
(
"make profit"
,
tasks
.
get
(
0
).
getName
());
...
...
@@ -105,16 +105,16 @@ public class TaskAssignmentExtensionsTest extends ActivitiInternalTestCase {
public
void
testMixedCandidateUserDefinition
()
{
runtimeService
.
startProcessInstanceByKey
(
"mixedCandidateUser"
);
List
<
Task
>
tasks
=
taskService
.
findUnassignedTasks
(
"kermit"
);
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
tasks
=
taskService
.
findUnassignedTasks
(
"fozzie"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"fozzie"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
tasks
=
taskService
.
findUnassignedTasks
(
"gonzo"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"gonzo"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
tasks
=
taskService
.
findUnassignedTasks
(
"mispiggy"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"mispiggy"
).
list
(
);
assertEquals
(
0
,
tasks
.
size
());
}
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/processinstance/ProcessInstanceQueryTest.java
已删除
100644 → 0
浏览文件 @
9cc07a09
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.activiti.engine.test.processinstance
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.impl.test.ActivitiInternalTestCase
;
import
org.activiti.engine.runtime.ProcessInstanceQuery
;
/**
* @author Joram Barrez
*/
public
class
ProcessInstanceQueryTest
extends
ActivitiInternalTestCase
{
private
static
String
PROCESS_KEY
=
"oneTaskProcess"
;
private
static
String
PROCESS_KEY_2
=
"oneTaskProcess2"
;
protected
void
setUp
()
throws
Exception
{
super
.
setUp
();
repositoryService
.
createDeployment
()
.
addClasspathResource
(
"org/activiti/engine/test/processinstance/oneTaskProcess.bpmn20.xml"
)
.
addClasspathResource
(
"org/activiti/engine/test/processinstance/oneTaskProcess2.bpmn20.xml"
)
.
deploy
();
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
runtimeService
.
startProcessInstanceByKey
(
PROCESS_KEY
);
}
runtimeService
.
startProcessInstanceByKey
(
PROCESS_KEY_2
);
}
protected
void
tearDown
()
throws
Exception
{
for
(
org
.
activiti
.
engine
.
repository
.
Deployment
deployment
:
repositoryService
.
findDeployments
())
{
repositoryService
.
deleteDeploymentCascade
(
deployment
.
getId
());
}
super
.
tearDown
();
}
public
void
testQueryNoSpecifics
()
{
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
();
assertEquals
(
5
,
query
.
count
());
assertEquals
(
5
,
query
.
list
().
size
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{
// Exception is expected
}
}
public
void
testQueryByProcessDefinitionKeyMultipleResults
()
{
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY
);
assertEquals
(
4
,
query
.
count
());
assertEquals
(
4
,
query
.
list
().
size
());
try
{
query
.
singleResult
();
fail
();
}
catch
(
ActivitiException
e
)
{
// Exception is expected
}
}
public
void
testQueryByProcessDefinitionKeyUniqueResult
()
{
ProcessInstanceQuery
query
=
runtimeService
.
createProcessInstanceQuery
().
processDefinitionKey
(
PROCESS_KEY_2
);
assertEquals
(
1
,
query
.
count
());
assertEquals
(
1
,
query
.
list
().
size
());
assertNotNull
(
query
.
singleResult
());
}
}
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/callactivity/CallActivityTest.java
浏览文件 @
c97ade38
...
...
@@ -15,6 +15,7 @@ package org.activiti.examples.bpmn.callactivity;
import
org.activiti.engine.impl.test.ActivitiInternalTestCase
;
import
org.activiti.engine.impl.util.CollectionUtil
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.task.TaskQuery
;
import
org.activiti.engine.test.Deployment
;
...
...
@@ -30,11 +31,16 @@ public class CallActivityTest extends ActivitiInternalTestCase {
})
public
void
testOrderProcessWithCallActivity
()
{
// After the process has started, the 'verify credit history' task should be active
runtimeService
.
startProcessInstanceByKey
(
"orderProcess"
);
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"orderProcess"
);
TaskQuery
taskQuery
=
taskService
.
createTaskQuery
();
Task
verifyCreditTask
=
taskQuery
.
singleResult
();
assertEquals
(
"Verify credit history"
,
verifyCreditTask
.
getName
());
// Verify with Query API
ProcessInstance
subProcessInstance
=
runtimeService
.
createProcessInstanceQuery
().
superProcessInstance
(
pi
.
getId
()).
singleResult
();
assertNotNull
(
subProcessInstance
);
assertEquals
(
pi
.
getId
(),
runtimeService
.
createProcessInstanceQuery
().
subProcessInstance
(
subProcessInstance
.
getId
()).
singleResult
().
getId
());
// Completing the task with approval, will end the subprocess and continue the original process
taskService
.
complete
(
verifyCreditTask
.
getId
(),
CollectionUtil
.
singletonMap
(
"creditApproved"
,
true
));
Task
prepareAndShipTask
=
taskQuery
.
singleResult
();
...
...
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/gateway/ParallelGatewayTest.java
浏览文件 @
c97ade38
...
...
@@ -33,7 +33,8 @@ public class ParallelGatewayTest extends ActivitiInternalTestCase {
TaskQuery
query
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
);
.
orderByName
()
.
asc
();
List
<
Task
>
tasks
=
query
.
list
();
assertEquals
(
2
,
tasks
.
size
());
...
...
@@ -58,7 +59,8 @@ public class ParallelGatewayTest extends ActivitiInternalTestCase {
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"UnbalancedForkJoin"
);
TaskQuery
query
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
);
.
orderByName
()
.
asc
();
List
<
Task
>
tasks
=
query
.
list
();
assertEquals
(
3
,
tasks
.
size
());
...
...
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/subprocess/SubProcessTest.java
浏览文件 @
c97ade38
...
...
@@ -38,7 +38,8 @@ public class SubProcessTest extends ActivitiInternalTestCase {
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"fixSystemFailure"
);
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
orderAsc
(
TaskQuery
.
PROPERTY_NAME
)
.
orderByName
()
.
asc
()
.
list
();
// Tasks are ordered by name (see query)
...
...
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/usertask/FinancialReportProcessTest.java
浏览文件 @
c97ade38
...
...
@@ -34,7 +34,7 @@ public class FinancialReportProcessTest extends ActivitiInternalTestCase {
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"financialReport"
);
List
<
Task
>
tasks
=
taskService
.
findUnassignedTasks
(
"fozzie"
);
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"fozzie"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
Task
task
=
tasks
.
get
(
0
);
assertEquals
(
"Write monthly financial report"
,
task
.
getName
());
...
...
@@ -48,9 +48,9 @@ public class FinancialReportProcessTest extends ActivitiInternalTestCase {
assertEquals
(
1
,
tasks
.
size
());
taskService
.
complete
(
task
.
getId
());
tasks
=
taskService
.
findUnassignedTasks
(
"fozzie"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"fozzie"
).
list
(
);
assertEquals
(
0
,
tasks
.
size
());
tasks
=
taskService
.
findUnassignedTasks
(
"kermit"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
assertEquals
(
"Verify monthly financial report"
,
tasks
.
get
(
0
).
getName
());
taskService
.
complete
(
tasks
.
get
(
0
).
getId
());
...
...
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/usertask/taskcandidate/TaskCandidateTest.java
浏览文件 @
c97ade38
...
...
@@ -75,7 +75,7 @@ public class TaskCandidateTest extends ActivitiInternalTestCase {
assertTrue
(
tasks
.
isEmpty
());
// The task should be visible in the candidate task list
tasks
=
taskService
.
findUnassignedTasks
(
KERMIT
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
KERMIT
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
Task
task
=
tasks
.
get
(
0
);
assertEquals
(
"Pay out expenses"
,
task
.
getName
());
...
...
@@ -84,7 +84,7 @@ public class TaskCandidateTest extends ActivitiInternalTestCase {
taskService
.
claim
(
task
.
getId
(),
KERMIT
);
// The task must now be gone from the candidate task list
tasks
=
taskService
.
findUnassignedTasks
(
KERMIT
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
KERMIT
).
list
(
);
assertTrue
(
tasks
.
isEmpty
());
// The task will be visible on the personal task list
...
...
@@ -123,21 +123,21 @@ public class TaskCandidateTest extends ActivitiInternalTestCase {
// The task should be visible in the candidate task list of Gonzo and Kermit
// and anyone in the management/accountancy group
assertEquals
(
1
,
taskService
.
findUnassignedTasks
(
KERMIT
).
size
());
assertEquals
(
1
,
taskService
.
findUnassignedTasks
(
GONZO
).
size
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateUser
(
KERMIT
).
list
(
).
size
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateUser
(
GONZO
).
list
(
).
size
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateGroup
(
"management"
).
count
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateGroup
(
"accountancy"
).
count
());
assertEquals
(
0
,
taskService
.
createTaskQuery
().
candidateGroup
(
"sales"
).
count
());
// Gonzo claims the task
tasks
=
taskService
.
findUnassignedTasks
(
GONZO
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
GONZO
).
list
(
);
Task
task
=
tasks
.
get
(
0
);
assertEquals
(
"Approve expenses"
,
task
.
getName
());
taskService
.
claim
(
task
.
getId
(),
GONZO
);
// The task must now be gone from the candidate task lists
assertTrue
(
taskService
.
findUnassignedTasks
(
KERMIT
).
isEmpty
());
assertTrue
(
taskService
.
findUnassignedTasks
(
GONZO
).
isEmpty
());
assertTrue
(
taskService
.
createTaskQuery
().
candidateUser
(
KERMIT
).
list
(
).
isEmpty
());
assertTrue
(
taskService
.
createTaskQuery
().
candidateUser
(
GONZO
).
list
(
).
isEmpty
());
assertEquals
(
0
,
taskService
.
createTaskQuery
().
candidateGroup
(
"management"
).
count
());
// The task will be visible on the personal task list of Gonzo
...
...
@@ -159,16 +159,16 @@ public class TaskCandidateTest extends ActivitiInternalTestCase {
public
void
testMultipleCandidateUsers
()
{
runtimeService
.
startProcessInstanceByKey
(
"multipleCandidateUsers"
);
assertEquals
(
1
,
taskService
.
findUnassignedTasks
(
GONZO
).
size
());
assertEquals
(
1
,
taskService
.
findUnassignedTasks
(
KERMIT
).
size
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateUser
(
GONZO
).
list
(
).
size
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateUser
(
KERMIT
).
list
(
).
size
());
}
@Deployment
public
void
testMixedCandidateUserAndGroup
()
{
runtimeService
.
startProcessInstanceByKey
(
"mixedCandidateUserAndGroup"
);
assertEquals
(
1
,
taskService
.
findUnassignedTasks
(
GONZO
).
size
());
assertEquals
(
1
,
taskService
.
findUnassignedTasks
(
KERMIT
).
size
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateUser
(
GONZO
).
list
(
).
size
());
assertEquals
(
1
,
taskService
.
createTaskQuery
().
candidateUser
(
KERMIT
).
list
(
).
size
());
}
}
modules/activiti-engine/src/test/java/org/activiti/examples/task/StandaloneTaskTest.java
浏览文件 @
c97ade38
...
...
@@ -47,12 +47,12 @@ public class StandaloneTaskTest extends ActivitiInternalTestCase {
taskService
.
addCandidateUser
(
taskId
,
"gonzo"
);
// Retrieve task list for jbarrez
List
<
Task
>
tasks
=
taskService
.
findUnassignedTasks
(
"kermit"
);
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
assertEquals
(
"testTask"
,
tasks
.
get
(
0
).
getName
());
// Retrieve task list for tbaeyens
tasks
=
taskService
.
findUnassignedTasks
(
"gonzo"
);
tasks
=
taskService
.
createTaskQuery
().
candidateUser
(
"gonzo"
).
list
(
);
assertEquals
(
1
,
tasks
.
size
());
assertEquals
(
"testTask"
,
tasks
.
get
(
0
).
getName
());
...
...
@@ -60,15 +60,15 @@ public class StandaloneTaskTest extends ActivitiInternalTestCase {
taskService
.
claim
(
taskId
,
"kermit"
);
// Tasks shouldn't appear in the candidate tasklists anymore
assertTrue
(
taskService
.
findUnassignedTasks
(
"kermit"
).
isEmpty
());
assertTrue
(
taskService
.
findUnassignedTasks
(
"gonzo"
).
isEmpty
());
assertTrue
(
taskService
.
createTaskQuery
().
candidateUser
(
"kermit"
).
list
(
).
isEmpty
());
assertTrue
(
taskService
.
createTaskQuery
().
candidateUser
(
"gonzo"
).
list
(
).
isEmpty
());
// Complete task
taskService
.
complete
(
taskId
);
// Task should be removed from runtime data
// TODO: check for historic data when implemented!
assertNull
(
taskService
.
findTask
(
taskId
));
assertNull
(
taskService
.
createTaskQuery
().
taskId
(
taskId
).
singleResult
(
));
}
}
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/concurrentExecution.bpmn20.xml
0 → 100644
浏览文件 @
c97ade38
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti=
"http://activiti.org/bpmn-extensions"
typeLanguage=
"http://www.w3.org/2001/XMLSchema"
expressionLanguage=
"http://www.w3.org/1999/XPath"
targetNamespace=
"http://www.activiti.org/bpmn2.0"
>
<process
id=
"concurrent"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"fork"
/>
<parallelGateway
id=
"fork"
/>
<sequenceFlow
sourceRef=
"fork"
targetRef=
"receivePayment"
/>
<sequenceFlow
sourceRef=
"fork"
targetRef=
"shipOrder"
/>
<userTask
id=
"receivePayment"
name=
"Receive Payment"
/>
<sequenceFlow
sourceRef=
"receivePayment"
targetRef=
"join"
/>
<userTask
id=
"shipOrder"
name=
"Ship Order"
/>
<sequenceFlow
sourceRef=
"shipOrder"
targetRef=
"join"
/>
<parallelGateway
id=
"join"
/>
<sequenceFlow
sourceRef=
"join"
targetRef=
"archiveOrder"
/>
<userTask
id=
"archiveOrder"
name=
"Archive Order"
/>
<sequenceFlow
sourceRef=
"archiveOrder"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/nestedSubProcess.bpmn20.xml
0 → 100644
浏览文件 @
c97ade38
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti=
"http://activiti.org/bpmn-extensions"
typeLanguage=
"http://www.w3.org/2001/XMLSchema"
expressionLanguage=
"http://www.w3.org/1999/XPath"
targetNamespace=
"http://www.activiti.org/bpmn2.0"
>
<process
id=
"nestedSimpleSubProcess"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"callSubProcess"
/>
<callActivity
id=
"callSubProcess"
calledElement=
"simpleSubProcess"
/>
<sequenceFlow
id=
"flow3"
sourceRef=
"callSubProcess"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/nestedsuperProcess.bpmn20.xml
0 → 100644
浏览文件 @
c97ade38
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti=
"http://activiti.org/bpmn-extensions"
typeLanguage=
"http://www.w3.org/2001/XMLSchema"
expressionLanguage=
"http://www.w3.org/1999/XPath"
targetNamespace=
"http://www.activiti.org/bpmn2.0"
>
<process
id=
"nestedSubProcessQueryTest"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"callSubProcess"
/>
<callActivity
id=
"callSubProcess"
calledElement=
"nestedSimpleSubProcess"
/>
<sequenceFlow
id=
"flow3"
sourceRef=
"callSubProcess"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-engine/src/test/resources/org/activiti/engine/test/
processinstanc
e/oneTaskProcess.bpmn20.xml
→
modules/activiti-engine/src/test/resources/org/activiti/engine/test/
api/runtim
e/oneTaskProcess.bpmn20.xml
浏览文件 @
c97ade38
文件已移动
modules/activiti-engine/src/test/resources/org/activiti/engine/test/
processinstanc
e/oneTaskProcess2.bpmn20.xml
→
modules/activiti-engine/src/test/resources/org/activiti/engine/test/
api/runtim
e/oneTaskProcess2.bpmn20.xml
浏览文件 @
c97ade38
文件已移动
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/subProcess.bpmn20.xml
0 → 100644
浏览文件 @
c97ade38
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti=
"http://activiti.org/bpmn-extensions"
typeLanguage=
"http://www.w3.org/2001/XMLSchema"
expressionLanguage=
"http://www.w3.org/1999/XPath"
targetNamespace=
"http://www.activiti.org/bpmn2.0"
>
<process
id=
"simpleSubProcess"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"task"
/>
<userTask
id=
"task"
name=
"Task in subprocess"
/>
<sequenceFlow
id=
"flow2"
sourceRef=
"task"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-engine/src/test/resources/org/activiti/engine/test/api/runtime/superProcess.bpmn20.xml
0 → 100644
浏览文件 @
c97ade38
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti=
"http://activiti.org/bpmn-extensions"
typeLanguage=
"http://www.w3.org/2001/XMLSchema"
expressionLanguage=
"http://www.w3.org/1999/XPath"
targetNamespace=
"http://www.activiti.org/bpmn2.0"
>
<process
id=
"subProcessQueryTest"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"callSubProcess"
/>
<callActivity
id=
"callSubProcess"
calledElement=
"simpleSubProcess"
/>
<sequenceFlow
id=
"flow3"
sourceRef=
"callSubProcess"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-rest/src/main/java/org/activiti/rest/api/tasks/TaskGet.java
浏览文件 @
c97ade38
...
...
@@ -27,6 +27,6 @@ public class TaskGet extends ActivitiWebScript {
protected
void
executeWebScript
(
WebScriptRequest
req
,
Status
status
,
Cache
cache
,
Map
<
String
,
Object
>
model
)
{
String
taskId
=
getMandatoryPathParameter
(
req
,
"taskId"
);
model
.
put
(
"task"
,
getTaskService
().
findTask
(
taskId
));
model
.
put
(
"task"
,
getTaskService
().
createTaskQuery
().
taskId
(
taskId
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录