Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
adec4154
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,发现更多精彩内容 >>
提交
adec4154
编写于
6月 06, 2013
作者:
T
Tijs Rademakers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implemented history REST API
上级
a62f1a53
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
1069 addition
and
39 deletion
+1069
-39
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricDetailQuery.java
...java/org/activiti/engine/history/HistoricDetailQuery.java
+3
-4
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricDetailQueryImpl.java
...ava/org/activiti/engine/impl/HistoricDetailQueryImpl.java
+6
-0
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricDetail.xml
...sources/org/activiti/db/mapping/entity/HistoricDetail.xml
+3
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestResponseFactory.java
.../main/java/org/activiti/rest/api/RestResponseFactory.java
+41
-2
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestUrls.java
...ti-rest/src/main/java/org/activiti/rest/api/RestUrls.java
+18
-2
modules/activiti-rest/src/main/java/org/activiti/rest/api/engine/variable/RestVariable.java
...a/org/activiti/rest/api/engine/variable/RestVariable.java
+5
-1
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailBaseResource.java
...activiti/rest/api/history/HistoricDetailBaseResource.java
+71
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailCollectionResource.java
...ti/rest/api/history/HistoricDetailCollectionResource.java
+67
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailDataResource.java
...activiti/rest/api/history/HistoricDetailDataResource.java
+94
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailPaginateList.java
...activiti/rest/api/history/HistoricDetailPaginateList.java
+46
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailQueryRequest.java
...activiti/rest/api/history/HistoricDetailQueryRequest.java
+86
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailQueryResource.java
...ctiviti/rest/api/history/HistoricDetailQueryResource.java
+30
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailResponse.java
...org/activiti/rest/api/history/HistoricDetailResponse.java
+124
-0
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceCollectionResource.java
...t/api/history/HistoricTaskInstanceCollectionResource.java
+78
-18
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/process/BaseExecutionVariableResource.java
...st/api/runtime/process/BaseExecutionVariableResource.java
+1
-1
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/process/ExecutionVariableCollectionResource.java
.../runtime/process/ExecutionVariableCollectionResource.java
+1
-1
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/process/ProcessInstanceVariableResource.java
.../api/runtime/process/ProcessInstanceVariableResource.java
+1
-1
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/task/TaskVariableBaseResource.java
...iviti/rest/api/runtime/task/TaskVariableBaseResource.java
+2
-2
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/task/TaskVariableCollectionResource.java
...rest/api/runtime/task/TaskVariableCollectionResource.java
+1
-1
modules/activiti-rest/src/main/java/org/activiti/rest/application/RestServicesInit.java
.../java/org/activiti/rest/application/RestServicesInit.java
+6
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricDetailQueryResourceTest.java
...iti/rest/api/history/HistoricDetailQueryResourceTest.java
+150
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricTaskInstanceCollectionResourceTest.java
...i/history/HistoricTaskInstanceCollectionResourceTest.java
+122
-0
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricTaskInstanceQueryResourceTest.java
...st/api/history/HistoricTaskInstanceQueryResourceTest.java
+63
-4
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricDetailQueryResourceTest.testQueryDetail.bpmn20.xml
...istoricDetailQueryResourceTest.testQueryDetail.bpmn20.xml
+24
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricTaskInstanceCollectionResourceTest.testQueryTaskInstances.bpmn20.xml
...eCollectionResourceTest.testQueryTaskInstances.bpmn20.xml
+24
-0
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricTaskInstanceQueryResourceTest.testQueryTaskInstances.bpmn20.xml
...stanceQueryResourceTest.testQueryTaskInstances.bpmn20.xml
+2
-2
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/history/HistoricDetailQuery.java
浏览文件 @
adec4154
...
...
@@ -23,6 +23,9 @@ import org.activiti.engine.runtime.Execution;
* @author Tom Baeyens
*/
public
interface
HistoricDetailQuery
extends
Query
<
HistoricDetailQuery
,
HistoricDetail
>
{
/** Only select historic info with the given id. */
HistoricDetailQuery
id
(
String
id
);
/** Only select historic variable updates with the given process instance.
* {@link ProcessInstance) ids and {@link HistoricProcessInstance} ids match. */
...
...
@@ -33,10 +36,6 @@ public interface HistoricDetailQuery extends Query<HistoricDetailQuery, Historic
* only process instances are.*/
HistoricDetailQuery
executionId
(
String
executionId
);
/** Only select historic variable updates associated to the given {@link HistoricActivityInstance activity instance}.
* @deprecated since 5.2, use {@link #activityInstanceId(String)} instead */
HistoricDetailQuery
activityId
(
String
activityId
);
/** Only select historic variable updates associated to the given {@link HistoricActivityInstance activity instance}. */
HistoricDetailQuery
activityInstanceId
(
String
activityInstanceId
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/HistoricDetailQueryImpl.java
浏览文件 @
adec4154
...
...
@@ -30,6 +30,7 @@ import org.activiti.engine.impl.variable.JPAEntityVariableType;
public
class
HistoricDetailQueryImpl
extends
AbstractQuery
<
HistoricDetailQuery
,
HistoricDetail
>
implements
HistoricDetailQuery
{
private
static
final
long
serialVersionUID
=
1L
;
protected
String
id
;
protected
String
taskId
;
protected
String
processInstanceId
;
protected
String
executionId
;
...
...
@@ -49,6 +50,11 @@ public class HistoricDetailQueryImpl extends AbstractQuery<HistoricDetailQuery,
super
(
commandExecutor
);
}
public
HistoricDetailQuery
id
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
HistoricDetailQuery
processInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
return
this
;
...
...
modules/activiti-engine/src/main/resources/org/activiti/db/mapping/entity/HistoricDetail.xml
浏览文件 @
adec4154
...
...
@@ -123,6 +123,9 @@
<sql
id=
"selectHistoricDetailsByQueryCriteriaSql"
>
from ${prefix}ACT_HI_DETAIL RES
<where>
<if
test=
"id != null"
>
RES.ID_ = #{id}
</if>
<if
test=
"processInstanceId != null"
>
RES.PROC_INST_ID_ = #{processInstanceId}
</if>
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestResponseFactory.java
浏览文件 @
adec4154
...
...
@@ -20,9 +20,12 @@ import java.util.Map.Entry;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.history.HistoricActivityInstance
;
import
org.activiti.engine.history.HistoricDetail
;
import
org.activiti.engine.history.HistoricFormProperty
;
import
org.activiti.engine.history.HistoricProcessInstance
;
import
org.activiti.engine.history.HistoricTaskInstance
;
import
org.activiti.engine.history.HistoricVariableInstance
;
import
org.activiti.engine.history.HistoricVariableUpdate
;
import
org.activiti.engine.impl.bpmn.deployer.BpmnDeployer
;
import
org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity
;
import
org.activiti.engine.repository.Deployment
;
...
...
@@ -49,6 +52,7 @@ import org.activiti.rest.api.engine.variable.RestVariableConverter;
import
org.activiti.rest.api.engine.variable.ShortRestVariableConverter
;
import
org.activiti.rest.api.engine.variable.StringRestVariableConverter
;
import
org.activiti.rest.api.history.HistoricActivityInstanceResponse
;
import
org.activiti.rest.api.history.HistoricDetailResponse
;
import
org.activiti.rest.api.history.HistoricProcessInstanceResponse
;
import
org.activiti.rest.api.history.HistoricTaskInstanceResponse
;
import
org.activiti.rest.api.history.HistoricVariableInstanceResponse
;
...
...
@@ -61,6 +65,7 @@ import org.activiti.rest.api.repository.ProcessDefinitionResponse;
import
org.activiti.rest.api.runtime.process.ExecutionResponse
;
import
org.activiti.rest.api.runtime.process.ProcessInstanceResponse
;
import
org.activiti.rest.api.runtime.task.TaskResponse
;
import
org.apache.commons.lang.StringUtils
;
import
org.restlet.data.MediaType
;
...
...
@@ -158,13 +163,14 @@ public class RestResponseFactory {
List
<
RestVariable
>
result
=
new
ArrayList
<
RestVariable
>();
for
(
Entry
<
String
,
Object
>
pair
:
variables
.
entrySet
())
{
result
.
add
(
createRestVariable
(
securedResource
,
pair
.
getKey
(),
pair
.
getValue
(),
scope
,
taskId
,
executionId
,
processInstanceId
,
false
));
result
.
add
(
createRestVariable
(
securedResource
,
pair
.
getKey
(),
pair
.
getValue
(),
scope
,
taskId
,
executionId
,
processInstanceId
,
null
,
false
));
}
return
result
;
}
public
RestVariable
createRestVariable
(
SecuredResource
securedResource
,
String
name
,
Object
value
,
RestVariableScope
scope
,
String
taskId
,
String
executionId
,
String
processInstanceId
,
boolean
includeBinaryValue
)
{
public
RestVariable
createRestVariable
(
SecuredResource
securedResource
,
String
name
,
Object
value
,
RestVariableScope
scope
,
String
taskId
,
String
executionId
,
String
processInstanceId
,
String
historicDetailId
,
boolean
includeBinaryValue
)
{
RestVariableConverter
converter
=
null
;
RestVariable
restVar
=
new
RestVariable
();
restVar
.
setVariableScope
(
scope
);
...
...
@@ -205,6 +211,10 @@ public class RestResponseFactory {
if
(
processInstanceId
!=
null
)
{
restVar
.
setValueUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_PROCESS_INSTANCE_VARIABLE_DATA
,
processInstanceId
,
name
));
}
if
(
historicDetailId
!=
null
)
{
restVar
.
setValueUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_DETAIL_VARIABLE_DATA
,
historicDetailId
));
}
}
}
return
restVar
;
...
...
@@ -468,6 +478,35 @@ public class RestResponseFactory {
return
result
;
}
public
HistoricDetailResponse
createHistoricDetailResponse
(
SecuredResource
securedResource
,
HistoricDetail
detail
)
{
HistoricDetailResponse
result
=
new
HistoricDetailResponse
();
result
.
setId
(
detail
.
getId
());
result
.
setProcessInstanceId
(
detail
.
getProcessInstanceId
());
if
(
StringUtils
.
isNotEmpty
(
detail
.
getProcessInstanceId
()))
{
result
.
setProcessInstanceUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_PROCESS_INSTANCE
,
detail
.
getProcessInstanceId
()));
}
result
.
setExecutionId
(
detail
.
getExecutionId
());
result
.
setActivityInstanceId
(
detail
.
getActivityInstanceId
());
result
.
setTaskId
(
detail
.
getTaskId
());
if
(
StringUtils
.
isNotEmpty
(
detail
.
getTaskId
()))
{
result
.
setTaskUrl
(
securedResource
.
createFullResourceUrl
(
RestUrls
.
URL_HISTORIC_TASK_INSTANCE
,
detail
.
getTaskId
()));
}
result
.
setTime
(
detail
.
getTime
());
if
(
detail
instanceof
HistoricFormProperty
)
{
HistoricFormProperty
formProperty
=
(
HistoricFormProperty
)
detail
;
result
.
setDetailType
(
HistoricDetailResponse
.
FORM_PROPERTY
);
result
.
setPropertyId
(
formProperty
.
getPropertyId
());
result
.
setPropertyValue
(
formProperty
.
getPropertyValue
());
}
else
if
(
detail
instanceof
HistoricVariableUpdate
)
{
HistoricVariableUpdate
variableUpdate
=
(
HistoricVariableUpdate
)
detail
;
result
.
setDetailType
(
HistoricDetailResponse
.
VARIABLE_UPDATE
);
result
.
setRevision
(
variableUpdate
.
getRevision
());
result
.
setVariable
(
createRestVariable
(
securedResource
,
variableUpdate
.
getVariableName
(),
variableUpdate
.
getValue
(),
null
,
null
,
null
,
null
,
detail
.
getId
(),
false
));
}
return
result
;
}
public
TableResponse
createTableResponse
(
SecuredResource
securedResource
,
String
name
,
Long
count
)
{
TableResponse
result
=
new
TableResponse
();
result
.
setName
(
name
);
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/RestUrls.java
浏览文件 @
adec4154
...
...
@@ -52,6 +52,7 @@ public final class RestUrls {
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_HISTORIC_DETAIL_RESOURCE
=
"historic-detail"
;
public
static
final
String
SEGMENT_TABLES
=
"tables"
;
public
static
final
String
SEGMENT_COLUMNS
=
"columns"
;
public
static
final
String
SEGMENT_DATA
=
"data"
;
...
...
@@ -256,15 +257,25 @@ public final class RestUrls {
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>
* URL template for historic
activity
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>
* URL template for historic
variable
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 detail query: <i>history/historic-detail</i>
*/
public
static
final
String
[]
URL_HISTORIC_DETAIL
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_DETAIL_RESOURCE
};
/**
* URL template for a single historic detail variable data: <i>history/historic-detail/{0:detailId}/data</i>
*/
public
static
final
String
[]
URL_HISTORIC_DETAIL_VARIABLE_DATA
=
{
SEGMENT_HISTORY_RESOURCES
,
SEGMENT_HISTORIC_DETAIL_RESOURCE
,
"{0}"
,
SEGMENT_VARIABLE_DATA
};
/**
* URL template for historic process instance query: <i>query/historic-process-instances</i>
*/
...
...
@@ -285,6 +296,11 @@ public final class RestUrls {
*/
public
static
final
String
[]
URL_HISTORIC_VARIABLE_INSTANCE_QUERY
=
{
SEGMENT_QUERY_RESOURCES
,
SEGMENT_HISTORIC_VARIABLE_INSTANCE_RESOURCE
};
/**
* URL template for historic detail query: <i>query/historic-detail</i>
*/
public
static
final
String
[]
URL_HISTORIC_DETAIL_QUERY
=
{
SEGMENT_QUERY_RESOURCES
,
SEGMENT_HISTORIC_DETAIL_RESOURCE
};
/**
* URL template for the collection of tables: <i>management/tables</i>
*/
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/engine/variable/RestVariable.java
浏览文件 @
adec4154
...
...
@@ -64,7 +64,11 @@ public class RestVariable {
this
.
value
=
value
;
}
public
String
getScope
()
{
return
variableScope
.
name
().
toLowerCase
();
String
scope
=
null
;
if
(
variableScope
!=
null
)
{
scope
=
variableScope
.
name
().
toLowerCase
();
}
return
scope
;
}
public
void
setScope
(
String
scope
)
{
setVariableScope
(
getScopeFromString
(
scope
));
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailBaseResource.java
0 → 100644
浏览文件 @
adec4154
/* 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.HistoricDetailQuery
;
import
org.activiti.engine.impl.HistoricDetailQueryProperty
;
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
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricDetailBaseResource
extends
SecuredResource
{
private
static
Map
<
String
,
QueryProperty
>
allowedSortProperties
=
new
HashMap
<
String
,
QueryProperty
>();
static
{
allowedSortProperties
.
put
(
"processInstanceId"
,
HistoricDetailQueryProperty
.
PROCESS_INSTANCE_ID
);
allowedSortProperties
.
put
(
"time"
,
HistoricDetailQueryProperty
.
TIME
);
allowedSortProperties
.
put
(
"name"
,
HistoricDetailQueryProperty
.
VARIABLE_NAME
);
allowedSortProperties
.
put
(
"revision"
,
HistoricDetailQueryProperty
.
VARIABLE_REVISION
);
allowedSortProperties
.
put
(
"variableType"
,
HistoricDetailQueryProperty
.
VARIABLE_TYPE
);
}
protected
DataResponse
getQueryResponse
(
HistoricDetailQueryRequest
queryRequest
,
Form
urlQuery
)
{
HistoricDetailQuery
query
=
ActivitiUtil
.
getHistoryService
().
createHistoricDetailQuery
();
// Populate query based on request
if
(
queryRequest
.
getProcessInstanceId
()
!=
null
)
{
query
.
processInstanceId
(
queryRequest
.
getProcessInstanceId
());
}
if
(
queryRequest
.
getExecutionId
()
!=
null
)
{
query
.
executionId
(
queryRequest
.
getExecutionId
());
}
if
(
queryRequest
.
getActivityInstanceId
()
!=
null
)
{
query
.
activityInstanceId
(
queryRequest
.
getActivityInstanceId
());
}
if
(
queryRequest
.
getTaskId
()
!=
null
)
{
query
.
taskId
(
queryRequest
.
getTaskId
());
}
if
(
queryRequest
.
getSelectOnlyFormProperties
()
!=
null
)
{
if
(
queryRequest
.
getSelectOnlyFormProperties
())
{
query
.
formProperties
();
}
}
if
(
queryRequest
.
getSelectOnlyVariableUpdates
()
!=
null
)
{
if
(
queryRequest
.
getSelectOnlyVariableUpdates
())
{
query
.
variableUpdates
();
}
}
return
new
HistoricDetailPaginateList
(
this
).
paginateList
(
urlQuery
,
query
,
"processInstanceId"
,
allowedSortProperties
);
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailCollectionResource.java
0 → 100644
浏览文件 @
adec4154
/* 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
HistoricDetailCollectionResource
extends
HistoricDetailBaseResource
{
@Get
public
DataResponse
getHistoricDetailInfo
()
{
if
(!
authenticate
())
{
return
null
;
}
Form
urlQuery
=
getQuery
();
// Populate query based on request
HistoricDetailQueryRequest
queryRequest
=
new
HistoricDetailQueryRequest
();
if
(
getQueryParameter
(
"id"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setId
(
getQueryParameter
(
"id"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessInstanceId
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"executionId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setExecutionId
(
getQueryParameter
(
"executionId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"activityInstanceId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setActivityInstanceId
(
getQueryParameter
(
"activityInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskId
(
getQueryParameter
(
"taskId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"selectOnlyFormProperties"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setSelectOnlyFormProperties
(
getQueryParameterAsBoolean
(
"selectOnlyFormProperties"
,
urlQuery
));
}
if
(
getQueryParameter
(
"selectOnlyVariableUpdates"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setSelectOnlyVariableUpdates
(
getQueryParameterAsBoolean
(
"selectOnlyVariableUpdates"
,
urlQuery
));
}
return
getQueryResponse
(
queryRequest
,
urlQuery
);
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailDataResource.java
0 → 100644
浏览文件 @
adec4154
/* 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.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.ObjectOutputStream
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.ActivitiObjectNotFoundException
;
import
org.activiti.engine.history.HistoricDetail
;
import
org.activiti.engine.history.HistoricVariableUpdate
;
import
org.activiti.engine.impl.persistence.entity.VariableInstanceEntity
;
import
org.activiti.rest.api.ActivitiUtil
;
import
org.activiti.rest.api.RestResponseFactory
;
import
org.activiti.rest.api.SecuredResource
;
import
org.activiti.rest.api.engine.variable.RestVariable
;
import
org.activiti.rest.application.ActivitiRestServicesApplication
;
import
org.restlet.data.MediaType
;
import
org.restlet.data.Status
;
import
org.restlet.representation.InputRepresentation
;
import
org.restlet.resource.Get
;
import
org.restlet.resource.ResourceException
;
/**
* @author Frederik Heremans
*/
public
class
HistoricDetailDataResource
extends
SecuredResource
{
@Get
public
InputRepresentation
getVariableData
()
{
if
(
authenticate
()
==
false
)
return
null
;
try
{
InputStream
dataStream
=
null
;
MediaType
mediaType
=
null
;
RestVariable
variable
=
getVariableFromRequest
(
true
);
if
(
RestResponseFactory
.
BYTE_ARRAY_VARIABLE_TYPE
.
equals
(
variable
.
getType
()))
{
dataStream
=
new
ByteArrayInputStream
((
byte
[])
variable
.
getValue
());
mediaType
=
MediaType
.
APPLICATION_OCTET_STREAM
;
}
else
if
(
RestResponseFactory
.
SERIALIZABLE_VARIABLE_TYPE
.
equals
(
variable
.
getType
()))
{
ByteArrayOutputStream
buffer
=
new
ByteArrayOutputStream
();
ObjectOutputStream
outputStream
=
new
ObjectOutputStream
(
buffer
);
outputStream
.
writeObject
(
variable
.
getValue
());
outputStream
.
close
();
dataStream
=
new
ByteArrayInputStream
(
buffer
.
toByteArray
());
mediaType
=
MediaType
.
APPLICATION_JAVA_OBJECT
;
}
else
{
throw
new
ResourceException
(
new
Status
(
Status
.
CLIENT_ERROR_NOT_FOUND
.
getCode
(),
"The variable does not have a binary data stream."
,
null
,
null
));
}
return
new
InputRepresentation
(
dataStream
,
mediaType
);
}
catch
(
IOException
ioe
)
{
// Re-throw IOException
throw
new
ResourceException
(
Status
.
SERVER_ERROR_INTERNAL
,
ioe
);
}
}
public
RestVariable
getVariableFromRequest
(
boolean
includeBinary
)
{
String
detailId
=
getAttribute
(
"detailId"
);
if
(
detailId
==
null
)
{
throw
new
ActivitiIllegalArgumentException
(
"The detailId cannot be null"
);
}
Object
value
=
null
;
HistoricVariableUpdate
variableUpdate
=
null
;
HistoricDetail
detailObject
=
ActivitiUtil
.
getHistoryService
().
createHistoricDetailQuery
().
id
(
detailId
).
singleResult
();
if
(
detailObject
!=
null
&&
detailObject
instanceof
HistoricVariableUpdate
)
{
variableUpdate
=
(
HistoricVariableUpdate
)
detailObject
;
value
=
variableUpdate
.
getValue
();
}
if
(
value
==
null
)
{
throw
new
ActivitiObjectNotFoundException
(
"Historic detail '"
+
detailId
+
"' doesn't have a variable value."
,
VariableInstanceEntity
.
class
);
}
else
{
return
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
createRestVariable
(
this
,
variableUpdate
.
getVariableName
(),
value
,
null
,
null
,
null
,
null
,
detailId
,
includeBinary
);
}
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailPaginateList.java
0 → 100644
浏览文件 @
adec4154
/* 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.HistoricDetail
;
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
HistoricDetailPaginateList
extends
AbstractPaginateList
{
private
SecuredResource
resource
;
public
HistoricDetailPaginateList
(
SecuredResource
resource
)
{
this
.
resource
=
resource
;
}
@SuppressWarnings
(
"rawtypes"
)
@Override
protected
List
processList
(
List
list
)
{
List
<
HistoricDetailResponse
>
responseList
=
new
ArrayList
<
HistoricDetailResponse
>();
RestResponseFactory
restResponseFactory
=
resource
.
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
();
for
(
Object
instance
:
list
)
{
responseList
.
add
(
restResponseFactory
.
createHistoricDetailResponse
(
resource
,
(
HistoricDetail
)
instance
));
}
return
responseList
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailQueryRequest.java
0 → 100644
浏览文件 @
adec4154
/* 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
HistoricDetailQueryRequest
{
private
String
id
;
private
String
processInstanceId
;
private
String
executionId
;
private
String
activityInstanceId
;
private
String
taskId
;
private
Boolean
selectOnlyFormProperties
;
private
Boolean
selectOnlyVariableUpdates
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getProcessInstanceId
()
{
return
processInstanceId
;
}
public
void
setProcessInstanceId
(
String
processInstanceId
)
{
this
.
processInstanceId
=
processInstanceId
;
}
public
String
getExecutionId
()
{
return
executionId
;
}
public
void
setExecutionId
(
String
executionId
)
{
this
.
executionId
=
executionId
;
}
public
String
getActivityInstanceId
()
{
return
activityInstanceId
;
}
public
void
setActivityInstanceId
(
String
activityInstanceId
)
{
this
.
activityInstanceId
=
activityInstanceId
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
public
Boolean
getSelectOnlyFormProperties
()
{
return
selectOnlyFormProperties
;
}
public
void
setSelectOnlyFormProperties
(
Boolean
selectOnlyFormProperties
)
{
this
.
selectOnlyFormProperties
=
selectOnlyFormProperties
;
}
public
Boolean
getSelectOnlyVariableUpdates
()
{
return
selectOnlyVariableUpdates
;
}
public
void
setSelectOnlyVariableUpdates
(
Boolean
selectOnlyVariableUpdates
)
{
this
.
selectOnlyVariableUpdates
=
selectOnlyVariableUpdates
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailQueryResource.java
0 → 100644
浏览文件 @
adec4154
/* 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
HistoricDetailQueryResource
extends
HistoricDetailBaseResource
{
@Post
public
DataResponse
queryHistoricDetail
(
HistoricDetailQueryRequest
queryRequest
)
{
return
getQueryResponse
(
queryRequest
,
getQuery
());
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricDetailResponse.java
0 → 100644
浏览文件 @
adec4154
/* 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
org.activiti.rest.api.engine.variable.RestVariable
;
/**
* @author Tijs Rademakers
*/
public
class
HistoricDetailResponse
{
public
static
String
FORM_PROPERTY
=
"formProperty"
;
public
static
String
VARIABLE_UPDATE
=
"variableUpdate"
;
protected
String
id
;
protected
String
processInstanceId
;
protected
String
processInstanceUrl
;
protected
String
executionId
;
protected
String
activityInstanceId
;
protected
String
taskId
;
protected
String
taskUrl
;
protected
Date
time
;
protected
String
detailType
;
// Historic variable update properties
protected
Integer
revision
;
protected
RestVariable
variable
;
// Form properties
protected
String
propertyId
;
protected
String
propertyValue
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
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
getActivityInstanceId
()
{
return
activityInstanceId
;
}
public
void
setActivityInstanceId
(
String
activityInstanceId
)
{
this
.
activityInstanceId
=
activityInstanceId
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
public
String
getTaskUrl
()
{
return
taskUrl
;
}
public
void
setTaskUrl
(
String
taskUrl
)
{
this
.
taskUrl
=
taskUrl
;
}
public
Date
getTime
()
{
return
time
;
}
public
void
setTime
(
Date
time
)
{
this
.
time
=
time
;
}
public
String
getDetailType
()
{
return
detailType
;
}
public
void
setDetailType
(
String
detailType
)
{
this
.
detailType
=
detailType
;
}
public
Integer
getRevision
()
{
return
revision
;
}
public
void
setRevision
(
Integer
revision
)
{
this
.
revision
=
revision
;
}
public
RestVariable
getVariable
()
{
return
variable
;
}
public
void
setVariable
(
RestVariable
variable
)
{
this
.
variable
=
variable
;
}
public
String
getPropertyId
()
{
return
propertyId
;
}
public
void
setPropertyId
(
String
propertyId
)
{
this
.
propertyId
=
propertyId
;
}
public
String
getPropertyValue
()
{
return
propertyValue
;
}
public
void
setPropertyValue
(
String
propertyValue
)
{
this
.
propertyValue
=
propertyValue
;
}
}
modules/activiti-rest/src/main/java/org/activiti/rest/api/history/HistoricTaskInstanceCollectionResource.java
浏览文件 @
adec4154
...
...
@@ -22,7 +22,7 @@ import org.restlet.resource.Get;
/**
* @author Tijs Rademakers
*/
public
class
HistoricTaskInstanceCollectionResource
extends
Historic
Process
InstanceBaseResource
{
public
class
HistoricTaskInstanceCollectionResource
extends
Historic
Task
InstanceBaseResource
{
@Get
public
DataResponse
getHistoricProcessInstances
()
{
...
...
@@ -32,12 +32,20 @@ public class HistoricTaskInstanceCollectionResource extends HistoricProcessInsta
Form
urlQuery
=
getQuery
();
// Populate query based on request
HistoricProcessInstanceQueryRequest
queryRequest
=
new
HistoricProcessInstanceQueryRequest
();
HistoricTaskInstanceQueryRequest
queryRequest
=
new
HistoricTaskInstanceQueryRequest
();
if
(
getQueryParameter
(
"taskId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskId
(
getQueryParameter
(
"taskId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessInstanceId
(
getQueryParameter
(
"processInstanceId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processBusinessKey"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessBusinessKey
(
getQueryParameter
(
"processBusinessKey"
,
urlQuery
));
}
if
(
getQueryParameter
(
"processDefinitionKey"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessDefinitionKey
(
getQueryParameter
(
"processDefinitionKey"
,
urlQuery
));
}
...
...
@@ -46,40 +54,92 @@ public class HistoricTaskInstanceCollectionResource extends HistoricProcessInsta
queryRequest
.
setProcessDefinitionId
(
getQueryParameter
(
"processDefinitionId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"businessKey"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessBusinessKey
(
getQueryParameter
(
"businessKey"
,
urlQuery
));
if
(
getQueryParameter
(
"processDefinitionName"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setProcessDefinitionName
(
getQueryParameter
(
"processDefinitionName"
,
urlQuery
));
}
if
(
getQueryParameter
(
"executionId"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setExecutionId
(
getQueryParameter
(
"executionId"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskName"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskName
(
getQueryParameter
(
"taskName"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskNameLike"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskNameLike
(
getQueryParameter
(
"taskNameLike"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskDescription"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskDescription
(
getQueryParameter
(
"taskDescription"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskDescriptionLike"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskDescriptionLike
(
getQueryParameter
(
"taskDescriptionLike"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskDefinitionKey"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskDefinitionKey
(
getQueryParameter
(
"taskDefinitionKey"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskDeleteReason"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskDeleteReason
(
getQueryParameter
(
"taskDeleteReason"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskDeleteReasonLike"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskDeleteReasonLike
(
getQueryParameter
(
"taskDeleteReasonLike"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskAssignee"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskAssignee
(
getQueryParameter
(
"taskAssignee"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskAssigneeLike"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskAssigneeLike
(
getQueryParameter
(
"taskAssigneeLike"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskOwner"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskOwner
(
getQueryParameter
(
"taskOwner"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskOwnerLike"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskOwnerLike
(
getQueryParameter
(
"taskOwnerLike"
,
urlQuery
));
}
if
(
getQueryParameter
(
"taskInvolvedUser"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setTaskInvolvedUser
(
getQueryParameter
(
"taskInvolvedUser"
,
urlQuery
));
}
if
(
getQueryParameter
(
"
involvedUser
"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
InvolvedUser
(
getQueryParameter
(
"involvedUser
"
,
urlQuery
));
if
(
getQueryParameter
(
"
taskPriority
"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
TaskPriority
(
getQueryParameterAsInt
(
"taskPriority
"
,
urlQuery
));
}
if
(
getQueryParameter
(
"finished"
,
urlQuery
)
!=
null
)
{
queryRequest
.
setFinished
(
getQueryParameterAsBoolean
(
"finished"
,
urlQuery
));
}
if
(
getQueryParameter
(
"
superProcessInstanceI
d"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
SuperProcessInstanceId
(
getQueryParameter
(
"superProcessInstanceI
d"
,
urlQuery
));
if
(
getQueryParameter
(
"
processFinishe
d"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
ProcessFinished
(
getQueryParameterAsBoolean
(
"processFinishe
d"
,
urlQuery
));
}
if
(
getQueryParameter
(
"
finishedAfter
"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
FinishedAfter
(
getQueryParameterAsDate
(
"finishedAfter
"
,
urlQuery
));
if
(
getQueryParameter
(
"
parentTaskId
"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
ParentTaskId
(
getQueryParameter
(
"parentTaskId
"
,
urlQuery
));
}
if
(
getQueryParameter
(
"
finishedBefor
e"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
FinishedBefore
(
getQueryParameterAsDate
(
"finishedBefor
e"
,
urlQuery
));
if
(
getQueryParameter
(
"
dueDat
e"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
DueDate
(
getQueryParameterAsDate
(
"dueDat
e"
,
urlQuery
));
}
if
(
getQueryParameter
(
"
started
After"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
StartedAfter
(
getQueryParameterAsDate
(
"started
After"
,
urlQuery
));
if
(
getQueryParameter
(
"
dueDate
After"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
DueDateAfter
(
getQueryParameterAsDate
(
"dueDate
After"
,
urlQuery
));
}
if
(
getQueryParameter
(
"
started
Before"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
StartedBefore
(
getQueryParameterAsDate
(
"started
Before"
,
urlQuery
));
if
(
getQueryParameter
(
"
dueDate
Before"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
DueDateBefore
(
getQueryParameterAsDate
(
"dueDate
Before"
,
urlQuery
));
}
if
(
getQueryParameter
(
"
startedBy
"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
StartedBy
(
getQueryParameter
(
"startedBy
"
,
urlQuery
));
if
(
getQueryParameter
(
"
taskCreatedOn
"
,
urlQuery
)
!=
null
)
{
queryRequest
.
set
TaskCreatedOn
(
getQueryParameterAsDate
(
"taskCreatedOn
"
,
urlQuery
));
}
return
getQueryResponse
(
queryRequest
,
urlQuery
);
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/process/BaseExecutionVariableResource.java
浏览文件 @
adec4154
...
...
@@ -237,7 +237,7 @@ public class BaseExecutionVariableResource extends SecuredResource {
protected
RestVariable
constructRestVariable
(
SecuredResource
securedResource
,
String
variableName
,
Object
value
,
RestVariableScope
variableScope
,
String
executionId
,
boolean
includeBinary
)
{
return
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
createRestVariable
(
this
,
variableName
,
value
,
variableScope
,
null
,
executionId
,
null
,
includeBinary
);
.
createRestVariable
(
this
,
variableName
,
value
,
variableScope
,
null
,
executionId
,
null
,
null
,
includeBinary
);
}
/**
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/process/ExecutionVariableCollectionResource.java
浏览文件 @
adec4154
...
...
@@ -120,7 +120,7 @@ public class ExecutionVariableCollectionResource extends BaseExecutionVariableRe
Object
actualVariableValue
=
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
getVariableValue
(
var
);
variablesToSet
.
put
(
var
.
getName
(),
actualVariableValue
);
variables
.
add
(
factory
.
createRestVariable
(
this
,
var
.
getName
(),
actualVariableValue
,
varScope
,
execution
.
getId
(),
null
,
null
,
false
));
variables
.
add
(
factory
.
createRestVariable
(
this
,
var
.
getName
(),
actualVariableValue
,
varScope
,
execution
.
getId
(),
null
,
null
,
null
,
false
));
}
if
(
variablesToSet
.
size
()
>
0
)
{
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/process/ProcessInstanceVariableResource.java
浏览文件 @
adec4154
...
...
@@ -50,7 +50,7 @@ public class ProcessInstanceVariableResource extends ExecutionVariableResource {
protected
RestVariable
constructRestVariable
(
SecuredResource
securedResource
,
String
variableName
,
Object
value
,
RestVariableScope
variableScope
,
String
executionId
,
boolean
includeBinary
)
{
return
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
createRestVariable
(
this
,
variableName
,
value
,
variableScope
,
null
,
null
,
executionId
,
includeBinary
);
.
createRestVariable
(
this
,
variableName
,
value
,
variableScope
,
null
,
null
,
executionId
,
null
,
includeBinary
);
}
@Override
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/task/TaskVariableBaseResource.java
浏览文件 @
adec4154
...
...
@@ -90,7 +90,7 @@ public class TaskVariableBaseResource extends TaskBaseResource {
throw
new
ActivitiObjectNotFoundException
(
"Task '"
+
taskId
+
"' doesn't have a variable with name: '"
+
variableName
+
"'."
,
VariableInstanceEntity
.
class
);
}
else
{
return
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
createRestVariable
(
this
,
variableName
,
value
,
variableScope
,
taskId
,
null
,
null
,
includeBinary
);
.
createRestVariable
(
this
,
variableName
,
value
,
variableScope
,
taskId
,
null
,
null
,
null
,
includeBinary
);
}
}
...
...
@@ -199,7 +199,7 @@ public class TaskVariableBaseResource extends TaskBaseResource {
return
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
createRestVariable
(
this
,
restVariable
.
getName
(),
actualVariableValue
,
scope
,
task
.
getId
(),
null
,
null
,
false
);
.
createRestVariable
(
this
,
restVariable
.
getName
(),
actualVariableValue
,
scope
,
task
.
getId
(),
null
,
null
,
null
,
false
);
}
protected
void
setVariable
(
Task
task
,
String
name
,
Object
value
,
RestVariableScope
scope
,
boolean
isNew
)
{
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/api/runtime/task/TaskVariableCollectionResource.java
浏览文件 @
adec4154
...
...
@@ -118,7 +118,7 @@ public class TaskVariableCollectionResource extends TaskVariableBaseResource {
Object
actualVariableValue
=
getApplication
(
ActivitiRestServicesApplication
.
class
).
getRestResponseFactory
()
.
getVariableValue
(
var
);
variablesToSet
.
put
(
var
.
getName
(),
actualVariableValue
);
variables
.
add
(
factory
.
createRestVariable
(
this
,
var
.
getName
(),
actualVariableValue
,
varScope
,
task
.
getId
(),
null
,
null
,
false
));
variables
.
add
(
factory
.
createRestVariable
(
this
,
var
.
getName
(),
actualVariableValue
,
varScope
,
task
.
getId
(),
null
,
null
,
null
,
false
));
}
if
(
variablesToSet
.
size
()
>
0
)
{
...
...
modules/activiti-rest/src/main/java/org/activiti/rest/application/RestServicesInit.java
浏览文件 @
adec4154
...
...
@@ -3,6 +3,9 @@ package org.activiti.rest.application;
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.HistoricDetailCollectionResource
;
import
org.activiti.rest.api.history.HistoricDetailDataResource
;
import
org.activiti.rest.api.history.HistoricDetailQueryResource
;
import
org.activiti.rest.api.history.HistoricFormPropertiesResource
;
import
org.activiti.rest.api.history.HistoricProcessInstanceCollectionResource
;
import
org.activiti.rest.api.history.HistoricProcessInstanceQueryResource
;
...
...
@@ -148,6 +151,8 @@ public class RestServicesInit {
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
(
"/history/historic-detail"
,
HistoricDetailCollectionResource
.
class
);
router
.
attach
(
"/history/historic-detail/{detailId}/data"
,
HistoricDetailDataResource
.
class
);
router
.
attach
(
"/management/tables"
,
TableCollectionResource
.
class
);
router
.
attach
(
"/management/tables/{tableName}"
,
TableResource
.
class
);
...
...
@@ -161,6 +166,7 @@ public class RestServicesInit {
router
.
attach
(
"/query/historic-task-instances"
,
HistoricTaskInstanceQueryResource
.
class
);
router
.
attach
(
"/query/historic-activity-instances"
,
HistoricActivityInstanceQueryResource
.
class
);
router
.
attach
(
"/query/historic-variable-instances"
,
HistoricVariableInstanceQueryResource
.
class
);
router
.
attach
(
"/query/historic-detail"
,
HistoricDetailQueryResource
.
class
);
// Old rest-urls
router
.
attach
(
"/process-engine"
,
ProcessEngineResource
.
class
);
...
...
modules/activiti-rest/src/test/java/org/activiti/rest/api/history/HistoricDetailQueryResourceTest.java
0 → 100644
浏览文件 @
adec4154
/* 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.apache.commons.io.IOUtils
;
import
org.codehaus.jackson.JsonNode
;
import
org.codehaus.jackson.JsonProcessingException
;
import
org.codehaus.jackson.node.ObjectNode
;
import
org.restlet.data.ChallengeScheme
;
import
org.restlet.data.Status
;
import
org.restlet.representation.Representation
;
import
org.restlet.resource.ClientResource
;
/**
* Test for REST-operation related to the historic detail query resource.
*
* @author Tijs Rademakers
*/
public
class
HistoricDetailQueryResourceTest
extends
BaseRestTestCase
{
/**
* Test querying historic detail.
* POST query/historic-detail
*/
@Deployment
public
void
testQueryDetail
()
throws
Exception
{
HashMap
<
String
,
Object
>
processVariables
=
new
HashMap
<
String
,
Object
>();
processVariables
.
put
(
"stringVar"
,
"Azerty"
);
processVariables
.
put
(
"intVar"
,
67890
);
processVariables
.
put
(
"booleanVar"
,
false
);
processVariables
.
put
(
"byteVar"
,
"test"
.
getBytes
());
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_DETAIL_QUERY
);
ObjectNode
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
5
,
"stringVar"
,
"Azerty"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskId"
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
"taskVariable"
,
"test"
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
4
,
"intVar"
,
67890
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
requestNode
.
put
(
"selectOnlyFormProperties"
,
true
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
,
null
,
null
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
requestNode
.
put
(
"selectOnlyVariableUpdates"
,
true
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
4
,
"booleanVar"
,
false
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
ClientResource
client
=
getAuthenticatedClient
(
url
);
Representation
response
=
client
.
post
(
requestNode
);
// Check status and size
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
JsonNode
dataNode
=
objectMapper
.
readTree
(
response
.
getStream
()).
get
(
"data"
);
boolean
byteVarFound
=
false
;
Iterator
<
JsonNode
>
it
=
dataNode
.
iterator
();
while
(
it
.
hasNext
())
{
JsonNode
variableNode
=
it
.
next
().
get
(
"variable"
);
String
name
=
variableNode
.
get
(
"name"
).
getTextValue
();
if
(
"byteVar"
.
equals
(
name
))
{
byteVarFound
=
true
;
String
valueUrl
=
variableNode
.
get
(
"valueUrl"
).
getTextValue
();
client
.
release
();
client
=
new
ClientResource
(
valueUrl
);
client
.
setChallengeResponse
(
ChallengeScheme
.
HTTP_BASIC
,
"kermit"
,
"kermit"
);
response
=
client
.
get
();
assertEquals
(
Status
.
SUCCESS_OK
,
client
.
getResponse
().
getStatus
());
byte
[]
varInput
=
IOUtils
.
toByteArray
(
response
.
getStream
());
assertEquals
(
"test"
,
new
String
(
varInput
));
break
;
}
}
assertTrue
(
byteVarFound
);
}
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
().
get
(
"variable"
);
String
name
=
variableNode
.
get
(
"name"
).
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/HistoricTaskInstanceCollectionResourceTest.java
0 → 100644
浏览文件 @
adec4154
/* 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.GregorianCalendar
;
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.map.util.ISO8601DateFormat
;
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
HistoricTaskInstanceCollectionResourceTest
extends
BaseRestTestCase
{
protected
ISO8601DateFormat
dateFormat
=
new
ISO8601DateFormat
();
/**
* Test querying historic task instance.
* GET history/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"
);
taskService
.
setOwner
(
task
.
getId
(),
"test"
);
taskService
.
setDueDate
(
task
.
getId
(),
new
GregorianCalendar
(
2013
,
0
,
1
).
getTime
());
ProcessInstance
processInstance2
=
runtimeService
.
startProcessInstanceByKey
(
"oneTaskProcess"
,
processVariables
);
Task
task2
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance2
.
getId
()).
singleResult
();
String
url
=
RestUrls
.
createRelativeResourceUrl
(
RestUrls
.
URL_HISTORIC_TASK_INSTANCES
);
assertResultsPresentInDataResponse
(
url
,
3
,
task
.
getId
(),
task2
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?processInstanceId="
+
processInstance
.
getId
(),
2
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?processInstanceId="
+
processInstance2
.
getId
(),
1
,
task2
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?taskAssignee=kermit"
,
2
,
task2
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?taskAssigneeLike="
+
encode
(
"%mit"
),
2
,
task2
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?taskAssignee=fozzie"
,
1
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?taskOwner=test"
,
1
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?taskOwnerLike="
+
encode
(
"t%"
),
1
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?taskInvolvedUser=test"
,
1
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?dueDateAfter="
+
dateFormat
.
format
(
new
GregorianCalendar
(
2010
,
0
,
1
).
getTime
()),
1
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
+
"?dueDateAfter="
+
dateFormat
.
format
(
new
GregorianCalendar
(
2013
,
4
,
1
).
getTime
()),
0
);
assertResultsPresentInDataResponse
(
url
+
"?dueDateBefore="
+
dateFormat
.
format
(
new
GregorianCalendar
(
2010
,
0
,
1
).
getTime
()),
0
);
assertResultsPresentInDataResponse
(
url
+
"?dueDateBefore="
+
dateFormat
.
format
(
new
GregorianCalendar
(
2013
,
4
,
1
).
getTime
()),
1
,
task
.
getId
());
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
int
numberOfResultsExpected
,
String
...
expectedTaskIds
)
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
(
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/HistoricTaskInstanceQueryResourceTest.java
浏览文件 @
adec4154
...
...
@@ -16,6 +16,7 @@ package org.activiti.rest.api.history;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.GregorianCalendar
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
...
...
@@ -28,6 +29,7 @@ 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.map.util.ISO8601DateFormat
;
import
org.codehaus.jackson.node.ArrayNode
;
import
org.codehaus.jackson.node.ObjectNode
;
import
org.restlet.data.Status
;
...
...
@@ -42,6 +44,8 @@ import org.restlet.resource.ClientResource;
*/
public
class
HistoricTaskInstanceQueryResourceTest
extends
BaseRestTestCase
{
protected
ISO8601DateFormat
dateFormat
=
new
ISO8601DateFormat
();
/**
* Test querying historic task instance.
* POST query/historic-task-instances
...
...
@@ -58,12 +62,12 @@ public class HistoricTaskInstanceQueryResourceTest extends BaseRestTestCase {
taskService
.
complete
(
task
.
getId
());
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
taskService
.
setVariableLocal
(
task
.
getId
(),
"local"
,
"test"
);
taskService
.
setOwner
(
task
.
getId
(),
"test"
);
taskService
.
setDueDate
(
task
.
getId
(),
new
GregorianCalendar
(
2013
,
0
,
1
).
getTime
());
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
...
...
@@ -76,7 +80,12 @@ public class HistoricTaskInstanceQueryResourceTest extends BaseRestTestCase {
variableNode
.
put
(
"name"
,
"stringVar"
);
variableNode
.
put
(
"value"
,
"Azerty"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
task
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
task
.
getId
(),
task2
.
getId
());
variableNode
.
put
(
"name"
,
"intVar"
);
variableNode
.
put
(
"value"
,
67890
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
task
.
getId
(),
task2
.
getId
());
variableNode
.
put
(
"name"
,
"local"
);
variableNode
.
put
(
"value"
,
"test"
);
...
...
@@ -84,7 +93,17 @@ public class HistoricTaskInstanceQueryResourceTest extends BaseRestTestCase {
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
requestNode
=
objectMapper
.
createObjectNode
();
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
task
.
getId
());
variableArray
=
objectMapper
.
createArrayNode
();
variableNode
=
objectMapper
.
createObjectNode
();
variableArray
.
add
(
variableNode
);
requestNode
.
put
(
"taskVariables"
,
variableArray
);
variableNode
.
put
(
"name"
,
"local"
);
variableNode
.
put
(
"value"
,
"test"
);
variableNode
.
put
(
"operation"
,
"equals"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
assertResultsPresentInDataResponse
(
url
,
requestNode
,
3
,
task
.
getId
(),
task2
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance
.
getId
());
...
...
@@ -93,6 +112,46 @@ public class HistoricTaskInstanceQueryResourceTest extends BaseRestTestCase {
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"processInstanceId"
,
processInstance2
.
getId
());
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task2
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskAssignee"
,
"kermit"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
task2
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskAssigneeLike"
,
"%mit"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
2
,
task2
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskAssignee"
,
"fozzie"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskOwner"
,
"test"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskOwnerLike"
,
"t%"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"taskInvolvedUser"
,
"test"
);
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"dueDateAfter"
,
dateFormat
.
format
(
new
GregorianCalendar
(
2010
,
0
,
1
).
getTime
()));
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task
.
getId
());
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"dueDateAfter"
,
dateFormat
.
format
(
new
GregorianCalendar
(
2013
,
4
,
1
).
getTime
()));
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"dueDateBefore"
,
dateFormat
.
format
(
new
GregorianCalendar
(
2010
,
0
,
1
).
getTime
()));
assertResultsPresentInDataResponse
(
url
,
requestNode
,
0
);
requestNode
=
objectMapper
.
createObjectNode
();
requestNode
.
put
(
"dueDateBefore"
,
dateFormat
.
format
(
new
GregorianCalendar
(
2013
,
4
,
1
).
getTime
()));
assertResultsPresentInDataResponse
(
url
,
requestNode
,
1
,
task
.
getId
());
}
protected
void
assertResultsPresentInDataResponse
(
String
url
,
ObjectNode
body
,
int
numberOfResultsExpected
,
String
...
expectedTaskIds
)
throws
JsonProcessingException
,
IOException
{
...
...
modules/activiti-rest/src/test/resources/org/activiti/rest/api/history/HistoricDetailQueryResourceTest.testQueryDetail.bpmn20.xml
0 → 100644
浏览文件 @
adec4154
<?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/HistoricTaskInstanceCollectionResourceTest.testQueryTaskInstances.bpmn20.xml
0 → 100644
浏览文件 @
adec4154
<?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 task 2"
activiti:assignee=
"fozzie"
>
<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/HistoricTaskInstanceQueryResourceTest.testQueryTaskInstances.bpmn20.xml
浏览文件 @
adec4154
...
...
@@ -9,11 +9,11 @@
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"processTask"
/>
<userTask
id=
"processTask"
name=
"Process task"
activiti:
candidateUsers=
"kermit"
activiti:candidateGroups=
"sales
"
>
<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 task 2"
activiti:
candidateUsers=
"kermit"
activiti:candidateGroups=
"sales
"
>
<userTask
id=
"processTask2"
name=
"Process task 2"
activiti:
assignee=
"fozzie
"
>
<documentation>
Process task description
</documentation>
</userTask>
<sequenceFlow
id=
"flow3"
sourceRef=
"processTask2"
targetRef=
"theEnd"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录