Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
f7d73fb7
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,发现更多精彩内容 >>
提交
f7d73fb7
编写于
4月 21, 2011
作者:
J
jbarrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ACT-750: refactored TaskNavigator to delegate to ViewManager when URL doesnt match
上级
4b157b39
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
55 deletion
+42
-55
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TaskManager.java
.../activiti/engine/impl/persistence/entity/TaskManager.java
+0
-4
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/task/TaskServiceTest.java
...va/org/activiti/engine/test/api/task/TaskServiceTest.java
+3
-1
modules/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/ViewManager.java
...rer2/src/main/java/org/activiti/explorer/ViewManager.java
+37
-1
modules/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/navigation/TaskNavigator.java
.../java/org/activiti/explorer/navigation/TaskNavigator.java
+2
-49
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/TaskManager.java
浏览文件 @
f7d73fb7
...
...
@@ -61,10 +61,6 @@ public class TaskManager extends AbstractManager {
.
getVariableInstanceManager
()
.
deleteVariableInstanceByTaskId
(
taskId
);
commandContext
.
getAttachmentManager
()
.
deleteAttachmentsByTaskId
(
taskId
);
if
(
cascade
)
{
commandContext
.
getHistoricTaskInstanceManager
()
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/api/task/TaskServiceTest.java
浏览文件 @
f7d73fb7
...
...
@@ -174,8 +174,10 @@ public class TaskServiceTest extends PluggableActivitiTestCase {
assertEquals
(
"someprocessinstanceid"
,
attachment
.
getProcessInstanceId
());
assertEquals
(
"http://weather.com"
,
attachment
.
getUrl
());
assertNull
(
taskService
.
getAttachmentContent
(
attachment
.
getId
()));
// Finally, delete task
// Finally, clean up
taskService
.
deleteTask
(
taskId
,
true
);
taskService
.
deleteAttachment
(
attachment
.
getId
());
}
}
...
...
modules/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/ViewManager.java
浏览文件 @
f7d73fb7
...
...
@@ -13,9 +13,16 @@
package
org.activiti.explorer
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
org.activiti.engine.HistoryService
;
import
org.activiti.engine.IdentityService
;
import
org.activiti.engine.ProcessEngines
;
import
org.activiti.engine.TaskService
;
import
org.activiti.engine.identity.Group
;
import
org.activiti.engine.task.IdentityLink
;
import
org.activiti.engine.task.Task
;
import
org.activiti.explorer.ui.AbstractPage
;
import
org.activiti.explorer.ui.MainWindow
;
...
...
@@ -59,10 +66,12 @@ public class ViewManager {
protected
TaskService
taskService
;
protected
HistoryService
historyService
;
protected
IdentityService
identityService
;
public
ViewManager
()
{
this
.
taskService
=
ProcessEngines
.
getDefaultProcessEngine
().
getTaskService
();
this
.
historyService
=
ProcessEngines
.
getDefaultProcessEngine
().
getHistoryService
();
this
.
identityService
=
ProcessEngines
.
getDefaultProcessEngine
().
getIdentityService
();
}
public
void
showLoginPage
()
{
...
...
@@ -106,9 +115,36 @@ public class ViewManager {
}
else
if
(
taskService
.
createTaskQuery
().
taskInvolvedUser
(
loggedInUserId
).
count
()
==
1
)
{
showInvolvedPage
(
taskId
);
}
else
{
showNavigationError
(
taskId
);
// queued
List
<
String
>
groupIds
=
getGroupIds
(
loggedInUserId
);
List
<
IdentityLink
>
identityLinks
=
taskService
.
getIdentityLinksForTask
(
task
.
getId
());
Iterator
<
IdentityLink
>
identityLinkIterator
=
identityLinks
.
iterator
();
boolean
pageFound
=
false
;
while
(!
pageFound
&&
identityLinkIterator
.
hasNext
())
{
IdentityLink
identityLink
=
identityLinkIterator
.
next
();
if
(
identityLink
.
getGroupId
()
!=
null
&&
groupIds
.
contains
(
identityLink
.
getGroupId
()))
{
showQueuedPage
(
identityLink
.
getGroupId
(),
task
.
getId
());
pageFound
=
true
;
}
}
// We've tried hard enough, the user now gets a notification. He deserves it.
if
(!
pageFound
)
{
showNavigationError
(
taskId
);
}
}
}
protected
List
<
String
>
getGroupIds
(
String
userId
)
{
List
<
String
>
groupIds
=
new
ArrayList
<
String
>();
List
<
Group
>
groups
=
identityService
.
createGroupQuery
().
groupMember
(
userId
).
list
();
for
(
Group
group
:
groups
)
{
groupIds
.
add
(
group
.
getId
());
}
return
groupIds
;
}
protected
void
showNavigationError
(
String
taskId
)
{
ExplorerApp
.
get
().
getNotificationManager
().
showErrorNotification
(
...
...
modules/activiti-webapp-explorer2/src/main/java/org/activiti/explorer/navigation/TaskNavigator.java
浏览文件 @
f7d73fb7
...
...
@@ -149,57 +149,10 @@ public class TaskNavigator implements Navigator {
if
(!
pageFound
)
{
// If URL doesnt match anymore, we must use the task data to redirect to the right page
directToPageBasedOnTaskData
(
viewManager
,
taskId
,
task
,
loggedInUser
Id
);
viewManager
.
showTaskPage
(
task
Id
);
}
}
protected
void
directToPageBasedOnTaskData
(
ViewManager
viewManager
,
String
taskId
,
Task
task
,
String
loggedInUserId
)
{
if
(
task
==
null
)
{
// If task is not found, our only hope is the archived page
boolean
isOwner
=
historyService
.
createHistoricTaskInstanceQuery
()
.
taskId
(
taskId
)
.
taskOwner
(
loggedInUserId
)
.
finished
()
.
count
()
==
1
;
if
(
isOwner
)
{
viewManager
.
showArchivedPage
(
taskId
);
}
else
{
showNavigationError
(
taskId
);
}
}
else
if
(
loggedInUserId
.
equals
(
task
.
getOwner
()))
{
viewManager
.
showCasesPage
(
task
.
getId
());
}
else
if
(
loggedInUserId
.
equals
(
task
.
getAssignee
()))
{
viewManager
.
showInboxPage
(
task
.
getId
());
}
else
{
boolean
pageFound
=
false
;
// First check involved
boolean
userInvolved
=
taskService
.
createTaskQuery
().
taskInvolvedUser
(
loggedInUserId
).
count
()
==
1
;
if
(
userInvolved
)
{
viewManager
.
showInvolvedPage
(
task
.
getId
());
pageFound
=
true
;
}
else
{
// Then check queued
List
<
String
>
groupIds
=
getGroupIds
(
loggedInUserId
);
List
<
IdentityLink
>
identityLinks
=
taskService
.
getIdentityLinksForTask
(
task
.
getId
());
Iterator
<
IdentityLink
>
identityLinkIterator
=
identityLinks
.
iterator
();
while
(!
pageFound
&&
identityLinkIterator
.
hasNext
())
{
IdentityLink
identityLink
=
identityLinkIterator
.
next
();
if
(
identityLink
.
getGroupId
()
!=
null
&&
groupIds
.
contains
(
identityLink
.
getGroupId
()))
{
viewManager
.
showQueuedPage
(
identityLink
.
getGroupId
(),
task
.
getId
());
pageFound
=
true
;
}
}
}
// We've tried hard enough, the user now gets a notification. He deserves it.
if
(!
pageFound
)
{
showNavigationError
(
taskId
);
}
}
}
protected
void
showNavigationError
(
String
taskId
)
{
String
description
=
ExplorerApp
.
get
().
getI18nManager
().
getMessage
(
Messages
.
NAVIGATION_ERROR_NOT_INVOLVED
,
taskId
);
ExplorerApp
.
get
().
getNotificationManager
().
showErrorNotification
(
Messages
.
NAVIGATION_ERROR_NOT_INVOLVED_TITLE
,
description
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录