Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
6b472565
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,发现更多精彩内容 >>
提交
6b472565
编写于
6月 03, 2013
作者:
T
Tijs Rademakers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More work on history REST API
上级
eb8d95a5
变更
39
显示空白变更内容
内联
并排
Showing
39 changed file
with
2912 addition
and
9 deletion
+2912
-9
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestResponseFactory.java
.../main/java/org/activiti/rest/api/RestResponseFactory.java
+67
-1
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestUrls.java
...ti-rest/src/main/java/org/activiti/rest/api/RestUrls.java
+49
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceBaseResource.java
...est/api/history/HistoricActivityInstanceBaseResource.java
+102
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceCollectionResource.java
...i/history/HistoricActivityInstanceCollectionResource.java
+75
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstancePaginateList.java
...est/api/history/HistoricActivityInstancePaginateList.java
+46
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceQueryRequest.java
...est/api/history/HistoricActivityInstanceQueryRequest.java
+87
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceQueryResource.java
...st/api/history/HistoricActivityInstanceQueryResource.java
+30
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceResponse.java
...ti/rest/api/history/HistoricActivityInstanceResponse.java
+129
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricProcessInstanceResource.java
...iti/rest/api/history/HistoricProcessInstanceResource.java
+52
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricProcessInstanceResponse.java
...iti/rest/api/history/HistoricProcessInstanceResponse.java
+7
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceBaseResource.java
...ti/rest/api/history/HistoricTaskInstanceBaseResource.java
+223
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceCollectionResource.java
...t/api/history/HistoricTaskInstanceCollectionResource.java
+87
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstancePaginateList.java
...ti/rest/api/history/HistoricTaskInstancePaginateList.java
+46
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceQueryRequest.java
...ti/rest/api/history/HistoricTaskInstanceQueryRequest.java
+292
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceQueryResource.java
...i/rest/api/history/HistoricTaskInstanceQueryResource.java
+30
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceResource.java
...tiviti/rest/api/history/HistoricTaskInstanceResource.java
+52
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceResponse.java
...tiviti/rest/api/history/HistoricTaskInstanceResponse.java
+178
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceBaseResource.java
...est/api/history/HistoricVariableInstanceBaseResource.java
+108
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceCollectionResource.java
...i/history/HistoricVariableInstanceCollectionResource.java
+60
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstancePaginateList.java
...est/api/history/HistoricVariableInstancePaginateList.java
+46
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceQueryRequest.java
...est/api/history/HistoricVariableInstanceQueryRequest.java
+83
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceQueryResource.java
...st/api/history/HistoricVariableInstanceQueryResource.java
+30
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceResponse.java
...ti/rest/api/history/HistoricVariableInstanceResponse.java
+72
-0
modules/activiti-rest/src/main/java/org/activiti/rest/application/RestServicesInit.java
.../java/org/activiti/rest/application/RestServicesInit.java
+19
-0
modules/activiti-rest/src/test/java/org/activiti/rest/BaseRestTestCase.java
...est/src/test/java/org/activiti/rest/BaseRestTestCase.java
+1
-1
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricActivityInstanceCollectionResourceTest.java
...story/HistoricActivityInstanceCollectionResourceTest.java
+115
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricActivityInstanceQueryResourceTest.java
...pi/history/HistoricActivityInstanceQueryResourceTest.java
+158
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricProcessInstanceCollectionResourceTest.java
...istory/HistoricProcessInstanceCollectionResourceTest.java
+100
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricProcessInstanceQueryResourceTest.java
...api/history/HistoricProcessInstanceQueryResourceTest.java
+2
-7
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricTaskInstanceQueryResourceTest.java
...st/api/history/HistoricTaskInstanceQueryResourceTest.java
+122
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricVariableInstanceCollectionResourceTest.java
...story/HistoricVariableInstanceCollectionResourceTest.java
+115
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricVariableInstanceQueryResourceTest.java
...pi/history/HistoricVariableInstanceQueryResourceTest.java
+163
-0
modules/activiti-rest/src/test/resources/activiti.cfg.xml
modules/activiti-rest/src/test/resources/activiti.cfg.xml
+26
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricActivityInstanceCollectionResourceTest.testQueryActivityInstances.bpmn20.xml
...lectionResourceTest.testQueryActivityInstances.bpmn20.xml
+24
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricActivityInstanceQueryResourceTest.testQueryActivityInstances.bpmn20.xml
...ceQueryResourceTest.testQueryActivityInstances.bpmn20.xml
+24
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricProcessInstanceCollectionResourceTest.testQueryProcessInstances.bpmn20.xml
...llectionResourceTest.testQueryProcessInstances.bpmn20.xml
+20
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricTaskInstanceQueryResourceTest.testQueryTaskInstances.bpmn20.xml
...stanceQueryResourceTest.testQueryTaskInstances.bpmn20.xml
+24
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricVariableInstanceCollectionResourceTest.testQueryVariableInstances.bpmn20.xml
...lectionResourceTest.testQueryVariableInstances.bpmn20.xml
+24
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricVariableInstanceQueryResourceTest.testQueryVariableInstances.bpmn20.xml
...ceQueryResourceTest.testQueryVariableInstances.bpmn20.xml
+24
-0
未找到文件。
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestResponseFactory.java
浏览文件 @
6b472565
...
@@ -19,7 +19,10 @@ import java.util.Map;
...
@@ -19,7 +19,10 @@ import java.util.Map;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.history.HistoricActivityInstance
;
import
org.activiti.engine.history.HistoricProcessInstance
;
import
org.activiti.engine.history.HistoricProcessInstance
;
import
org.activiti.engine.history.HistoricTaskInstance
;
import
org.activiti.engine.history.HistoricVariableInstance
;
import
org.activiti.engine.impl.bpmn.deployer.BpmnDeployer
;
import
org.activiti.engine.impl.bpmn.deployer.BpmnDeployer
;
import
org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity
;
import
org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity
;
import
org.activiti.engine.repository.Deployment
;
import
org.activiti.engine.repository.Deployment
;
...
@@ -45,7 +48,10 @@ import org.activiti.rest.api.engine.variable.RestVariable.RestVariableScope;
...
@@ -45,7 +48,10 @@ import org.activiti.rest.api.engine.variable.RestVariable.RestVariableScope;
import
org.activiti.rest.api.engine.variable.RestVariableConverter
;
import
org.activiti.rest.api.engine.variable.RestVariableConverter
;
import
org.activiti.rest.api.engine.variable.ShortRestVariableConverter
;
import
org.activiti.rest.api.engine.variable.ShortRestVariableConverter
;
import
org.activiti.rest.api.engine.variable.StringRestVariableConverter
;
import
org.activiti.rest.api.engine.variable.StringRestVariableConverter
;
import
org.activiti.rest.api.history.HistoricActivityInstanceResponse
;
import
org.activiti.rest.api.history.HistoricProcessInstanceResponse
;
import
org.activiti.rest.api.history.HistoricProcessInstanceResponse
;
import
org.activiti.rest.api.history.HistoricTaskInstanceResponse
;
import
org.activiti.rest.api.history.HistoricVariableInstanceResponse
;
import
org.activiti.rest.api.identity.RestIdentityLink
;
import
org.activiti.rest.api.identity.RestIdentityLink
;
import
org.activiti.rest.api.management.TableResponse
;
import
org.activiti.rest.api.management.TableResponse
;
import
org.activiti.rest.api.repository.DeploymentResourceResponse
;
import
org.activiti.rest.api.repository.DeploymentResourceResponse
;
...
@@ -393,12 +399,72 @@ public class RestResponseFactory {
...
@@ -393,12 +399,72 @@ public class RestResponseFactory {
result
.
setEndActivityId
(
processInstance
.
getEndActivityId
());
result
.
setEndActivityId
(
processInstance
.
getEndActivityId
());
result
.
setEndTime
(
processInstance
.
getEndTime
());
result
.
setEndTime
(
processInstance
.
getEndTime
());
result
.
setId
(
processInstance
.
getId
());
result
.
setId
(
processInstance
.
getId
());
result
.
setProcessDefinitionId
(
processInstance
.
getProcessDefinitionId
());
result
.
setProcessDefinitionUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_PROCESS_DEFINITION
,
processInstance
.
getProcessDefinitionId
()));
result
.
setProcessDefinitionUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_PROCESS_DEFINITION
,
processInstance
.
getProcessDefinitionId
()));
result
.
setStartActivityId
(
processInstance
.
getStartActivityId
());
result
.
setStartActivityId
(
processInstance
.
getStartActivityId
());
result
.
setStartTime
(
processInstance
.
getStartTime
());
result
.
setStartTime
(
processInstance
.
getStartTime
());
result
.
setStartUserId
(
processInstance
.
getStartUserId
());
result
.
setStartUserId
(
processInstance
.
getStartUserId
());
result
.
setSuperProcessInstanceId
(
processInstance
.
getSuperProcessInstanceId
());
result
.
setSuperProcessInstanceId
(
processInstance
.
getSuperProcessInstanceId
());
result
.
setUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE
,
processInstance
.
getId
()));
result
.
setUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_PROCESS_INSTANCE
,
processInstance
.
getId
()));
return
result
;
}
public
HistoricTaskInstanceResponse
createHistoricTaskInstanceResponse
(
SecuredResource
securedResource
,
HistoricTaskInstance
taskInstance
)
{
HistoricTaskInstanceResponse
result
=
new
HistoricTaskInstanceResponse
();
result
.
setAssignee
(
taskInstance
.
getAssignee
());
result
.
setClaimTime
(
taskInstance
.
getClaimTime
());
result
.
setDeleteReason
(
taskInstance
.
getDeleteReason
());
result
.
setDescription
(
taskInstance
.
getDescription
());
result
.
setDueDate
(
taskInstance
.
getDueDate
());
result
.
setDurationInMillis
(
taskInstance
.
getDurationInMillis
());
result
.
setEndTime
(
taskInstance
.
getEndTime
());
result
.
setExecutionId
(
taskInstance
.
getExecutionId
());
result
.
setFormKey
(
taskInstance
.
getFormKey
());
result
.
setId
(
taskInstance
.
getId
());
result
.
setName
(
taskInstance
.
getName
());
result
.
setOwner
(
taskInstance
.
getOwner
());
result
.
setParentTaskId
(
taskInstance
.
getParentTaskId
());
result
.
setPriority
(
taskInstance
.
getPriority
());
result
.
setProcessDefinitionId
(
taskInstance
.
getProcessDefinitionId
());
result
.
setProcessDefinitionUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_PROCESS_DEFINITION
,
taskInstance
.
getProcessDefinitionId
()));
result
.
setProcessInstanceId
(
taskInstance
.
getProcessInstanceId
());
result
.
setProcessInstanceUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_PROCESS_INSTANCE
,
taskInstance
.
getProcessInstanceId
()));
result
.
setStartTime
(
taskInstance
.
getStartTime
());
result
.
setTaskDefinitionKey
(
taskInstance
.
getTaskDefinitionKey
());
result
.
setWorkTimeInMillis
(
taskInstance
.
getWorkTimeInMillis
());
result
.
setUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_TASK_INSTANCE
,
taskInstance
.
getId
()));
return
result
;
}
public
HistoricActivityInstanceResponse
createHistoricActivityInstanceResponse
(
SecuredResource
securedResource
,
HistoricActivityInstance
activityInstance
)
{
HistoricActivityInstanceResponse
result
=
new
HistoricActivityInstanceResponse
();
result
.
setActivityId
(
activityInstance
.
getActivityId
());
result
.
setActivityName
(
activityInstance
.
getActivityName
());
result
.
setActivityType
(
activityInstance
.
getActivityType
());
result
.
setAssignee
(
activityInstance
.
getAssignee
());
result
.
setCalledProcessInstanceId
(
activityInstance
.
getCalledProcessInstanceId
());
result
.
setDurationInMillis
(
activityInstance
.
getDurationInMillis
());
result
.
setEndTime
(
activityInstance
.
getEndTime
());
result
.
setExecutionId
(
activityInstance
.
getExecutionId
());
result
.
setId
(
activityInstance
.
getId
());
result
.
setProcessDefinitionId
(
activityInstance
.
getProcessDefinitionId
());
result
.
setProcessDefinitionUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_PROCESS_DEFINITION
,
activityInstance
.
getProcessDefinitionId
()));
result
.
setProcessInstanceId
(
activityInstance
.
getProcessInstanceId
());
result
.
setProcessInstanceUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_PROCESS_INSTANCE
,
activityInstance
.
getId
()));
result
.
setStartTime
(
activityInstance
.
getStartTime
());
result
.
setTaskId
(
activityInstance
.
getTaskId
());
return
result
;
}
public
HistoricVariableInstanceResponse
createHistoricVariableInstanceResponse
(
SecuredResource
securedResource
,
HistoricVariableInstance
variableInstance
)
{
HistoricVariableInstanceResponse
result
=
new
HistoricVariableInstanceResponse
();
result
.
setId
(
variableInstance
.
getId
());
result
.
setProcessInstanceId
(
variableInstance
.
getProcessInstanceId
());
result
.
setProcessInstanceUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_PROCESS_INSTANCE
,
variableInstance
.
getProcessInstanceId
()));
result
.
setTaskId
(
variableInstance
.
getTaskId
());
result
.
setValue
(
variableInstance
.
getValue
());
result
.
setVariableName
(
variableInstance
.
getVariableName
());
result
.
setVariableTypeName
(
variableInstance
.
getVariableTypeName
());
return
result
;
return
result
;
}
}
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestUrls.java
浏览文件 @
6b472565
...
@@ -28,6 +28,7 @@ public final class RestUrls {
...
@@ -28,6 +28,7 @@ public final class RestUrls {
public
static
final
String
SEGMENT_REPOSITORY_RESOURCES
=
"repository"
;
public
static
final
String
SEGMENT_REPOSITORY_RESOURCES
=
"repository"
;
public
static
final
String
SEGMENT_RUNTIME_RESOURCES
=
"runtime"
;
public
static
final
String
SEGMENT_RUNTIME_RESOURCES
=
"runtime"
;
public
static
final
String
SEGMENT_MANAGEMENT_RESOURCES
=
"management"
;
public
static
final
String
SEGMENT_MANAGEMENT_RESOURCES
=
"management"
;
public
static
final
String
SEGMENT_HISTORY_RESOURCES
=
"history"
;
public
static
final
String
SEGMENT_QUERY_RESOURCES
=
"query"
;
public
static
final
String
SEGMENT_QUERY_RESOURCES
=
"query"
;
public
static
final
String
SEGMENT_DEPLOYMENT_RESOURCE
=
"deployments"
;
public
static
final
String
SEGMENT_DEPLOYMENT_RESOURCE
=
"deployments"
;
...
@@ -48,6 +49,9 @@ public final class RestUrls {
...
@@ -48,6 +49,9 @@ public final class RestUrls {
public
static
final
String
SEGMENT_IDENTITYLINKS_FAMILY_USERS
=
"users"
;
public
static
final
String
SEGMENT_IDENTITYLINKS_FAMILY_USERS
=
"users"
;
public
static
final
String
SEGMENT_VARIABLE_DATA
=
"data"
;
public
static
final
String
SEGMENT_VARIABLE_DATA
=
"data"
;
public
static
final
String
SEGMENT_HISTORIC_PROCESS_INSTANCE_RESOURCE
=
"historic-process-instances"
;
public
static
final
String
SEGMENT_HISTORIC_PROCESS_INSTANCE_RESOURCE
=
"historic-process-instances"
;
public
static
final
String
SEGMENT_HISTORIC_TASK_INSTANCE_RESOURCE
=
"historic-task-instances"
;
public
static
final
String
SEGMENT_HISTORIC_ACTIVITY_INSTANCE_RESOURCE
=
"historic-activity-instances"
;
public
static
final
String
SEGMENT_HISTORIC_VARIABLE_INSTANCE_RESOURCE
=
"historic-variable-instances"
;
public
static
final
String
SEGMENT_TABLES
=
"tables"
;
public
static
final
String
SEGMENT_TABLES
=
"tables"
;
/**
/**
...
@@ -229,11 +233,56 @@ public final class RestUrls {
...
@@ -229,11 +233,56 @@ public final class RestUrls {
*/
*/
public
static
final
String
[]
URL_PROCESS_INSTANCE_COMMENT
=
{
SEGMENT_RUNTIME_RESOURCES
,
SEGMENT_PROCESS_INSTANCE_RESOURCE
,
"{0}"
,
SEGMENT_COMMENTS
,
"{1}"
};
public
static
final
String
[]
URL_PROCESS_INSTANCE_COMMENT
=
{
SEGMENT_RUNTIME_RESOURCES
,
SEGMENT_PROCESS_INSTANCE_RESOURCE
,
"{0}"
,
SEGMENT_COMMENTS
,
"{1}"
};
/**
* URL template for a single historic process instance: <i>history/historic-process-instances/{0:processInstanceId}</i>
*/
public
static
final
String
[]
URL_HISTORIC_PROCESS_INSTANCE
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_PROCESS_INSTANCE_RESOURCE
,
"{0}"
};
/**
* URL template for historic process instance query: <i>history/historic-process-instances</i>
*/
public
static
final
String
[]
URL_HISTORIC_PROCESS_INSTANCES
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_PROCESS_INSTANCE_RESOURCE
};
/**
* URL template for a single historic task instance: <i>history/historic-task-instances/{0:taskId}</i>
*/
public
static
final
String
[]
URL_HISTORIC_TASK_INSTANCE
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_TASK_INSTANCE_RESOURCE
,
"{0}"
};
/**
* URL template for historic task instance query: <i>history/historic-task-instances</i>
*/
public
static
final
String
[]
URL_HISTORIC_TASK_INSTANCES
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_TASK_INSTANCE_RESOURCE
};
/**
* URL template for historic process instance query: <i>history/historic-activity-instances</i>
*/
public
static
final
String
[]
URL_HISTORIC_ACTIVITY_INSTANCES
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_ACTIVITY_INSTANCE_RESOURCE
};
/**
* URL template for historic process instance query: <i>history/historic-variable-instances</i>
*/
public
static
final
String
[]
URL_HISTORIC_VARIABLE_INSTANCES
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_VARIABLE_INSTANCE_RESOURCE
};
/**
/**
* URL template for historic process instance query: <i>query/historic-process-instances</i>
* URL template for historic process instance query: <i>query/historic-process-instances</i>
*/
*/
public
static
final
String
[]
URL_HISTORIC_PROCESS_INSTANCE_QUERY
=
{
SEGMENT_QUERY_RESOURCES
,
SEGMENT_HISTORIC_PROCESS_INSTANCE_RESOURCE
};
public
static
final
String
[]
URL_HISTORIC_PROCESS_INSTANCE_QUERY
=
{
SEGMENT_QUERY_RESOURCES
,
SEGMENT_HISTORIC_PROCESS_INSTANCE_RESOURCE
};
/**
* URL template for historic process instance query: <i>query/historic-task-instances</i>
*/
public
static
final
String
[]
URL_HISTORIC_TASK_INSTANCE_QUERY
=
{
SEGMENT_QUERY_RESOURCES
,
SEGMENT_HISTORIC_TASK_INSTANCE_RESOURCE
};
/**
* URL template for historic activity instance query: <i>query/historic-activity-instances</i>
*/
public
static
final
String
[]
URL_HISTORIC_ACTIVITY_INSTANCE_QUERY
=
{
SEGMENT_QUERY_RESOURCES
,
SEGMENT_HISTORIC_ACTIVITY_INSTANCE_RESOURCE
};
/**
* URL template for historic variable instance query: <i>query/historic-variable-instances</i>
*/
public
static
final
String
[]
URL_HISTORIC_VARIABLE_INSTANCE_QUERY
=
{
SEGMENT_QUERY_RESOURCES
,
SEGMENT_HISTORIC_VARIABLE_INSTANCE_RESOURCE
};
/**
/**
* URL template for the collection of tables: <i>management/tables</i>
* URL template for the collection of tables: <i>management/tables</i>
*/
*/
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceBaseResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.activiti.engine.history.HistoricActivityInstanceQuery
;
import
org.activiti.engine.impl.HistoricActivityInstanceQueryProperty
;
import
org.activiti.engine.query.QueryProperty
;
import
org.activiti.rest.api.ActivitiUtil
;
import
org.activiti.rest.api.DataResponse
;
import
org.activiti.rest.api.SecuredResource
;
import
org.restlet.data.Form
;
import
org.restlet.resource.Get
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstanceBaseResource
extends
SecuredResource
{
private
static
Map
<
String
,
QueryProperty
>
allowedSortProperties
=
new
HashMap
<
String
,
QueryProperty
>();
static
{
allowedSortProperties
.
put
(
"activityId"
,
HistoricActivityInstanceQueryProperty
.
ACTIVITY_ID
);
allowedSortProperties
.
put
(
"activityName"
,
HistoricActivityInstanceQueryProperty
.
ACTIVITY_NAME
);
allowedSortProperties
.
put
(
"activityType"
,
HistoricActivityInstanceQueryProperty
.
ACTIVITY_TYPE
);
allowedSortProperties
.
put
(
"duration"
,
HistoricActivityInstanceQueryProperty
.
DURATION
);
allowedSortProperties
.
put
(
"endTime"
,
HistoricActivityInstanceQueryProperty
.
END
);
allowedSortProperties
.
put
(
"executionId"
,
HistoricActivityInstanceQueryProperty
.
EXECUTION_ID
);
allowedSortProperties
.
put
(
"activityInstanceId"
,
HistoricActivityInstanceQueryProperty
.
HISTORIC_ACTIVITY_INSTANCE_ID
);
allowedSortProperties
.
put
(
"processDefinitionId"
,
HistoricActivityInstanceQueryProperty
.
PROCESS_DEFINITION_ID
);
allowedSortProperties
.
put
(
"processInstanceId"
,
HistoricActivityInstanceQueryProperty
.
PROCESS_INSTANCE_ID
);
allowedSortProperties
.
put
(
"startTime"
,
HistoricActivityInstanceQueryProperty
.
START
);
}
@Get
protected
DataResponse
getQueryResponse
(
HistoricActivityInstanceQueryRequest
queryRequest
,
Form
urlQuery
)
{
if
(!
authenticate
())
{
return
null
;
}
HistoricActivityInstanceQuery
query
=
ActivitiUtil
.
getHistoryService
().
createHistoricActivityInstanceQuery
();
// Populate query based on request
if
(
queryRequest
.
getActivityId
()
!=
null
)
{
query
.
activityId
(
queryRequest
.
getActivityId
());
}
if
(
queryRequest
.
getActivityInstanceId
()
!=
null
)
{
query
.
activityInstanceId
(
queryRequest
.
getActivityInstanceId
());
}
if
(
queryRequest
.
getActivityName
()
!=
null
)
{
query
.
activityName
(
queryRequest
.
getActivityName
());
}
if
(
queryRequest
.
getActivityType
()
!=
null
)
{
query
.
activityType
(
queryRequest
.
getActivityType
());
}
if
(
queryRequest
.
getExecutionId
()
!=
null
)
{
query
.
executionId
(
queryRequest
.
getExecutionId
());
}
if
(
queryRequest
.
getFinished
()
!=
null
)
{
Boolean
finished
=
queryRequest
.
getFinished
();
if
(
finished
)
{
query
.
finished
();
}
else
{
query
.
unfinished
();
}
}
if
(
queryRequest
.
getTaskAssignee
()
!=
null
)
{
query
.
taskAssignee
(
queryRequest
.
getTaskAssignee
());
}
if
(
queryRequest
.
getProcessInstanceId
()
!=
null
)
{
query
.
processInstanceId
(
queryRequest
.
getProcessInstanceId
());
}
if
(
queryRequest
.
getProcessDefinitionId
()
!=
null
)
{
query
.
processDefinitionId
(
queryRequest
.
getProcessDefinitionId
());
}
return
new
HistoricActivityInstancePaginateList
(
this
).
paginateList
(
urlQuery
,
query
,
"startTime"
,
allowedSortProperties
);
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceCollectionResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.rest.api.DataResponse
;
import
org.restlet.data.Form
;
import
org.restlet.resource.Get
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstanceCollectionResource
extends
HistoricActivityInstanceBaseResource
{
@Get
public
DataResponse
getHistoricActivityInstances
()
{
if
(!
authenticate
())
{
return
null
;
}
Form
urlQuery
=
getQuery
();
HistoricActivityInstanceQueryRequest
query
=
new
HistoricActivityInstanceQueryRequest
();
// Populate query based on request
if
(
getQueryParameter
(
"activityId"
,
urlQuery
)
!=
null
)
{
query
.
setActivityId
(
getQueryParameter
(
"activityId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"activityInstanceId"
,
urlQuery
)
!=
null
)
{
query
.
setActivityInstanceId
(
getQueryParameter
(
"activityInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"activityName"
,
urlQuery
)
!=
null
)
{
query
.
setActivityName
(
getQueryParameter
(
"activityName"
,
urlQuery
));
}
if
(
getQueryParameter
(
"activityType"
,
urlQuery
)
!=
null
)
{
query
.
setActivityType
(
getQueryParameter
(
"activityType"
,
urlQuery
));
}
if
(
getQueryParameter
(
"executionId"
,
urlQuery
)
!=
null
)
{
query
.
setExecutionId
(
getQueryParameter
(
"executionId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"finished"
,
urlQuery
)
!=
null
)
{
query
.
setFinished
(
getQueryParameterAsBoolean
(
"finished"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskAssignee"
,
urlQuery
)
!=
null
)
{
query
.
setTaskAssignee
(
getQueryParameter
(
"taskAssignee"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
)
!=
null
)
{
query
.
setProcessInstanceId
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processDefinitionId"
,
urlQuery
)
!=
null
)
{
query
.
setProcessDefinitionId
(
getQueryParameter
(
"processDefinitionId"
,
urlQuery
));
}
return
getQueryResponse
(
query
,
urlQuery
);
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstancePaginateList.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.activiti.engine.history.HistoricActivityInstance
;
import
org.activiti.rest.api.AbstractPaginateList
;
import
org.activiti.rest.api.RestResponseFactory
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstancePaginateList
extends
AbstractPaginateList
{
private
SecuredResource
resource
;
public
HistoricActivityInstancePaginateList
(
SecuredResource
resource
)
{
this
.
resource
=
resource
;
}
@SuppressWarnings
(
"rawtypes"
)
@Override
protected
List
processList
(
List
list
)
{
List
<
HistoricActivityInstanceResponse
>
responseList
=
new
ArrayList
<
HistoricActivityInstanceResponse
>();
RestResponseFactory
restResponseFactory
=
resource
.
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
();
for
(
Object
instance
:
list
)
{
responseList
.
add
(
restResponseFactory
.
createHistoricActivityInstanceResponse
(
resource
,
(
HistoricActivityInstance
)
instance
));
}
return
responseList
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceQueryRequest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstanceQueryRequest
{
private
String
activityId
;
private
String
activityInstanceId
;
private
String
activityName
;
private
String
activityType
;
private
String
executionId
;
private
Boolean
finished
;
private
String
taskAssignee
;
private
String
processInstanceId
;
private
String
processDefinitionId
;
public
String
getActivityId
()
{
return
activityId
;
}
public
void
setActivityId
(
String
activityId
)
{
this
.
activityId
=
activityId
;
}
public
String
getActivityInstanceId
()
{
return
activityInstanceId
;
}
public
void
setActivityInstanceId
(
String
activityInstanceId
)
{
this
.
activityInstanceId
=
activityInstanceId
;
}
public
String
getActivityName
()
{
return
activityName
;
}
public
void
setActivityName
(
String
activityName
)
{
this
.
activityName
=
activityName
;
}
public
String
getActivityType
()
{
return
activityType
;
}
public
void
setActivityType
(
String
activityType
)
{
this
.
activityType
=
activityType
;
}
public
String
getExecutionId
()
{
return
executionId
;
}
public
void
setExecutionId
(
String
executionId
)
{
this
.
executionId
=
executionId
;
}
public
Boolean
getFinished
()
{
return
finished
;
}
public
void
setFinished
(
Boolean
finished
)
{
this
.
finished
=
finished
;
}
public
String
getTaskAssignee
()
{
return
taskAssignee
;
}
public
void
setTaskAssignee
(
String
taskAssignee
)
{
this
.
taskAssignee
=
taskAssignee
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
void
setProcessInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
}
public
String
getProcessDefinitionId
()
{
return
processDefinitionId
;
}
public
void
setProcessDefinitionId
(
String
processDefinitionId
)
{
this
.
processDefinitionId
=
processDefinitionId
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceQueryResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.rest.api.DataResponse
;
import
org.restlet.resource.Post
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstanceQueryResource
extends
HistoricActivityInstanceBaseResource
{
@Post
public
DataResponse
queryActivityInstances
(
HistoricActivityInstanceQueryRequest
queryRequest
)
{
return
getQueryResponse
(
queryRequest
,
getQuery
());
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricActivityInstanceResponse.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.Date
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstanceResponse
{
protected
String
id
;
protected
String
activityId
;
protected
String
activityName
;
protected
String
activityType
;
protected
String
processDefinitionId
;
protected
String
processDefinitionUrl
;
protected
String
processInstanceId
;
protected
String
processInstanceUrl
;
protected
String
executionId
;
protected
String
taskId
;
protected
String
calledProcessInstanceId
;
protected
String
assignee
;
protected
Date
startTime
;
protected
Date
endTime
;
protected
Long
durationInMillis
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getActivityId
()
{
return
activityId
;
}
public
void
setActivityId
(
String
activityId
)
{
this
.
activityId
=
activityId
;
}
public
String
getActivityName
()
{
return
activityName
;
}
public
void
setActivityName
(
String
activityName
)
{
this
.
activityName
=
activityName
;
}
public
String
getActivityType
()
{
return
activityType
;
}
public
void
setActivityType
(
String
activityType
)
{
this
.
activityType
=
activityType
;
}
public
String
getProcessDefinitionId
()
{
return
processDefinitionId
;
}
public
void
setProcessDefinitionId
(
String
processDefinitionId
)
{
this
.
processDefinitionId
=
processDefinitionId
;
}
public
String
getProcessDefinitionUrl
()
{
return
processDefinitionUrl
;
}
public
void
setProcessDefinitionUrl
(
String
processDefinitionUrl
)
{
this
.
processDefinitionUrl
=
processDefinitionUrl
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
void
setProcessInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
}
public
String
getProcessInstanceUrl
()
{
return
processInstanceUrl
;
}
public
void
setProcessInstanceUrl
(
String
processInstanceUrl
)
{
this
.
processInstanceUrl
=
processInstanceUrl
;
}
public
String
getExecutionId
()
{
return
executionId
;
}
public
void
setExecutionId
(
String
executionId
)
{
this
.
executionId
=
executionId
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
public
String
getCalledProcessInstanceId
()
{
return
calledProcessInstanceId
;
}
public
void
setCalledProcessInstanceId
(
String
calledProcessInstanceId
)
{
this
.
calledProcessInstanceId
=
calledProcessInstanceId
;
}
public
String
getAssignee
()
{
return
assignee
;
}
public
void
setAssignee
(
String
assignee
)
{
this
.
assignee
=
assignee
;
}
public
Date
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Date
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Long
getDurationInMillis
()
{
return
durationInMillis
;
}
public
void
setDurationInMillis
(
Long
durationInMillis
)
{
this
.
durationInMillis
=
durationInMillis
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricProcessInstanceResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.ActivitiObjectNotFoundException
;
import
org.activiti.engine.history.HistoricProcessInstance
;
import
org.activiti.rest.api.ActivitiUtil
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
import
org.restlet.resource.Get
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricProcessInstanceResource
extends
SecuredResource
{
@Get
public
HistoricProcessInstanceResponse
getProcessInstance
()
{
if
(!
authenticate
())
{
return
null
;
}
return
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
createHistoricProcessInstanceResponse
(
this
,
getHistoricProcessInstanceFromRequest
());
}
protected
HistoricProcessInstance
getHistoricProcessInstanceFromRequest
()
{
String
processInstanceId
=
getAttribute
(
"processInstanceId"
);
if
(
processInstanceId
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"The processInstanceId cannot be null"
);
}
HistoricProcessInstance
processInstance
=
ActivitiUtil
.
getHistoryService
().
createHistoricProcessInstanceQuery
()
.
processInstanceId
(
processInstanceId
).
singleResult
();
if
(
processInstance
==
null
)
{
throw
new
ActivitiObjectNotFoundException
(
"Could not find a process instance with id '"
+
processInstanceId
+
"'."
,
HistoricProcessInstance
.
class
);
}
return
processInstance
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricProcessInstanceResponse.java
浏览文件 @
6b472565
...
@@ -23,6 +23,7 @@ public class HistoricProcessInstanceResponse {
...
@@ -23,6 +23,7 @@ public class HistoricProcessInstanceResponse {
protected
String
id
;
protected
String
id
;
protected
String
url
;
protected
String
url
;
protected
String
businessKey
;
protected
String
businessKey
;
protected
String
processDefinitionId
;
protected
String
processDefinitionUrl
;
protected
String
processDefinitionUrl
;
protected
Date
startTime
;
protected
Date
startTime
;
protected
Date
endTime
;
protected
Date
endTime
;
...
@@ -51,6 +52,12 @@ public class HistoricProcessInstanceResponse {
...
@@ -51,6 +52,12 @@ public class HistoricProcessInstanceResponse {
public
void
setBusinessKey
(
String
businessKey
)
{
public
void
setBusinessKey
(
String
businessKey
)
{
this
.
businessKey
=
businessKey
;
this
.
businessKey
=
businessKey
;
}
}
public
String
getProcessDefinitionId
()
{
return
processDefinitionId
;
}
public
void
setProcessDefinitionId
(
String
processDefinitionId
)
{
this
.
processDefinitionId
=
processDefinitionId
;
}
public
String
getProcessDefinitionUrl
()
{
public
String
getProcessDefinitionUrl
()
{
return
processDefinitionUrl
;
return
processDefinitionUrl
;
}
}
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceBaseResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.history.HistoricTaskInstanceQuery
;
import
org.activiti.engine.impl.HistoricTaskInstanceQueryProperty
;
import
org.activiti.engine.query.QueryProperty
;
import
org.activiti.rest.api.ActivitiUtil
;
import
org.activiti.rest.api.DataResponse
;
import
org.activiti.rest.api.RestResponseFactory
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.api.engine.variable.QueryVariable
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
import
org.restlet.data.Form
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceBaseResource
extends
SecuredResource
{
private
static
Map
<
String
,
QueryProperty
>
allowedSortProperties
=
new
HashMap
<
String
,
QueryProperty
>();
static
{
allowedSortProperties
.
put
(
"deleteReason"
,
HistoricTaskInstanceQueryProperty
.
DELETE_REASON
);
allowedSortProperties
.
put
(
"duration"
,
HistoricTaskInstanceQueryProperty
.
DURATION
);
allowedSortProperties
.
put
(
"endTime"
,
HistoricTaskInstanceQueryProperty
.
END
);
allowedSortProperties
.
put
(
"executionId"
,
HistoricTaskInstanceQueryProperty
.
EXECUTION_ID
);
allowedSortProperties
.
put
(
"taskInstanceId"
,
HistoricTaskInstanceQueryProperty
.
HISTORIC_TASK_INSTANCE_ID
);
allowedSortProperties
.
put
(
"processDefinitionId"
,
HistoricTaskInstanceQueryProperty
.
PROCESS_DEFINITION_ID
);
allowedSortProperties
.
put
(
"processInstanceId"
,
HistoricTaskInstanceQueryProperty
.
PROCESS_INSTANCE_ID
);
allowedSortProperties
.
put
(
"start"
,
HistoricTaskInstanceQueryProperty
.
START
);
allowedSortProperties
.
put
(
"assignee"
,
HistoricTaskInstanceQueryProperty
.
TASK_ASSIGNEE
);
allowedSortProperties
.
put
(
"taskDefinitionKey"
,
HistoricTaskInstanceQueryProperty
.
TASK_DEFINITION_KEY
);
allowedSortProperties
.
put
(
"descriptipn"
,
HistoricTaskInstanceQueryProperty
.
TASK_DESCRIPTION
);
allowedSortProperties
.
put
(
"dueDate"
,
HistoricTaskInstanceQueryProperty
.
TASK_DUE_DATE
);
allowedSortProperties
.
put
(
"name"
,
HistoricTaskInstanceQueryProperty
.
TASK_NAME
);
allowedSortProperties
.
put
(
"owner"
,
HistoricTaskInstanceQueryProperty
.
TASK_OWNER
);
allowedSortProperties
.
put
(
"priority"
,
HistoricTaskInstanceQueryProperty
.
TASK_PRIORITY
);
}
protected
DataResponse
getQueryResponse
(
HistoricTaskInstanceQueryRequest
queryRequest
,
Form
urlQuery
)
{
HistoricTaskInstanceQuery
query
=
ActivitiUtil
.
getHistoryService
().
createHistoricTaskInstanceQuery
();
// Populate query based on request
if
(
queryRequest
.
getTaskId
()
!=
null
)
{
query
.
taskId
(
queryRequest
.
getTaskId
());
}
if
(
queryRequest
.
getProcessInstanceId
()
!=
null
)
{
query
.
processInstanceId
(
queryRequest
.
getProcessInstanceId
());
}
if
(
queryRequest
.
getProcessBusinessKey
()
!=
null
)
{
query
.
processInstanceBusinessKey
(
queryRequest
.
getProcessBusinessKey
());
}
if
(
queryRequest
.
getProcessDefinitionKey
()
!=
null
)
{
query
.
processDefinitionKey
(
queryRequest
.
getProcessDefinitionKey
());
}
if
(
queryRequest
.
getProcessDefinitionId
()
!=
null
)
{
query
.
processDefinitionId
(
queryRequest
.
getProcessDefinitionId
());
}
if
(
queryRequest
.
getProcessDefinitionName
()
!=
null
)
{
query
.
processDefinitionName
(
queryRequest
.
getProcessDefinitionName
());
}
if
(
queryRequest
.
getExecutionId
()
!=
null
)
{
query
.
executionId
(
queryRequest
.
getExecutionId
());
}
if
(
queryRequest
.
getTaskName
()
!=
null
)
{
query
.
taskName
(
queryRequest
.
getTaskName
());
}
if
(
queryRequest
.
getTaskNameLike
()
!=
null
)
{
query
.
taskNameLike
(
queryRequest
.
getTaskNameLike
());
}
if
(
queryRequest
.
getTaskDescription
()
!=
null
)
{
query
.
taskDescription
(
queryRequest
.
getTaskDescription
());
}
if
(
queryRequest
.
getTaskDescriptionLike
()
!=
null
)
{
query
.
taskDescriptionLike
(
queryRequest
.
getTaskDescriptionLike
());
}
if
(
queryRequest
.
getTaskDefinitionKey
()
!=
null
)
{
query
.
taskDefinitionKey
(
queryRequest
.
getTaskDefinitionKey
());
}
if
(
queryRequest
.
getTaskDeleteReason
()
!=
null
)
{
query
.
taskDeleteReason
(
queryRequest
.
getTaskDeleteReason
());
}
if
(
queryRequest
.
getTaskDeleteReasonLike
()
!=
null
)
{
query
.
taskDeleteReasonLike
(
queryRequest
.
getTaskDeleteReasonLike
());
}
if
(
queryRequest
.
getTaskAssignee
()
!=
null
)
{
query
.
taskAssignee
(
queryRequest
.
getTaskAssignee
());
}
if
(
queryRequest
.
getTaskAssigneeLike
()
!=
null
)
{
query
.
taskAssigneeLike
(
queryRequest
.
getTaskAssigneeLike
());
}
if
(
queryRequest
.
getTaskOwner
()
!=
null
)
{
query
.
taskOwner
(
queryRequest
.
getTaskOwner
());
}
if
(
queryRequest
.
getTaskOwnerLike
()
!=
null
)
{
query
.
taskOwnerLike
(
queryRequest
.
getTaskOwnerLike
());
}
if
(
queryRequest
.
getTaskInvolvedUser
()
!=
null
)
{
query
.
taskInvolvedUser
(
queryRequest
.
getTaskInvolvedUser
());
}
if
(
queryRequest
.
getTaskPriority
()
!=
null
)
{
query
.
taskPriority
(
queryRequest
.
getTaskPriority
());
}
if
(
queryRequest
.
getFinished
()
!=
null
)
{
if
(
queryRequest
.
getFinished
())
{
query
.
finished
();
}
else
{
query
.
unfinished
();
}
}
if
(
queryRequest
.
getProcessFinished
()
!=
null
)
{
if
(
queryRequest
.
getProcessFinished
())
{
query
.
processFinished
();
}
else
{
query
.
processUnfinished
();
}
}
if
(
queryRequest
.
getParentTaskId
()
!=
null
)
{
query
.
taskParentTaskId
(
queryRequest
.
getParentTaskId
());
}
if
(
queryRequest
.
getDueDate
()
!=
null
)
{
query
.
taskDueDate
(
queryRequest
.
getDueDate
());
}
if
(
queryRequest
.
getDueDateAfter
()
!=
null
)
{
query
.
taskDueAfter
(
queryRequest
.
getDueDateAfter
());
}
if
(
queryRequest
.
getDueDateBefore
()
!=
null
)
{
query
.
taskDueBefore
(
queryRequest
.
getDueDateBefore
());
}
if
(
queryRequest
.
getTaskCreatedOn
()
!=
null
)
{
query
.
taskCreatedOn
(
queryRequest
.
getTaskCreatedOn
());
}
if
(
queryRequest
.
getTaskVariables
()
!=
null
)
{
addTaskVariables
(
query
,
queryRequest
.
getTaskVariables
());
}
if
(
queryRequest
.
getProcessVariables
()
!=
null
)
{
addProcessVariables
(
query
,
queryRequest
.
getProcessVariables
());
}
return
new
HistoricTaskInstancePaginateList
(
this
).
paginateList
(
urlQuery
,
query
,
"taskInstanceId"
,
allowedSortProperties
);
}
protected
void
addTaskVariables
(
HistoricTaskInstanceQuery
taskInstanceQuery
,
List
<
QueryVariable
>
variables
)
{
RestResponseFactory
responseFactory
=
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
();
for
(
QueryVariable
variable
:
variables
)
{
if
(
variable
.
getVariableOperation
()
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"Variable operation is missing for variable: "
+
variable
.
getName
());
}
if
(
variable
.
getValue
()
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"Variable value is missing for variable: "
+
variable
.
getName
());
}
boolean
nameLess
=
variable
.
getName
()
==
null
;
Object
actualValue
=
responseFactory
.
getVariableValue
(
variable
);
// A value-only query is only possible using equals-operator
if
(
nameLess
)
{
throw
new
ActivitiIllegalArgumentException
(
"Value-only query (without a variable-name) is not supported."
);
}
switch
(
variable
.
getVariableOperation
())
{
case
EQUALS:
taskInstanceQuery
.
taskVariableValueEquals
(
variable
.
getName
(),
actualValue
);
break
;
default
:
throw
new
ActivitiIllegalArgumentException
(
"Unsupported variable query operation: "
+
variable
.
getVariableOperation
());
}
}
}
protected
void
addProcessVariables
(
HistoricTaskInstanceQuery
taskInstanceQuery
,
List
<
QueryVariable
>
variables
)
{
RestResponseFactory
responseFactory
=
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
();
for
(
QueryVariable
variable
:
variables
)
{
if
(
variable
.
getVariableOperation
()
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"Variable operation is missing for variable: "
+
variable
.
getName
());
}
if
(
variable
.
getValue
()
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"Variable value is missing for variable: "
+
variable
.
getName
());
}
boolean
nameLess
=
variable
.
getName
()
==
null
;
Object
actualValue
=
responseFactory
.
getVariableValue
(
variable
);
// A value-only query is only possible using equals-operator
if
(
nameLess
)
{
throw
new
ActivitiIllegalArgumentException
(
"Value-only query (without a variable-name) is not supported."
);
}
switch
(
variable
.
getVariableOperation
())
{
case
EQUALS:
taskInstanceQuery
.
processVariableValueEquals
(
variable
.
getName
(),
actualValue
);
break
;
default
:
throw
new
ActivitiIllegalArgumentException
(
"Unsupported variable query operation: "
+
variable
.
getVariableOperation
());
}
}
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceCollectionResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.rest.api.DataResponse
;
import
org.restlet.data.Form
;
import
org.restlet.resource.Get
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceCollectionResource
extends
HistoricProcessInstanceBaseResource
{
@Get
public
DataResponse
getHistoricProcessInstances
()
{
if
(!
authenticate
())
{
return
null
;
}
Form
urlQuery
=
getQuery
();
// Populate query based on request
HistoricProcessInstanceQueryRequest
queryRequest
=
new
HistoricProcessInstanceQueryRequest
();
if
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessInstanceId
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processDefinitionKey"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessDefinitionKey
(
getQueryParameter
(
"processDefinitionKey"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processDefinitionId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessDefinitionId
(
getQueryParameter
(
"processDefinitionId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"businessKey"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessBusinessKey
(
getQueryParameter
(
"businessKey"
,
urlQuery
));
}
if
(
getQueryParameter
(
"involvedUser"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setInvolvedUser
(
getQueryParameter
(
"involvedUser"
,
urlQuery
));
}
if
(
getQueryParameter
(
"finished"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setFinished
(
getQueryParameterAsBoolean
(
"finished"
,
urlQuery
));
}
if
(
getQueryParameter
(
"superProcessInstanceId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setSuperProcessInstanceId
(
getQueryParameter
(
"superProcessInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"finishedAfter"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setFinishedAfter
(
getQueryParameterAsDate
(
"finishedAfter"
,
urlQuery
));
}
if
(
getQueryParameter
(
"finishedBefore"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setFinishedBefore
(
getQueryParameterAsDate
(
"finishedBefore"
,
urlQuery
));
}
if
(
getQueryParameter
(
"startedAfter"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setStartedAfter
(
getQueryParameterAsDate
(
"startedAfter"
,
urlQuery
));
}
if
(
getQueryParameter
(
"startedBefore"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setStartedBefore
(
getQueryParameterAsDate
(
"startedBefore"
,
urlQuery
));
}
if
(
getQueryParameter
(
"startedBy"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setStartedBy
(
getQueryParameter
(
"startedBy"
,
urlQuery
));
}
return
getQueryResponse
(
queryRequest
,
urlQuery
);
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstancePaginateList.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.activiti.engine.history.HistoricTaskInstance
;
import
org.activiti.rest.api.AbstractPaginateList
;
import
org.activiti.rest.api.RestResponseFactory
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstancePaginateList
extends
AbstractPaginateList
{
private
SecuredResource
resource
;
public
HistoricTaskInstancePaginateList
(
SecuredResource
resource
)
{
this
.
resource
=
resource
;
}
@SuppressWarnings
(
"rawtypes"
)
@Override
protected
List
processList
(
List
list
)
{
List
<
HistoricTaskInstanceResponse
>
responseList
=
new
ArrayList
<
HistoricTaskInstanceResponse
>();
RestResponseFactory
restResponseFactory
=
resource
.
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
();
for
(
Object
instance
:
list
)
{
responseList
.
add
(
restResponseFactory
.
createHistoricTaskInstanceResponse
(
resource
,
(
HistoricTaskInstance
)
instance
));
}
return
responseList
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceQueryRequest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.Date
;
import
java.util.List
;
import
org.activiti.rest.api.engine.variable.QueryVariable
;
import
org.codehaus.jackson.annotate.JsonTypeInfo
;
import
org.codehaus.jackson.annotate.JsonTypeInfo.Id
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceQueryRequest
{
private
String
taskId
;
private
String
processInstanceId
;
private
String
processBusinessKey
;
private
String
processDefinitionId
;
private
String
processDefinitionKey
;
private
String
processDefinitionName
;
private
String
executionId
;
private
String
taskName
;
private
String
taskNameLike
;
private
String
taskDescription
;
private
String
taskDescriptionLike
;
private
String
taskDefinitionKey
;
private
String
taskDeleteReason
;
private
String
taskDeleteReasonLike
;
private
String
taskAssignee
;
private
String
taskAssigneeLike
;
private
String
taskOwner
;
private
String
taskOwnerLike
;
private
String
taskInvolvedUser
;
private
Integer
taskPriority
;
private
Boolean
finished
;
private
Boolean
processFinished
;
private
String
parentTaskId
;
private
Date
dueDate
;
private
Date
dueDateAfter
;
private
Date
dueDateBefore
;
private
Date
taskCreatedOn
;
private
List
<
QueryVariable
>
taskVariables
;
private
List
<
QueryVariable
>
processVariables
;
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
void
setProcessInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
}
public
String
getProcessBusinessKey
()
{
return
processBusinessKey
;
}
public
void
setProcessBusinessKey
(
String
processBusinessKey
)
{
this
.
processBusinessKey
=
processBusinessKey
;
}
public
String
getProcessDefinitionId
()
{
return
processDefinitionId
;
}
public
void
setProcessDefinitionId
(
String
processDefinitionId
)
{
this
.
processDefinitionId
=
processDefinitionId
;
}
public
String
getProcessDefinitionKey
()
{
return
processDefinitionKey
;
}
public
void
setProcessDefinitionKey
(
String
processDefinitionKey
)
{
this
.
processDefinitionKey
=
processDefinitionKey
;
}
public
String
getProcessDefinitionName
()
{
return
processDefinitionName
;
}
public
void
setProcessDefinitionName
(
String
processDefinitionName
)
{
this
.
processDefinitionName
=
processDefinitionName
;
}
public
String
getExecutionId
()
{
return
executionId
;
}
public
void
setExecutionId
(
String
executionId
)
{
this
.
executionId
=
executionId
;
}
public
String
getTaskName
()
{
return
taskName
;
}
public
void
setTaskName
(
String
taskName
)
{
this
.
taskName
=
taskName
;
}
public
String
getTaskNameLike
()
{
return
taskNameLike
;
}
public
void
setTaskNameLike
(
String
taskNameLike
)
{
this
.
taskNameLike
=
taskNameLike
;
}
public
String
getTaskDescription
()
{
return
taskDescription
;
}
public
void
setTaskDescription
(
String
taskDescription
)
{
this
.
taskDescription
=
taskDescription
;
}
public
String
getTaskDescriptionLike
()
{
return
taskDescriptionLike
;
}
public
void
setTaskDescriptionLike
(
String
taskDescriptionLike
)
{
this
.
taskDescriptionLike
=
taskDescriptionLike
;
}
public
String
getTaskDefinitionKey
()
{
return
taskDefinitionKey
;
}
public
void
setTaskDefinitionKey
(
String
taskDefinitionKey
)
{
this
.
taskDefinitionKey
=
taskDefinitionKey
;
}
public
String
getTaskDeleteReason
()
{
return
taskDeleteReason
;
}
public
void
setTaskDeleteReason
(
String
taskDeleteReason
)
{
this
.
taskDeleteReason
=
taskDeleteReason
;
}
public
String
getTaskDeleteReasonLike
()
{
return
taskDeleteReasonLike
;
}
public
void
setTaskDeleteReasonLike
(
String
taskDeleteReasonLike
)
{
this
.
taskDeleteReasonLike
=
taskDeleteReasonLike
;
}
public
String
getTaskAssignee
()
{
return
taskAssignee
;
}
public
void
setTaskAssignee
(
String
taskAssignee
)
{
this
.
taskAssignee
=
taskAssignee
;
}
public
String
getTaskAssigneeLike
()
{
return
taskAssigneeLike
;
}
public
void
setTaskAssigneeLike
(
String
taskAssigneeLike
)
{
this
.
taskAssigneeLike
=
taskAssigneeLike
;
}
public
String
getTaskOwner
()
{
return
taskOwner
;
}
public
void
setTaskOwner
(
String
taskOwner
)
{
this
.
taskOwner
=
taskOwner
;
}
public
String
getTaskOwnerLike
()
{
return
taskOwnerLike
;
}
public
void
setTaskOwnerLike
(
String
taskOwnerLike
)
{
this
.
taskOwnerLike
=
taskOwnerLike
;
}
public
String
getTaskInvolvedUser
()
{
return
taskInvolvedUser
;
}
public
void
setTaskInvolvedUser
(
String
taskInvolvedUser
)
{
this
.
taskInvolvedUser
=
taskInvolvedUser
;
}
public
Integer
getTaskPriority
()
{
return
taskPriority
;
}
public
void
setTaskPriority
(
Integer
taskPriority
)
{
this
.
taskPriority
=
taskPriority
;
}
public
Boolean
getFinished
()
{
return
finished
;
}
public
void
setFinished
(
Boolean
finished
)
{
this
.
finished
=
finished
;
}
public
Boolean
getProcessFinished
()
{
return
processFinished
;
}
public
void
setProcessFinished
(
Boolean
processFinished
)
{
this
.
processFinished
=
processFinished
;
}
public
String
getParentTaskId
()
{
return
parentTaskId
;
}
public
void
setParentTaskId
(
String
parentTaskId
)
{
this
.
parentTaskId
=
parentTaskId
;
}
public
Date
getDueDate
()
{
return
dueDate
;
}
public
void
setDueDate
(
Date
dueDate
)
{
this
.
dueDate
=
dueDate
;
}
public
Date
getDueDateAfter
()
{
return
dueDateAfter
;
}
public
void
setDueDateAfter
(
Date
dueDateAfter
)
{
this
.
dueDateAfter
=
dueDateAfter
;
}
public
Date
getDueDateBefore
()
{
return
dueDateBefore
;
}
public
void
setDueDateBefore
(
Date
dueDateBefore
)
{
this
.
dueDateBefore
=
dueDateBefore
;
}
public
Date
getTaskCreatedOn
()
{
return
taskCreatedOn
;
}
public
void
setTaskCreatedOn
(
Date
taskCreatedOn
)
{
this
.
taskCreatedOn
=
taskCreatedOn
;
}
@JsonTypeInfo
(
use
=
Id
.
CLASS
,
defaultImpl
=
QueryVariable
.
class
)
public
List
<
QueryVariable
>
getTaskVariables
()
{
return
taskVariables
;
}
public
void
setTaskVariables
(
List
<
QueryVariable
>
taskVariables
)
{
this
.
taskVariables
=
taskVariables
;
}
@JsonTypeInfo
(
use
=
Id
.
CLASS
,
defaultImpl
=
QueryVariable
.
class
)
public
List
<
QueryVariable
>
getProcessVariables
()
{
return
processVariables
;
}
public
void
setProcessVariables
(
List
<
QueryVariable
>
processVariables
)
{
this
.
processVariables
=
processVariables
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceQueryResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.rest.api.DataResponse
;
import
org.restlet.resource.Post
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceQueryResource
extends
HistoricTaskInstanceBaseResource
{
@Post
public
DataResponse
queryProcessInstances
(
HistoricTaskInstanceQueryRequest
queryRequest
)
{
return
getQueryResponse
(
queryRequest
,
getQuery
());
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.ActivitiObjectNotFoundException
;
import
org.activiti.engine.history.HistoricTaskInstance
;
import
org.activiti.rest.api.ActivitiUtil
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
import
org.restlet.resource.Get
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceResource
extends
SecuredResource
{
@Get
public
HistoricTaskInstanceResponse
getTaskInstance
()
{
if
(!
authenticate
())
{
return
null
;
}
return
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
createHistoricTaskInstanceResponse
(
this
,
getHistoricTaskInstanceFromRequest
());
}
protected
HistoricTaskInstance
getHistoricTaskInstanceFromRequest
()
{
String
taskId
=
getAttribute
(
"taskId"
);
if
(
taskId
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"The taskId cannot be null"
);
}
HistoricTaskInstance
taskInstance
=
ActivitiUtil
.
getHistoryService
().
createHistoricTaskInstanceQuery
()
.
taskId
(
taskId
).
singleResult
();
if
(
taskInstance
==
null
)
{
throw
new
ActivitiObjectNotFoundException
(
"Could not find a task instance with id '"
+
taskId
+
"'."
,
HistoricTaskInstance
.
class
);
}
return
taskInstance
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceResponse.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.Date
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceResponse
{
private
String
id
;
private
String
processDefinitionId
;
private
String
processDefinitionUrl
;
private
String
processInstanceId
;
private
String
processInstanceUrl
;
private
String
executionId
;
private
String
name
;
private
String
description
;
private
String
deleteReason
;
private
String
owner
;
private
String
assignee
;
private
Date
startTime
;
private
Date
endTime
;
private
Long
durationInMillis
;
private
Long
workTimeInMillis
;
private
Date
claimTime
;
private
String
taskDefinitionKey
;
private
String
formKey
;
private
Integer
priority
;
private
Date
dueDate
;
private
String
parentTaskId
;
private
String
url
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getProcessDefinitionId
()
{
return
processDefinitionId
;
}
public
void
setProcessDefinitionId
(
String
processDefinitionId
)
{
this
.
processDefinitionId
=
processDefinitionId
;
}
public
String
getProcessDefinitionUrl
()
{
return
processDefinitionUrl
;
}
public
void
setProcessDefinitionUrl
(
String
processDefinitionUrl
)
{
this
.
processDefinitionUrl
=
processDefinitionUrl
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
void
setProcessInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
}
public
String
getProcessInstanceUrl
()
{
return
processInstanceUrl
;
}
public
void
setProcessInstanceUrl
(
String
processInstanceUrl
)
{
this
.
processInstanceUrl
=
processInstanceUrl
;
}
public
String
getExecutionId
()
{
return
executionId
;
}
public
void
setExecutionId
(
String
executionId
)
{
this
.
executionId
=
executionId
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getDeleteReason
()
{
return
deleteReason
;
}
public
void
setDeleteReason
(
String
deleteReason
)
{
this
.
deleteReason
=
deleteReason
;
}
public
String
getOwner
()
{
return
owner
;
}
public
void
setOwner
(
String
owner
)
{
this
.
owner
=
owner
;
}
public
String
getAssignee
()
{
return
assignee
;
}
public
void
setAssignee
(
String
assignee
)
{
this
.
assignee
=
assignee
;
}
public
Date
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Date
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Long
getDurationInMillis
()
{
return
durationInMillis
;
}
public
void
setDurationInMillis
(
Long
durationInMillis
)
{
this
.
durationInMillis
=
durationInMillis
;
}
public
Long
getWorkTimeInMillis
()
{
return
workTimeInMillis
;
}
public
void
setWorkTimeInMillis
(
Long
workTimeInMillis
)
{
this
.
workTimeInMillis
=
workTimeInMillis
;
}
public
Date
getClaimTime
()
{
return
claimTime
;
}
public
void
setClaimTime
(
Date
claimTime
)
{
this
.
claimTime
=
claimTime
;
}
public
String
getTaskDefinitionKey
()
{
return
taskDefinitionKey
;
}
public
void
setTaskDefinitionKey
(
String
taskDefinitionKey
)
{
this
.
taskDefinitionKey
=
taskDefinitionKey
;
}
public
String
getFormKey
()
{
return
formKey
;
}
public
void
setFormKey
(
String
formKey
)
{
this
.
formKey
=
formKey
;
}
public
Integer
getPriority
()
{
return
priority
;
}
public
void
setPriority
(
Integer
priority
)
{
this
.
priority
=
priority
;
}
public
Date
getDueDate
()
{
return
dueDate
;
}
public
void
setDueDate
(
Date
dueDate
)
{
this
.
dueDate
=
dueDate
;
}
public
String
getParentTaskId
()
{
return
parentTaskId
;
}
public
void
setParentTaskId
(
String
parentTaskId
)
{
this
.
parentTaskId
=
parentTaskId
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceBaseResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.history.HistoricVariableInstanceQuery
;
import
org.activiti.engine.impl.HistoricVariableInstanceQueryProperty
;
import
org.activiti.engine.query.QueryProperty
;
import
org.activiti.rest.api.ActivitiUtil
;
import
org.activiti.rest.api.DataResponse
;
import
org.activiti.rest.api.RestResponseFactory
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.api.engine.variable.QueryVariable
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
import
org.restlet.data.Form
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstanceBaseResource
extends
SecuredResource
{
private
static
Map
<
String
,
QueryProperty
>
allowedSortProperties
=
new
HashMap
<
String
,
QueryProperty
>();
static
{
allowedSortProperties
.
put
(
"processInstanceId"
,
HistoricVariableInstanceQueryProperty
.
PROCESS_INSTANCE_ID
);
allowedSortProperties
.
put
(
"variableName"
,
HistoricVariableInstanceQueryProperty
.
VARIABLE_NAME
);
}
protected
DataResponse
getQueryResponse
(
HistoricVariableInstanceQueryRequest
queryRequest
,
Form
urlQuery
)
{
HistoricVariableInstanceQuery
query
=
ActivitiUtil
.
getHistoryService
().
createHistoricVariableInstanceQuery
();
// Populate query based on request
if
(
queryRequest
.
getExcludeTaskVariables
()
!=
null
)
{
if
(
queryRequest
.
getExcludeTaskVariables
())
{
query
.
excludeTaskVariables
();
}
}
if
(
queryRequest
.
getTaskId
()
!=
null
)
{
query
.
taskId
(
queryRequest
.
getTaskId
());
}
if
(
queryRequest
.
getProcessInstanceId
()
!=
null
)
{
query
.
processInstanceId
(
queryRequest
.
getProcessInstanceId
());
}
if
(
queryRequest
.
getVariableName
()
!=
null
)
{
query
.
variableName
(
queryRequest
.
getVariableName
());
}
if
(
queryRequest
.
getVariableNameLike
()
!=
null
)
{
query
.
variableNameLike
(
queryRequest
.
getVariableNameLike
()
);
}
if
(
queryRequest
.
getVariables
()
!=
null
)
{
addVariables
(
query
,
queryRequest
.
getVariables
());
}
return
new
HistoricVariableInstancePaginateList
(
this
).
paginateList
(
urlQuery
,
query
,
"variableName"
,
allowedSortProperties
);
}
protected
void
addVariables
(
HistoricVariableInstanceQuery
variableInstanceQuery
,
List
<
QueryVariable
>
variables
)
{
RestResponseFactory
responseFactory
=
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
();
for
(
QueryVariable
variable
:
variables
)
{
if
(
variable
.
getVariableOperation
()
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"Variable operation is missing for variable: "
+
variable
.
getName
());
}
if
(
variable
.
getValue
()
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"Variable value is missing for variable: "
+
variable
.
getName
());
}
boolean
nameLess
=
variable
.
getName
()
==
null
;
Object
actualValue
=
responseFactory
.
getVariableValue
(
variable
);
// A value-only query is only possible using equals-operator
if
(
nameLess
)
{
throw
new
ActivitiIllegalArgumentException
(
"Value-only query (without a variable-name) is not supported"
);
}
switch
(
variable
.
getVariableOperation
())
{
case
EQUALS:
variableInstanceQuery
.
variableValueEquals
(
variable
.
getName
(),
actualValue
);
break
;
default
:
throw
new
ActivitiIllegalArgumentException
(
"Unsupported variable query operation: "
+
variable
.
getVariableOperation
());
}
}
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceCollectionResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.rest.api.DataResponse
;
import
org.restlet.data.Form
;
import
org.restlet.resource.Get
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstanceCollectionResource
extends
HistoricVariableInstanceBaseResource
{
@Get
public
DataResponse
getHistoricActivityInstances
()
{
if
(!
authenticate
())
{
return
null
;
}
Form
urlQuery
=
getQuery
();
HistoricVariableInstanceQueryRequest
query
=
new
HistoricVariableInstanceQueryRequest
();
// Populate query based on request
if
(
getQueryParameter
(
"excludeTaskVariables"
,
urlQuery
)
!=
null
)
{
Boolean
excludeTaskVariables
=
getQueryParameterAsBoolean
(
"excludeTaskVariables"
,
urlQuery
);
query
.
setExcludeTaskVariables
(
excludeTaskVariables
);
}
if
(
getQueryParameter
(
"taskId"
,
urlQuery
)
!=
null
)
{
query
.
setTaskId
(
getQueryParameter
(
"taskId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
)
!=
null
)
{
query
.
setProcessInstanceId
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"variableName"
,
urlQuery
)
!=
null
)
{
query
.
setVariableName
(
getQueryParameter
(
"variableName"
,
urlQuery
));
}
if
(
getQueryParameter
(
"variableNameLike"
,
urlQuery
)
!=
null
)
{
query
.
setVariableNameLike
(
getQueryParameter
(
"variableNameLike"
,
urlQuery
));
}
return
getQueryResponse
(
query
,
urlQuery
);
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstancePaginateList.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.activiti.engine.history.HistoricVariableInstance
;
import
org.activiti.rest.api.AbstractPaginateList
;
import
org.activiti.rest.api.RestResponseFactory
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstancePaginateList
extends
AbstractPaginateList
{
private
SecuredResource
resource
;
public
HistoricVariableInstancePaginateList
(
SecuredResource
resource
)
{
this
.
resource
=
resource
;
}
@SuppressWarnings
(
"rawtypes"
)
@Override
protected
List
processList
(
List
list
)
{
List
<
HistoricVariableInstanceResponse
>
responseList
=
new
ArrayList
<
HistoricVariableInstanceResponse
>();
RestResponseFactory
restResponseFactory
=
resource
.
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
();
for
(
Object
instance
:
list
)
{
responseList
.
add
(
restResponseFactory
.
createHistoricVariableInstanceResponse
(
resource
,
(
HistoricVariableInstance
)
instance
));
}
return
responseList
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceQueryRequest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.util.List
;
import
org.activiti.rest.api.engine.variable.QueryVariable
;
import
org.codehaus.jackson.annotate.JsonTypeInfo
;
import
org.codehaus.jackson.annotate.JsonTypeInfo.Id
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstanceQueryRequest
{
private
Boolean
excludeTaskVariables
;
private
String
taskId
;
private
String
processInstanceId
;
private
String
variableName
;
private
String
variableNameLike
;
private
List
<
QueryVariable
>
variables
;
public
Boolean
getExcludeTaskVariables
()
{
return
excludeTaskVariables
;
}
public
void
setExcludeTaskVariables
(
Boolean
excludeTaskVariables
)
{
this
.
excludeTaskVariables
=
excludeTaskVariables
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
void
setProcessInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
}
public
String
getVariableName
()
{
return
variableName
;
}
public
void
setVariableName
(
String
variableName
)
{
this
.
variableName
=
variableName
;
}
public
String
getVariableNameLike
()
{
return
variableNameLike
;
}
public
void
setVariableNameLike
(
String
variableNameLike
)
{
this
.
variableNameLike
=
variableNameLike
;
}
@JsonTypeInfo
(
use
=
Id
.
CLASS
,
defaultImpl
=
QueryVariable
.
class
)
public
List
<
QueryVariable
>
getVariables
()
{
return
variables
;
}
public
void
setVariables
(
List
<
QueryVariable
>
variables
)
{
this
.
variables
=
variables
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceQueryResource.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
org.activiti.rest.api.DataResponse
;
import
org.restlet.resource.Post
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstanceQueryResource
extends
HistoricVariableInstanceBaseResource
{
@Post
public
DataResponse
queryVariableInstances
(
HistoricVariableInstanceQueryRequest
queryRequest
)
{
return
getQueryResponse
(
queryRequest
,
getQuery
());
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricVariableInstanceResponse.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstanceResponse
{
protected
String
id
;
protected
String
variableName
;
protected
String
variableTypeName
;
protected
Object
value
;
protected
String
processInstanceId
;
protected
String
processInstanceUrl
;
protected
String
taskId
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getVariableName
()
{
return
variableName
;
}
public
void
setVariableName
(
String
variableName
)
{
this
.
variableName
=
variableName
;
}
public
String
getVariableTypeName
()
{
return
variableTypeName
;
}
public
void
setVariableTypeName
(
String
variableTypeName
)
{
this
.
variableTypeName
=
variableTypeName
;
}
public
Object
getValue
()
{
return
value
;
}
public
void
setValue
(
Object
value
)
{
this
.
value
=
value
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
void
setProcessInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
}
public
String
getProcessInstanceUrl
()
{
return
processInstanceUrl
;
}
public
void
setProcessInstanceUrl
(
String
processInstanceUrl
)
{
this
.
processInstanceUrl
=
processInstanceUrl
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/application/RestServicesInit.java
浏览文件 @
6b472565
package
org.activiti.rest.application
;
package
org.activiti.rest.application
;
import
org.activiti.rest.api.engine.ProcessEngineResource
;
import
org.activiti.rest.api.engine.ProcessEngineResource
;
import
org.activiti.rest.api.history.HistoricActivityInstanceCollectionResource
;
import
org.activiti.rest.api.history.HistoricActivityInstanceQueryResource
;
import
org.activiti.rest.api.history.HistoricFormPropertiesResource
;
import
org.activiti.rest.api.history.HistoricFormPropertiesResource
;
import
org.activiti.rest.api.history.HistoricProcessInstanceCollectionResource
;
import
org.activiti.rest.api.history.HistoricProcessInstanceQueryResource
;
import
org.activiti.rest.api.history.HistoricProcessInstanceQueryResource
;
import
org.activiti.rest.api.history.HistoricProcessInstanceResource
;
import
org.activiti.rest.api.history.HistoricTaskInstanceCollectionResource
;
import
org.activiti.rest.api.history.HistoricTaskInstanceQueryResource
;
import
org.activiti.rest.api.history.HistoricTaskInstanceResource
;
import
org.activiti.rest.api.history.HistoricVariableInstanceCollectionResource
;
import
org.activiti.rest.api.history.HistoricVariableInstanceQueryResource
;
import
org.activiti.rest.api.identity.GroupCreateResource
;
import
org.activiti.rest.api.identity.GroupCreateResource
;
import
org.activiti.rest.api.identity.GroupResource
;
import
org.activiti.rest.api.identity.GroupResource
;
import
org.activiti.rest.api.identity.GroupSearchResource
;
import
org.activiti.rest.api.identity.GroupSearchResource
;
...
@@ -131,6 +140,13 @@ public class RestServicesInit {
...
@@ -131,6 +140,13 @@ public class RestServicesInit {
router
.
attach
(
"/runtime/executions/{executionId}/variables/{variableName}"
,
ExecutionVariableResource
.
class
);
router
.
attach
(
"/runtime/executions/{executionId}/variables/{variableName}"
,
ExecutionVariableResource
.
class
);
router
.
attach
(
"/runtime/executions/{executionId}/variables/{variableName}/data"
,
ExecutionVariableDataResource
.
class
);
router
.
attach
(
"/runtime/executions/{executionId}/variables/{variableName}/data"
,
ExecutionVariableDataResource
.
class
);
router
.
attach
(
"/history/historic-process-instances/{processInstanceId}"
,
HistoricProcessInstanceResource
.
class
);
router
.
attach
(
"/history/historic-process-instances"
,
HistoricProcessInstanceCollectionResource
.
class
);
router
.
attach
(
"/history/historic-task-instances/{taskId}"
,
HistoricTaskInstanceResource
.
class
);
router
.
attach
(
"/history/historic-task-instances"
,
HistoricTaskInstanceCollectionResource
.
class
);
router
.
attach
(
"/history/historic-activity-instances"
,
HistoricActivityInstanceCollectionResource
.
class
);
router
.
attach
(
"/history/historic-variable-instances"
,
HistoricVariableInstanceCollectionResource
.
class
);
router
.
attach
(
"/management/tables"
,
TableCollectionResource
.
class
);
router
.
attach
(
"/management/tables"
,
TableCollectionResource
.
class
);
router
.
attach
(
"/management/tables/{tableName}"
,
TableResource
.
class
);
router
.
attach
(
"/management/tables/{tableName}"
,
TableResource
.
class
);
...
@@ -138,6 +154,9 @@ public class RestServicesInit {
...
@@ -138,6 +154,9 @@ public class RestServicesInit {
router
.
attach
(
"/query/process-instances"
,
ProcessInstanceQueryResource
.
class
);
router
.
attach
(
"/query/process-instances"
,
ProcessInstanceQueryResource
.
class
);
router
.
attach
(
"/query/executions"
,
ExecutionQueryResource
.
class
);
router
.
attach
(
"/query/executions"
,
ExecutionQueryResource
.
class
);
router
.
attach
(
"/query/historic-process-instances"
,
HistoricProcessInstanceQueryResource
.
class
);
router
.
attach
(
"/query/historic-process-instances"
,
HistoricProcessInstanceQueryResource
.
class
);
router
.
attach
(
"/query/historic-task-instances"
,
HistoricTaskInstanceQueryResource
.
class
);
router
.
attach
(
"/query/historic-activity-instances"
,
HistoricActivityInstanceQueryResource
.
class
);
router
.
attach
(
"/query/historic-variable-instances"
,
HistoricVariableInstanceQueryResource
.
class
);
// Old rest-urls
// Old rest-urls
router
.
attach
(
"/process-engine"
,
ProcessEngineResource
.
class
);
router
.
attach
(
"/process-engine"
,
ProcessEngineResource
.
class
);
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/BaseRestTestCase.java
浏览文件 @
6b472565
...
@@ -91,7 +91,7 @@ public class BaseRestTestCase extends PvmTestCase {
...
@@ -91,7 +91,7 @@ public class BaseRestTestCase extends PvmTestCase {
protected
void
initializeProcessEngine
()
{
protected
void
initializeProcessEngine
()
{
if
(
cachedProcessEngine
==
null
)
{
if
(
cachedProcessEngine
==
null
)
{
cachedProcessEngine
=
ProcessEngineConfiguration
.
create
StandaloneInMemProcessEngineConfiguration
().
setProcessEngineName
(
"default
"
).
buildProcessEngine
();
cachedProcessEngine
=
ProcessEngineConfiguration
.
create
ProcessEngineConfigurationFromResource
(
"activiti.cfg.xml
"
).
buildProcessEngine
();
if
(
cachedProcessEngine
==
null
)
{
if
(
cachedProcessEngine
==
null
)
{
throw
new
ActivitiException
(
"no in-memory process engine available"
);
throw
new
ActivitiException
(
"no in-memory process engine available"
);
}
}
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricActivityInstanceCollectionResourceTest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.api.RestUrls
;
import
org.apache.commons.lang.StringUtils
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonProcessingException
;
import
org.restlet.data.Status
;
import
org.restlet.representation.Representation
;
import
org.restlet.resource.ClientResource
;
/**
* Test for REST-operation related to the historic activity instance query resource.
*
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstanceCollectionResourceTest
extends
BaseRestTestCase
{
/**
* Test querying historic activity instance.
* GET history/historic-activity-instances
*/
@Deployment
public
void
testQueryActivityInstances
()
throws
Exception
{
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
);
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
complete
(
task
.
getId
());
ProcessInstance
processInstance2
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
);
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_HISTORIC_ACTIVITY_INSTANCES
);
assertResultsPresentInDataResponse
(
url
+
"?activityId=processTask"
,
2
,
"processTask"
);
assertResultsPresentInDataResponse
(
url
+
"?activityId=processTask&finished=true"
,
1
,
"processTask"
);
assertResultsPresentInDataResponse
(
url
+
"?activityId=processTask&finished=false"
,
1
,
"processTask"
);
assertResultsPresentInDataResponse
(
url
+
"?activityId=processTask2"
,
1
,
"processTask2"
);
assertResultsPresentInDataResponse
(
url
+
"?activityId=processTask3"
,
0
);
assertResultsPresentInDataResponse
(
url
+
"?activityName=Process%20task"
,
2
,
"processTask"
);
assertResultsPresentInDataResponse
(
url
+
"?activityName=Process%20task2"
,
1
,
"processTask2"
);
assertResultsPresentInDataResponse
(
url
+
"?activityName=Process%20task3"
,
0
);
assertResultsPresentInDataResponse
(
url
+
"?activityType=userTask"
,
3
,
"processTask"
,
"processTask2"
);
assertResultsPresentInDataResponse
(
url
+
"?activityType=startEvent"
,
2
,
"theStart"
);
assertResultsPresentInDataResponse
(
url
+
"?activityType=receiveTask"
,
0
);
assertResultsPresentInDataResponse
(
url
+
"?processInstanceId="
+
processInstance
.
getId
(),
3
,
"theStart"
,
"processTask"
,
"processTask2"
);
assertResultsPresentInDataResponse
(
url
+
"?processInstanceId="
+
processInstance2
.
getId
(),
2
,
"theStart"
,
"processTask"
);
assertResultsPresentInDataResponse
(
url
+
"?processDefinitionId="
+
processInstance
.
getProcessDefinitionId
(),
5
,
"theStart"
,
"processTask"
,
"processTask2"
);
assertResultsPresentInDataResponse
(
url
+
"?taskAssignee=kermit"
,
2
,
"processTask"
);
assertResultsPresentInDataResponse
(
url
+
"?taskAssignee=fozzie"
,
1
,
"processTask2"
);
assertResultsPresentInDataResponse
(
url
+
"?taskAssignee=fozzie2"
,
0
);
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
int
numberOfResultsExpected
,
String
...
expectedActivityIds
)
throws
JsonProcessingException
,
IOException
{
// Do the actual call
ClientResource
client
=
getAuthenticatedClient
(
url
);
Representation
response
=
client
.
get
();
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
assertEquals
(
numberOfResultsExpected
,
dataNode
.
size
());
// Check presence of ID's
if
(
expectedActivityIds
!=
null
)
{
List
<
String
>
toBeFound
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
expectedActivityIds
));
Iterator
<
JsonNode
>
it
=
dataNode
.
iterator
();
while
(
it
.
hasNext
())
{
String
activityId
=
it
.
next
().
get
(
"activityId"
).
getTextValue
();
toBeFound
.
remove
(
activityId
);
}
assertTrue
(
"Not all entries have been found in result, missing: "
+
StringUtils
.
join
(
toBeFound
,
", "
),
toBeFound
.
isEmpty
());
}
client
.
release
();
}
}
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricActivityInstanceQueryResourceTest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.api.RestUrls
;
import
org.apache.commons.lang.StringUtils
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonProcessingException
;
import
org.codehaus.jackson.node.ObjectNode
;
import
org.restlet.data.Status
;
import
org.restlet.representation.Representation
;
import
org.restlet.resource.ClientResource
;
/**
* Test for REST-operation related to the historic activity instance query resource.
*
* @author Tijs Rademakers
*/
public
class
HistoricActivityInstanceQueryResourceTest
extends
BaseRestTestCase
{
/**
* Test querying historic activity instance.
* POST query/historic-activity-instances
*/
@Deployment
public
void
testQueryActivityInstances
()
throws
Exception
{
HashMap
<
String
,
Object
>
processVariables
=
new
HashMap
<
String
,
Object
>();
processVariables
.
put
(
"stringVar"
,
"Azerty"
);
processVariables
.
put
(
"intVar"
,
67890
);
processVariables
.
put
(
"booleanVar"
,
false
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
complete
(
task
.
getId
());
ProcessInstance
processInstance2
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_HISTORIC_ACTIVITY_INSTANCE_QUERY
);
ObjectNode
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityId"
,
"processTask"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"processTask"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityId"
,
"processTask"
);
requestNode
.
put
(
"finished"
,
true
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"processTask"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityId"
,
"processTask"
);
requestNode
.
put
(
"finished"
,
false
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"processTask"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityId"
,
"processTask2"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"processTask2"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityId"
,
"processTask3"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityName"
,
"Process task"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"processTask"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityName"
,
"Process task2"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"processTask2"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityName"
,
"Process task3"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityType"
,
"userTask"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
"processTask"
,
"processTask2"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityType"
,
"startEvent"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"theStart"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"activityType"
,
"receiveTask"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
"theStart"
,
"processTask"
,
"processTask2"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"theStart"
,
"processTask"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processDefinitionId"
,
processInstance
.
getProcessDefinitionId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
5
,
"theStart"
,
"processTask"
,
"processTask2"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskAssignee"
,
"kermit"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"processTask"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskAssignee"
,
"fozzie"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"processTask2"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskAssignee"
,
"fozzie2"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
ObjectNode
body
,
int
numberOfResultsExpected
,
String
...
expectedActivityIds
)
throws
JsonProcessingException
,
IOException
{
// Do the actual call
ClientResource
client
=
getAuthenticatedClient
(
url
);
Representation
response
=
client
.
post
(
body
);
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
assertEquals
(
numberOfResultsExpected
,
dataNode
.
size
());
// Check presence of ID's
if
(
expectedActivityIds
!=
null
)
{
List
<
String
>
toBeFound
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
expectedActivityIds
));
Iterator
<
JsonNode
>
it
=
dataNode
.
iterator
();
while
(
it
.
hasNext
())
{
String
activityId
=
it
.
next
().
get
(
"activityId"
).
getTextValue
();
toBeFound
.
remove
(
activityId
);
}
assertTrue
(
"Not all entries have been found in result, missing: "
+
StringUtils
.
join
(
toBeFound
,
", "
),
toBeFound
.
isEmpty
());
}
client
.
release
();
}
}
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricProcessInstanceCollectionResourceTest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.api.RestUrls
;
import
org.apache.commons.lang.StringUtils
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonProcessingException
;
import
org.restlet.data.Status
;
import
org.restlet.representation.Representation
;
import
org.restlet.resource.ClientResource
;
/**
* Test for REST-operation related to the historic process instance query resource.
*
* @author Tijs Rademakers
*/
public
class
HistoricProcessInstanceCollectionResourceTest
extends
BaseRestTestCase
{
/**
* Test querying historic process instance based on variables.
* GET history/historic-process-instances
*/
@Deployment
public
void
testQueryProcessInstances
()
throws
Exception
{
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
);
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
complete
(
task
.
getId
());
ProcessInstance
processInstance2
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
);
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_HISTORIC_PROCESS_INSTANCES
);
assertResultsPresentInDataResponse
(
url
+
"?finished=true"
,
processInstance
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?finished=false"
,
processInstance2
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?processDefinitionId="
+
processInstance
.
getProcessDefinitionId
(),
processInstance
.
getId
(),
processInstance2
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?processDefinitionId="
+
processInstance
.
getProcessDefinitionId
()
+
"&finished=true"
,
processInstance
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?processDefinitionKey=oneTaskProcess"
,
processInstance
.
getId
(),
processInstance2
.
getId
());
ClientResource
client
=
getAuthenticatedClient
(
url
+
"?processDefinitionKey=oneTaskProcess&sort=startTime"
);
Representation
response
=
client
.
get
();
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
assertEquals
(
2
,
dataNode
.
size
());
assertEquals
(
processInstance
.
getId
(),
dataNode
.
get
(
0
).
get
(
"id"
).
asText
());
assertEquals
(
processInstance2
.
getId
(),
dataNode
.
get
(
1
).
get
(
"id"
).
asText
());
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
String
...
expectedResourceIds
)
throws
JsonProcessingException
,
IOException
{
int
numberOfResultsExpected
=
expectedResourceIds
.
length
;
// Do the actual call
ClientResource
client
=
getAuthenticatedClient
(
url
);
Representation
response
=
client
.
get
();
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
assertEquals
(
numberOfResultsExpected
,
dataNode
.
size
());
// Check presence of ID's
List
<
String
>
toBeFound
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
expectedResourceIds
));
Iterator
<
JsonNode
>
it
=
dataNode
.
iterator
();
while
(
it
.
hasNext
())
{
String
id
=
it
.
next
().
get
(
"id"
).
getTextValue
();
toBeFound
.
remove
(
id
);
}
assertTrue
(
"Not all process instances have been found in result, missing: "
+
StringUtils
.
join
(
toBeFound
,
", "
),
toBeFound
.
isEmpty
());
client
.
release
();
}
}
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricProcessInstanceQueryResourceTest.java
浏览文件 @
6b472565
...
@@ -13,18 +13,13 @@
...
@@ -13,18 +13,13 @@
package
org.activiti.rest.api.history
;
package
org.activiti.rest.api.history
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.api.RestUrls
;
import
org.activiti.rest.api.RestUrls
;
import
org.apache.commons.lang.StringUtils
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.node.ArrayNode
;
import
org.codehaus.jackson.node.ArrayNode
;
import
org.codehaus.jackson.node.ObjectNode
;
import
org.codehaus.jackson.node.ObjectNode
;
...
@@ -41,8 +36,8 @@ import org.restlet.resource.ClientResource;
...
@@ -41,8 +36,8 @@ import org.restlet.resource.ClientResource;
public
class
HistoricProcessInstanceQueryResourceTest
extends
BaseRestTestCase
{
public
class
HistoricProcessInstanceQueryResourceTest
extends
BaseRestTestCase
{
/**
/**
* Test querying process instance based on variables.
* Test querying
historic
process instance based on variables.
* POST query/process-instances
* POST query/
historic-
process-instances
*/
*/
@Deployment
@Deployment
public
void
testQueryProcessInstancesWithVariables
()
throws
Exception
{
public
void
testQueryProcessInstancesWithVariables
()
throws
Exception
{
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricTaskInstanceQueryResourceTest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.api.RestUrls
;
import
org.apache.commons.lang.StringUtils
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonProcessingException
;
import
org.codehaus.jackson.node.ArrayNode
;
import
org.codehaus.jackson.node.ObjectNode
;
import
org.restlet.data.Status
;
import
org.restlet.representation.Representation
;
import
org.restlet.resource.ClientResource
;
/**
* Test for REST-operation related to the historic task instance query resource.
*
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceQueryResourceTest
extends
BaseRestTestCase
{
/**
* Test querying historic task instance.
* POST query/historic-task-instances
*/
@Deployment
public
void
testQueryTaskInstances
()
throws
Exception
{
HashMap
<
String
,
Object
>
processVariables
=
new
HashMap
<
String
,
Object
>();
processVariables
.
put
(
"stringVar"
,
"Azerty"
);
processVariables
.
put
(
"intVar"
,
67890
);
processVariables
.
put
(
"booleanVar"
,
false
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
complete
(
task
.
getId
());
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
setVariableLocal
(
task
.
getId
(),
"local"
,
"test"
);
ProcessInstance
processInstance2
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
Task
task2
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance2
.
getId
()).
singleResult
();
System
.
out
.
println
(
historyService
.
createHistoricTaskInstanceQuery
().
processVariableValueEquals
(
"stringVar"
,
"Azerty"
).
list
());
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_HISTORIC_TASK_INSTANCE_QUERY
);
// Process variables
ObjectNode
requestNode
=
objectMapper
.
createObjectNode
();
ArrayNode
variableArray
=
objectMapper
.
createArrayNode
();
ObjectNode
variableNode
=
objectMapper
.
createObjectNode
();
variableArray
.
add
(
variableNode
);
requestNode
.
put
(
"processVariables"
,
variableArray
);
variableNode
.
put
(
"name"
,
"stringVar"
);
variableNode
.
put
(
"value"
,
"Azerty"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
task
.
getId
());
variableNode
.
put
(
"name"
,
"local"
);
variableNode
.
put
(
"value"
,
"test"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
requestNode
=
objectMapper
.
createObjectNode
();
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task2
.
getId
());
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
ObjectNode
body
,
int
numberOfResultsExpected
,
String
...
expectedTaskIds
)
throws
JsonProcessingException
,
IOException
{
// Do the actual call
ClientResource
client
=
getAuthenticatedClient
(
url
);
Representation
response
=
client
.
post
(
body
);
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
assertEquals
(
numberOfResultsExpected
,
dataNode
.
size
());
// Check presence of ID's
if
(
expectedTaskIds
!=
null
)
{
List
<
String
>
toBeFound
=
new
ArrayList
<
String
>(
Arrays
.
asList
(
expectedTaskIds
));
Iterator
<
JsonNode
>
it
=
dataNode
.
iterator
();
while
(
it
.
hasNext
())
{
String
id
=
it
.
next
().
get
(
"id"
).
getTextValue
();
toBeFound
.
remove
(
id
);
}
assertTrue
(
"Not all entries have been found in result, missing: "
+
StringUtils
.
join
(
toBeFound
,
", "
),
toBeFound
.
isEmpty
());
}
client
.
release
();
}
}
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricVariableInstanceCollectionResourceTest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.api.RestUrls
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonProcessingException
;
import
org.restlet.data.Status
;
import
org.restlet.representation.Representation
;
import
org.restlet.resource.ClientResource
;
/**
* Test for REST-operation related to the historic variable instance query resource.
*
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstanceCollectionResourceTest
extends
BaseRestTestCase
{
/**
* Test querying historic variable instance.
* GET history/historic-variable-instances
*/
@Deployment
public
void
testQueryVariableInstances
()
throws
Exception
{
HashMap
<
String
,
Object
>
processVariables
=
new
HashMap
<
String
,
Object
>();
processVariables
.
put
(
"stringVar"
,
"Azerty"
);
processVariables
.
put
(
"intVar"
,
67890
);
processVariables
.
put
(
"booleanVar"
,
false
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
complete
(
task
.
getId
());
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
setVariableLocal
(
task
.
getId
(),
"taskVariable"
,
"test"
);
ProcessInstance
processInstance2
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_HISTORIC_VARIABLE_INSTANCES
);
assertResultsPresentInDataResponse
(
url
+
"?variableName=stringVar"
,
2
,
"stringVar"
,
"Azerty"
);
assertResultsPresentInDataResponse
(
url
+
"?variableName=booleanVar"
,
2
,
"booleanVar"
,
false
);
assertResultsPresentInDataResponse
(
url
+
"?variableName=booleanVar2"
,
0
,
null
,
null
);
assertResultsPresentInDataResponse
(
url
+
"?processInstanceId="
+
processInstance
.
getId
(),
4
,
"taskVariable"
,
"test"
);
assertResultsPresentInDataResponse
(
url
+
"?processInstanceId="
+
processInstance
.
getId
()
+
"&excludeTaskVariables=true"
,
3
,
"intVar"
,
67890
);
assertResultsPresentInDataResponse
(
url
+
"?processInstanceId="
+
processInstance2
.
getId
(),
3
,
"stringVar"
,
"Azerty"
);
assertResultsPresentInDataResponse
(
url
+
"?taskId="
+
task
.
getId
(),
1
,
"taskVariable"
,
"test"
);
assertResultsPresentInDataResponse
(
url
+
"?taskId="
+
task
.
getId
()
+
"&variableName=booleanVar"
,
0
,
null
,
null
);
assertResultsPresentInDataResponse
(
url
+
"?variableNameLike="
+
encode
(
"%Var"
),
6
,
"stringVar"
,
"Azerty"
);
assertResultsPresentInDataResponse
(
url
+
"?variableNameLike="
+
encode
(
"%Var2"
),
0
,
null
,
null
);
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
int
numberOfResultsExpected
,
String
variableName
,
Object
variableValue
)
throws
JsonProcessingException
,
IOException
{
// Do the actual call
ClientResource
client
=
getAuthenticatedClient
(
url
);
Representation
response
=
client
.
get
();
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
assertEquals
(
numberOfResultsExpected
,
dataNode
.
size
());
// Check presence of ID's
if
(
variableName
!=
null
)
{
boolean
variableFound
=
false
;
Iterator
<
JsonNode
>
it
=
dataNode
.
iterator
();
while
(
it
.
hasNext
())
{
JsonNode
variableNode
=
it
.
next
();
String
name
=
variableNode
.
get
(
"variableName"
).
getTextValue
();
if
(
variableName
.
equals
(
name
))
{
variableFound
=
true
;
if
(
variableValue
instanceof
Boolean
)
{
assertTrue
(
"Variable value is not equal"
,
variableNode
.
get
(
"value"
).
asBoolean
()
==
(
Boolean
)
variableValue
);
}
else
if
(
variableValue
instanceof
Integer
)
{
assertTrue
(
"Variable value is not equal"
,
variableNode
.
get
(
"value"
).
asInt
()
==
(
Integer
)
variableValue
);
}
else
{
assertTrue
(
"Variable value is not equal"
,
variableNode
.
get
(
"value"
).
asText
().
equals
((
String
)
variableValue
));
}
}
}
assertTrue
(
"Variable "
+
variableName
+
" is missing"
,
variableFound
);
}
client
.
release
();
}
}
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricVariableInstanceQueryResourceTest.java
0 → 100644
浏览文件 @
6b472565
/* 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.rest.api.history
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
import
org.activiti.rest.BaseRestTestCase
;
import
org.activiti.rest.api.RestUrls
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonProcessingException
;
import
org.codehaus.jackson.node.ArrayNode
;
import
org.codehaus.jackson.node.ObjectNode
;
import
org.restlet.data.Status
;
import
org.restlet.representation.Representation
;
import
org.restlet.resource.ClientResource
;
/**
* Test for REST-operation related to the historic variable instance query resource.
*
* @author Tijs Rademakers
*/
public
class
HistoricVariableInstanceQueryResourceTest
extends
BaseRestTestCase
{
/**
* Test querying historic variable instance.
* POST query/historic-variable-instances
*/
@Deployment
public
void
testQueryVariableInstances
()
throws
Exception
{
HashMap
<
String
,
Object
>
processVariables
=
new
HashMap
<
String
,
Object
>();
processVariables
.
put
(
"stringVar"
,
"Azerty"
);
processVariables
.
put
(
"intVar"
,
67890
);
processVariables
.
put
(
"booleanVar"
,
false
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
complete
(
task
.
getId
());
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
setVariableLocal
(
task
.
getId
(),
"taskVariable"
,
"test"
);
ProcessInstance
processInstance2
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_HISTORIC_VARIABLE_INSTANCE_QUERY
);
ObjectNode
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"variableName"
,
"stringVar"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"stringVar"
,
"Azerty"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"variableName"
,
"booleanVar"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"booleanVar"
,
false
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"variableName"
,
"booleanVar2"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
,
null
,
null
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
4
,
"taskVariable"
,
"test"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance
.
getId
());
requestNode
.
put
(
"excludeTaskVariables"
,
true
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
"intVar"
,
67890
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
"stringVar"
,
"Azerty"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskId"
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"taskVariable"
,
"test"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskId"
,
task
.
getId
());
requestNode
.
put
(
"variableName"
,
"booleanVar"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
,
null
,
null
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"variableNameLike"
,
"%Var"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
6
,
"stringVar"
,
"Azerty"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"variableNameLike"
,
"%Var2"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
,
null
,
null
);
requestNode
=
objectMapper
.
createObjectNode
();
ArrayNode
variableArray
=
objectMapper
.
createArrayNode
();
ObjectNode
variableNode
=
objectMapper
.
createObjectNode
();
variableArray
.
add
(
variableNode
);
requestNode
.
put
(
"variables"
,
variableArray
);
variableNode
.
put
(
"name"
,
"stringVar"
);
variableNode
.
put
(
"value"
,
"Azerty"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
"stringVar"
,
"Azerty"
);
variableNode
.
removeAll
();
requestNode
.
put
(
"variables"
,
variableArray
);
variableNode
.
put
(
"name"
,
"taskVariable"
);
variableNode
.
put
(
"value"
,
"test"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"taskVariable"
,
"test"
);
variableNode
.
removeAll
();
requestNode
.
put
(
"variables"
,
variableArray
);
variableNode
.
put
(
"name"
,
"taskVariable"
);
variableNode
.
put
(
"value"
,
"test"
);
variableNode
.
put
(
"operation"
,
"notEquals"
);
assertErrorResult
(
url
,
requestNode
,
Status
.
CLIENT_ERROR_BAD_REQUEST
);
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
ObjectNode
body
,
int
numberOfResultsExpected
,
String
variableName
,
Object
variableValue
)
throws
JsonProcessingException
,
IOException
{
// Do the actual call
ClientResource
client
=
getAuthenticatedClient
(
url
);
Representation
response
=
client
.
post
(
body
);
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
assertEquals
(
numberOfResultsExpected
,
dataNode
.
size
());
// Check presence of ID's
if
(
variableName
!=
null
)
{
boolean
variableFound
=
false
;
Iterator
<
JsonNode
>
it
=
dataNode
.
iterator
();
while
(
it
.
hasNext
())
{
JsonNode
variableNode
=
it
.
next
();
String
name
=
variableNode
.
get
(
"variableName"
).
getTextValue
();
if
(
variableName
.
equals
(
name
))
{
variableFound
=
true
;
if
(
variableValue
instanceof
Boolean
)
{
assertTrue
(
"Variable value is not equal"
,
variableNode
.
get
(
"value"
).
asBoolean
()
==
(
Boolean
)
variableValue
);
}
else
if
(
variableValue
instanceof
Integer
)
{
assertTrue
(
"Variable value is not equal"
,
variableNode
.
get
(
"value"
).
asInt
()
==
(
Integer
)
variableValue
);
}
else
{
assertTrue
(
"Variable value is not equal"
,
variableNode
.
get
(
"value"
).
asText
().
equals
((
String
)
variableValue
));
}
}
}
assertTrue
(
"Variable "
+
variableName
+
" is missing"
,
variableFound
);
}
client
.
release
();
}
}
modules/activiti-rest/src/test/resources/activiti.cfg.xml
0 → 100644
浏览文件 @
6b472565
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
>
<bean
id=
"processEngineConfiguration"
class=
"org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"
>
<property
name=
"jdbcUrl"
value=
"jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000"
/>
<property
name=
"jdbcDriver"
value=
"org.h2.Driver"
/>
<property
name=
"jdbcUsername"
value=
"sa"
/>
<property
name=
"jdbcPassword"
value=
""
/>
<!-- Database configurations -->
<property
name=
"databaseSchemaUpdate"
value=
"drop-create"
/>
<!-- job executor configurations -->
<property
name=
"jobExecutorActivate"
value=
"false"
/>
<!-- mail server configurations -->
<property
name=
"mailServerPort"
value=
"5025"
/>
<property
name=
"history"
value=
"full"
/>
</bean>
</beans>
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricActivityInstanceCollectionResourceTest.testQueryActivityInstances.bpmn20.xml
0 → 100644
浏览文件 @
6b472565
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"OneTaskCategory"
>
<process
id=
"oneTaskProcess"
name=
"The One Task Process"
>
<documentation>
One task process description
</documentation>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"processTask"
/>
<userTask
id=
"processTask"
name=
"Process task"
activiti:assignee=
"kermit"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow2"
sourceRef=
"processTask"
targetRef=
"processTask2"
/>
<userTask
id=
"processTask2"
name=
"Process task2"
activiti:assignee=
"fozzie"
>
<documentation>
Process task description2
</documentation>
</userTask>
<sequenceFlow
id=
"flow3"
sourceRef=
"processTask2"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricActivityInstanceQueryResourceTest.testQueryActivityInstances.bpmn20.xml
0 → 100644
浏览文件 @
6b472565
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"OneTaskCategory"
>
<process
id=
"oneTaskProcess"
name=
"The One Task Process"
>
<documentation>
One task process description
</documentation>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"processTask"
/>
<userTask
id=
"processTask"
name=
"Process task"
activiti:assignee=
"kermit"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow2"
sourceRef=
"processTask"
targetRef=
"processTask2"
/>
<userTask
id=
"processTask2"
name=
"Process task2"
activiti:assignee=
"fozzie"
>
<documentation>
Process task description2
</documentation>
</userTask>
<sequenceFlow
id=
"flow3"
sourceRef=
"processTask2"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricProcessInstanceCollectionResourceTest.testQueryProcessInstances.bpmn20.xml
0 → 100644
浏览文件 @
6b472565
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"OneTaskCategory"
>
<process
id=
"oneTaskProcess"
name=
"The One Task Process"
>
<documentation>
One task process description
</documentation>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"processTask"
/>
<userTask
id=
"processTask"
name=
"Process task"
activiti:candidateUsers=
"kermit"
activiti:candidateGroups=
"sales"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow2"
sourceRef=
"processTask"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricTaskInstanceQueryResourceTest.testQueryTaskInstances.bpmn20.xml
0 → 100644
浏览文件 @
6b472565
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"OneTaskCategory"
>
<process
id=
"oneTaskProcess"
name=
"The One Task Process"
>
<documentation>
One task process description
</documentation>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"processTask"
/>
<userTask
id=
"processTask"
name=
"Process task"
activiti:candidateUsers=
"kermit"
activiti:candidateGroups=
"sales"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow2"
sourceRef=
"processTask"
targetRef=
"processTask2"
/>
<userTask
id=
"processTask2"
name=
"Process task 2"
activiti:candidateUsers=
"kermit"
activiti:candidateGroups=
"sales"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow3"
sourceRef=
"processTask2"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricVariableInstanceCollectionResourceTest.testQueryVariableInstances.bpmn20.xml
0 → 100644
浏览文件 @
6b472565
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"OneTaskCategory"
>
<process
id=
"oneTaskProcess"
name=
"The One Task Process"
>
<documentation>
One task process description
</documentation>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"processTask"
/>
<userTask
id=
"processTask"
name=
"Process task"
activiti:assignee=
"kermit"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow2"
sourceRef=
"processTask"
targetRef=
"processTask2"
/>
<userTask
id=
"processTask2"
name=
"Process task2"
activiti:assignee=
"fozzie"
>
<documentation>
Process task description2
</documentation>
</userTask>
<sequenceFlow
id=
"flow3"
sourceRef=
"processTask2"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricVariableInstanceQueryResourceTest.testQueryVariableInstances.bpmn20.xml
0 → 100644
浏览文件 @
6b472565
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"OneTaskCategory"
>
<process
id=
"oneTaskProcess"
name=
"The One Task Process"
>
<documentation>
One task process description
</documentation>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"processTask"
/>
<userTask
id=
"processTask"
name=
"Process task"
activiti:assignee=
"kermit"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow2"
sourceRef=
"processTask"
targetRef=
"processTask2"
/>
<userTask
id=
"processTask2"
name=
"Process task2"
activiti:assignee=
"fozzie"
>
<documentation>
Process task description2
</documentation>
</userTask>
<sequenceFlow
id=
"flow3"
sourceRef=
"processTask2"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录