Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
9105a504
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,发现更多精彩内容 >>
提交
9105a504
编写于
8月 22, 2013
作者:
T
tijsrademakers
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'save-form-data' of
https://github.com/mikedias/Activiti
上级
d7d4dce1
21540c4f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
70 addition
and
6 deletion
+70
-6
modules/activiti-engine/src/main/java/org/activiti/engine/FormService.java
...engine/src/main/java/org/activiti/engine/FormService.java
+3
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/FormServiceImpl.java
...c/main/java/org/activiti/engine/impl/FormServiceImpl.java
+5
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/SubmitTaskFormCmd.java
.../java/org/activiti/engine/impl/cmd/SubmitTaskFormCmd.java
+8
-4
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/form/FormServiceTest.java
...va/org/activiti/engine/test/api/form/FormServiceTest.java
+54
-1
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/FormService.java
浏览文件 @
9105a504
...
...
@@ -74,6 +74,9 @@ public interface FormService {
/** Completes a task with the user data that was entered as properties in a task form. */
void
submitTaskFormData
(
String
taskId
,
Map
<
String
,
String
>
properties
);
/** Save the data that was entered as properties in a task form. */
void
saveFormData
(
String
taskId
,
Map
<
String
,
String
>
properties
);
/**
* Retrieves a user defined reference to a start form.
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/FormServiceImpl.java
浏览文件 @
9105a504
...
...
@@ -67,7 +67,7 @@ public class FormServiceImpl extends ServiceImpl implements FormService {
}
public
void
submitTaskFormData
(
String
taskId
,
Map
<
String
,
String
>
properties
)
{
commandExecutor
.
execute
(
new
SubmitTaskFormCmd
(
taskId
,
properties
));
commandExecutor
.
execute
(
new
SubmitTaskFormCmd
(
taskId
,
properties
,
true
));
}
public
String
getStartFormKey
(
String
processDefinitionId
)
{
...
...
@@ -77,5 +77,9 @@ public class FormServiceImpl extends ServiceImpl implements FormService {
public
String
getTaskFormKey
(
String
processDefinitionId
,
String
taskDefinitionKey
)
{
return
commandExecutor
.
execute
(
new
GetFormKeyCmd
(
processDefinitionId
,
taskDefinitionKey
));
}
public
void
saveFormData
(
String
taskId
,
Map
<
String
,
String
>
properties
)
{
commandExecutor
.
execute
(
new
SubmitTaskFormCmd
(
taskId
,
properties
,
false
));
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/SubmitTaskFormCmd.java
浏览文件 @
9105a504
...
...
@@ -30,11 +30,13 @@ public class SubmitTaskFormCmd extends NeedsActiveTaskCmd<Object> {
protected
String
taskId
;
protected
Map
<
String
,
String
>
properties
;
public
SubmitTaskFormCmd
(
String
taskId
,
Map
<
String
,
String
>
properties
)
{
protected
boolean
completeTask
;
public
SubmitTaskFormCmd
(
String
taskId
,
Map
<
String
,
String
>
properties
,
boolean
completeTask
)
{
super
(
taskId
);
this
.
taskId
=
taskId
;
this
.
properties
=
properties
;
this
.
completeTask
=
completeTask
;
}
protected
Object
execute
(
CommandContext
commandContext
,
TaskEntity
task
)
{
...
...
@@ -43,8 +45,10 @@ public class SubmitTaskFormCmd extends NeedsActiveTaskCmd<Object> {
TaskFormHandler
taskFormHandler
=
task
.
getTaskDefinition
().
getTaskFormHandler
();
taskFormHandler
.
submitFormProperties
(
properties
,
task
.
getExecution
());
task
.
complete
();
if
(
completeTask
)
{
task
.
complete
();
}
return
null
;
}
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/form/FormServiceTest.java
浏览文件 @
9105a504
...
...
@@ -415,5 +415,58 @@ public class FormServiceTest extends PluggableActivitiTestCase {
assertNotNull
(
task
);
assertEquals
(
"test"
,
formService
.
getTaskFormData
(
task
.
getId
()).
getFormKey
());
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"
})
public
void
testSubmitTaskFormData
()
{
List
<
ProcessDefinition
>
processDefinitions
=
repositoryService
.
createProcessDefinitionQuery
().
list
();
assertEquals
(
1
,
processDefinitions
.
size
());
ProcessDefinition
processDefinition
=
processDefinitions
.
get
(
0
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
processDefinition
.
getKey
());
assertNotNull
(
processInstance
);
Task
task
=
null
;
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
assertNotNull
(
task
);
Map
<
String
,
String
>
properties
=
new
HashMap
<
String
,
String
>();
properties
.
put
(
"room"
,
"5b"
);
formService
.
submitTaskFormData
(
task
.
getId
(),
properties
);
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
assertNull
(
task
);
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"
})
public
void
testSaveFormData
()
{
List
<
ProcessDefinition
>
processDefinitions
=
repositoryService
.
createProcessDefinitionQuery
().
list
();
assertEquals
(
1
,
processDefinitions
.
size
());
ProcessDefinition
processDefinition
=
processDefinitions
.
get
(
0
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
processDefinition
.
getKey
());
assertNotNull
(
processInstance
);
Task
task
=
null
;
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
assertNotNull
(
task
);
String
taskId
=
task
.
getId
();
Map
<
String
,
String
>
properties
=
new
HashMap
<
String
,
String
>();
properties
.
put
(
"room"
,
"5b"
);
Map
<
String
,
String
>
expectedVariables
=
new
HashMap
<
String
,
String
>();
expectedVariables
.
put
(
"room"
,
"5b"
);
formService
.
saveFormData
(
task
.
getId
(),
properties
);
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
assertEquals
(
taskId
,
task
.
getId
());
Map
<
String
,
Object
>
variables
=
taskService
.
getVariables
(
taskId
);
assertEquals
(
expectedVariables
,
variables
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录