Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
z_stack
Activiti
提交
eb0d256d
A
Activiti
项目概览
z_stack
/
Activiti
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Activiti
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eb0d256d
编写于
11月 08, 2018
作者:
B
Bassam Al-Sarori
提交者:
salaboy
11月 08, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
allow updating task formKey (#2130)
上级
ed53a4dd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
219 addition
and
0 deletion
+219
-0
activiti-api-impl/activiti-api-task-runtime-impl/src/main/java/org/activiti/runtime/api/impl/TaskRuntimeImpl.java
...n/java/org/activiti/runtime/api/impl/TaskRuntimeImpl.java
+7
-0
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/ProcessDefinitionFormKeyIT.java
.../org/activiti/spring/boot/ProcessDefinitionFormKeyIT.java
+48
-0
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/tasks/TaskRuntimeFormKeyTest.java
...rg/activiti/spring/boot/tasks/TaskRuntimeFormKeyTest.java
+117
-0
activiti-spring-boot-starter/src/test/resources/processes/SingleTaskProcess.bpmn20.xml
...src/test/resources/processes/SingleTaskProcess.bpmn20.xml
+47
-0
未找到文件。
activiti-api-impl/activiti-api-task-runtime-impl/src/main/java/org/activiti/runtime/api/impl/TaskRuntimeImpl.java
浏览文件 @
eb0d256d
...
...
@@ -254,6 +254,12 @@ public class TaskRuntimeImpl implements TaskRuntime {
if
(
updateTaskPayload
.
getDueDate
()
!=
null
)
{
internalTask
.
setDueDate
(
updateTaskPayload
.
getDueDate
());
}
if
(
updateTaskPayload
.
getParentTaskId
()
!=
null
)
{
internalTask
.
setParentTaskId
(
updateTaskPayload
.
getParentTaskId
());
}
if
(
updateTaskPayload
.
getFormKey
()
!=
null
)
{
internalTask
.
setFormKey
(
updateTaskPayload
.
getFormKey
());
}
//@TODO: add check to see if something was changed before saving + add all other updateable values
taskService
.
saveTask
(
internalTask
);
Task
convertedTask
=
task
(
updateTaskPayload
.
getTaskId
());
...
...
@@ -306,6 +312,7 @@ public class TaskRuntimeImpl implements TaskRuntime {
task
.
setAssignee
(
createTaskPayload
.
getAssignee
());
}
task
.
setParentTaskId
(
createTaskPayload
.
getParentTaskId
());
task
.
setFormKey
(
createTaskPayload
.
getFormKey
());
task
.
setOwner
(
securityManager
.
getAuthenticatedUserId
());
taskService
.
saveTask
(
task
);
taskService
.
addCandidateUser
(
task
.
getId
(),
...
...
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/ProcessDefinitionFormKeyIT.java
0 → 100644
浏览文件 @
eb0d256d
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* 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.spring.boot
;
import
org.activiti.api.process.model.ProcessDefinition
;
import
org.activiti.api.process.runtime.ProcessRuntime
;
import
org.activiti.spring.boot.security.util.SecurityUtil
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
NONE
)
public
class
ProcessDefinitionFormKeyIT
{
private
static
final
String
SINGLE_TASK_PROCESS
=
"SingleTaskProcess"
;
@Autowired
private
SecurityUtil
securityUtil
;
@Autowired
private
ProcessRuntime
processRuntime
;
@Test
public
void
processDefinitionHasFormKey
()
{
securityUtil
.
logInAs
(
"garth"
);
ProcessDefinition
processDefinition
=
processRuntime
.
processDefinition
(
SINGLE_TASK_PROCESS
);
assertThat
(
processDefinition
.
getFormKey
()).
isEqualTo
(
"startForm"
);
}
}
\ No newline at end of file
activiti-spring-boot-starter/src/test/java/org/activiti/spring/boot/tasks/TaskRuntimeFormKeyTest.java
0 → 100644
浏览文件 @
eb0d256d
/*
* Copyright 2018 Alfresco, Inc. and/or its affiliates.
*
* 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.spring.boot.tasks
;
import
org.activiti.api.process.model.builders.ProcessPayloadBuilder
;
import
org.activiti.api.process.runtime.ProcessRuntime
;
import
org.activiti.api.runtime.shared.query.Page
;
import
org.activiti.api.runtime.shared.query.Pageable
;
import
org.activiti.api.task.model.Task
;
import
org.activiti.api.task.model.builders.TaskPayloadBuilder
;
import
org.activiti.api.task.model.builders.UpdateTaskPayloadBuilder
;
import
org.activiti.api.task.runtime.TaskRuntime
;
import
org.activiti.spring.boot.security.util.SecurityUtil
;
import
org.junit.FixMethodOrder
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.MethodSorters
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
NONE
)
@ContextConfiguration
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
public
class
TaskRuntimeFormKeyTest
{
private
static
final
String
SINGLE_TASK_PROCESS
=
"SingleTaskProcess"
;
@Autowired
private
TaskRuntime
taskRuntime
;
@Autowired
private
ProcessRuntime
processRuntime
;
@Autowired
private
SecurityUtil
securityUtil
;
@Test
public
void
standaloneTaskHasFormKey
()
{
securityUtil
.
logInAs
(
"garth"
);
taskRuntime
.
create
(
TaskPayloadBuilder
.
create
()
.
withName
(
"atask"
)
.
withAssignee
(
"garth"
)
.
withFormKey
(
"aFormKey"
)
.
build
());
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
assertThat
(
tasks
.
getContent
()).
hasSize
(
1
);
Task
task
=
tasks
.
getContent
().
get
(
0
);
assertThat
(
task
.
getFormKey
()).
isEqualTo
(
"aFormKey"
);
taskRuntime
.
complete
(
TaskPayloadBuilder
.
complete
().
withTaskId
(
task
.
getId
()).
build
());
}
@Test
public
void
shouldUpdateTaskFormKey
()
{
securityUtil
.
logInAs
(
"garth"
);
taskRuntime
.
create
(
TaskPayloadBuilder
.
create
()
.
withName
(
"atask"
)
.
withAssignee
(
"garth"
)
.
build
());
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
assertThat
(
tasks
.
getContent
()).
hasSize
(
1
);
Task
task
=
tasks
.
getContent
().
get
(
0
);
taskRuntime
.
update
(
new
UpdateTaskPayloadBuilder
()
.
withTaskId
(
task
.
getId
())
.
withFormKey
(
"aFormKey"
)
.
build
());
task
=
taskRuntime
.
task
(
task
.
getId
());
assertThat
(
task
.
getFormKey
()).
isEqualTo
(
"aFormKey"
);
taskRuntime
.
complete
(
TaskPayloadBuilder
.
complete
().
withTaskId
(
task
.
getId
()).
build
());
}
@Test
public
void
processTaskHasFormKey
()
{
securityUtil
.
logInAs
(
"garth"
);
processRuntime
.
start
(
ProcessPayloadBuilder
.
start
()
.
withProcessDefinitionKey
(
SINGLE_TASK_PROCESS
)
.
build
());
Page
<
Task
>
tasks
=
taskRuntime
.
tasks
(
Pageable
.
of
(
0
,
50
));
assertThat
(
tasks
.
getContent
()).
hasSize
(
1
);
Task
task
=
tasks
.
getContent
().
get
(
0
);
assertThat
(
task
.
getFormKey
()).
isEqualTo
(
"taskForm"
);
taskRuntime
.
complete
(
TaskPayloadBuilder
.
complete
().
withTaskId
(
task
.
getId
()).
build
());
}
}
activiti-spring-boot-starter/src/test/resources/processes/SingleTaskProcess.bpmn20.xml
0 → 100644
浏览文件 @
eb0d256d
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:bpmn2=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:di=
"http://www.omg.org/spec/DD/20100524/DI"
xmlns:activiti=
"http://activiti.org/bpmn"
id=
"sample-diagram"
targetNamespace=
"http://bpmn.io/schema/bpmn"
xsi:schemaLocation=
"http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
>
<bpmn2:process
id=
"SingleTaskProcess"
name=
"single-task"
isExecutable=
"true"
>
<bpmn2:startEvent
id=
"StartEvent_1"
activiti:formKey=
"startForm"
>
<bpmn2:outgoing>
SequenceFlow_1tec9n0
</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow
id=
"SequenceFlow_1tec9n0"
sourceRef=
"StartEvent_1"
targetRef=
"Task_03l0zc2"
/>
<bpmn2:endEvent
id=
"EndEvent_00jfcl0"
>
<bpmn2:incoming>
SequenceFlow_00ryslt
</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow
id=
"SequenceFlow_00ryslt"
sourceRef=
"Task_03l0zc2"
targetRef=
"EndEvent_00jfcl0"
/>
<bpmn2:userTask
id=
"Task_03l0zc2"
name=
"my-task"
activiti:assignee=
"garth"
activiti:formKey=
"taskForm"
>
<bpmn2:incoming>
SequenceFlow_1tec9n0
</bpmn2:incoming>
<bpmn2:outgoing>
SequenceFlow_00ryslt
</bpmn2:outgoing>
</bpmn2:userTask>
</bpmn2:process>
<bpmndi:BPMNDiagram
id=
"BPMNDiagram_1"
>
<bpmndi:BPMNPlane
id=
"BPMNPlane_1"
bpmnElement=
"SingleTaskProcess"
>
<bpmndi:BPMNShape
id=
"_BPMNShape_StartEvent_2"
bpmnElement=
"StartEvent_1"
>
<dc:Bounds
x=
"412"
y=
"240"
width=
"36"
height=
"36"
/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge
id=
"SequenceFlow_1tec9n0_di"
bpmnElement=
"SequenceFlow_1tec9n0"
>
<di:waypoint
x=
"448"
y=
"258"
/>
<di:waypoint
x=
"498"
y=
"258"
/>
<bpmndi:BPMNLabel>
<dc:Bounds
x=
"473"
y=
"236.5"
width=
"0"
height=
"13"
/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape
id=
"EndEvent_00jfcl0_di"
bpmnElement=
"EndEvent_00jfcl0"
>
<dc:Bounds
x=
"648"
y=
"240"
width=
"36"
height=
"36"
/>
<bpmndi:BPMNLabel>
<dc:Bounds
x=
"666"
y=
"279"
width=
"0"
height=
"13"
/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge
id=
"SequenceFlow_00ryslt_di"
bpmnElement=
"SequenceFlow_00ryslt"
>
<di:waypoint
x=
"598"
y=
"258"
/>
<di:waypoint
x=
"648"
y=
"258"
/>
<bpmndi:BPMNLabel>
<dc:Bounds
x=
"623"
y=
"236.5"
width=
"0"
height=
"13"
/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape
id=
"UserTask_07zs0fg_di"
bpmnElement=
"Task_03l0zc2"
>
<dc:Bounds
x=
"498"
y=
"218"
width=
"100"
height=
"80"
/>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录