Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
6a12173c
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,发现更多精彩内容 >>
提交
6a12173c
编写于
10月 12, 2017
作者:
T
Tijs Rademakers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Task app UI cmmn improvements
上级
5d2807ff
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
322 addition
and
81 deletion
+322
-81
modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/engine/history/HistoricCaseInstanceQuery.java
...owable/cmmn/engine/history/HistoricCaseInstanceQuery.java
+5
-0
modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/engine/runtime/CaseInstanceQuery.java
...a/org/flowable/cmmn/engine/runtime/CaseInstanceQuery.java
+1
-0
modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java
...mn/engine/impl/history/HistoricCaseInstanceQueryImpl.java
+10
-0
modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java
...wable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java
+10
-0
modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/CaseInstance.xml
...rces/org/flowable/cmmn/db/mapping/entity/CaseInstance.xml
+6
-0
modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/HistoricCaseInstance.xml
.../flowable/cmmn/db/mapping/entity/HistoricCaseInstance.xml
+8
-1
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/i18n/en.json
...lowable-ui-task-app/src/main/webapp/workflow/i18n/en.json
+1
-0
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/scripts/controllers/task.js
...-app/src/main/webapp/workflow/scripts/controllers/task.js
+26
-2
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/scripts/services/task-service.js
...src/main/webapp/workflow/scripts/services/task-service.js
+1
-14
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/views/task-detail.html
...-task-app/src/main/webapp/workflow/views/task-detail.html
+4
-0
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/model/runtime/TaskRepresentation.java
...va/org/flowable/app/model/runtime/TaskRepresentation.java
+136
-17
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableAbstractTaskService.java
...able/app/service/runtime/FlowableAbstractTaskService.java
+4
-0
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableTaskFormService.java
...flowable/app/service/runtime/FlowableTaskFormService.java
+16
-27
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableTaskQueryService.java
...lowable/app/service/runtime/FlowableTaskQueryService.java
+57
-9
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableTaskService.java
...org/flowable/app/service/runtime/FlowableTaskService.java
+14
-3
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/PermissionService.java
...a/org/flowable/app/service/runtime/PermissionService.java
+14
-0
modules/flowable-ui-task/flowable-ui-task-rest/src/main/java/org/flowable/app/rest/runtime/TaskFormResource.java
.../java/org/flowable/app/rest/runtime/TaskFormResource.java
+0
-8
modules/flowable-variable-service/src/main/resources/org/flowable/variable/db/mapping/entity/HistoricVariableInstance.xml
...e/variable/db/mapping/entity/HistoricVariableInstance.xml
+9
-0
未找到文件。
modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/engine/history/HistoricCaseInstanceQuery.java
浏览文件 @
6a12173c
...
...
@@ -29,6 +29,11 @@ public interface HistoricCaseInstanceQuery extends Query<HistoricCaseInstanceQue
*/
HistoricCaseInstanceQuery
caseInstanceId
(
String
caseInstanceId
);
/**
* Only select historic case instances with one the given identifiers.
*/
HistoricCaseInstanceQuery
caseInstanceIds
(
Set
<
String
>
caseInstanceIds
);
/**
* Only select historic case instances with the given business key.
*/
...
...
modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/engine/runtime/CaseInstanceQuery.java
浏览文件 @
6a12173c
...
...
@@ -29,6 +29,7 @@ public interface CaseInstanceQuery extends Query<CaseInstanceQuery, CaseInstance
CaseInstanceQuery
caseDefinitionName
(
String
caseDefinitionName
);
CaseInstanceQuery
caseDefinitionVersion
(
Integer
caseDefinitionVersion
);
CaseInstanceQuery
caseInstanceId
(
String
caseInstanceId
);
CaseInstanceQuery
caseInstanceIds
(
Set
<
String
>
caseInstanceIds
);
CaseInstanceQuery
caseInstanceBusinessKey
(
String
caseInstanceBusinessKey
);
CaseInstanceQuery
caseInstanceParentId
(
String
parentId
);
CaseInstanceQuery
caseInstanceStartedBefore
(
Date
beforeTime
);
...
...
modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java
浏览文件 @
6a12173c
...
...
@@ -37,6 +37,7 @@ public class HistoricCaseInstanceQueryImpl extends AbstractQuery<HistoricCaseIns
protected
String
caseDefinitionCategory
;
protected
Integer
caseDefinitionVersion
;
protected
String
caseInstanceId
;
protected
Set
<
String
>
caseInstanceIds
;
protected
String
businessKey
;
protected
String
caseInstanceParentId
;
protected
String
deploymentId
;
...
...
@@ -117,6 +118,15 @@ public class HistoricCaseInstanceQueryImpl extends AbstractQuery<HistoricCaseIns
this
.
caseInstanceId
=
caseInstanceId
;
return
this
;
}
@Override
public
HistoricCaseInstanceQueryImpl
caseInstanceIds
(
Set
<
String
>
caseInstanceIds
)
{
if
(
caseInstanceIds
==
null
)
{
throw
new
FlowableIllegalArgumentException
(
"Case instance ids is null"
);
}
this
.
caseInstanceIds
=
caseInstanceIds
;
return
this
;
}
@Override
public
HistoricCaseInstanceQueryImpl
caseInstanceBusinessKey
(
String
businessKey
)
{
...
...
modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java
浏览文件 @
6a12173c
...
...
@@ -38,6 +38,7 @@ public class CaseInstanceQueryImpl extends AbstractQuery<CaseInstanceQuery, Case
protected
Integer
caseDefinitionVersion
;
protected
String
businessKey
;
protected
String
caseInstanceId
;
protected
Set
<
String
>
caseInstanceIds
;
protected
String
caseInstanceParentId
;
protected
String
caseInstanceParentPlanItemInstanceId
;
protected
Date
startedBefore
;
...
...
@@ -112,6 +113,15 @@ public class CaseInstanceQueryImpl extends AbstractQuery<CaseInstanceQuery, Case
this
.
caseInstanceId
=
caseInstanceId
;
return
this
;
}
@Override
public
CaseInstanceQueryImpl
caseInstanceIds
(
Set
<
String
>
caseInstanceIds
)
{
if
(
caseInstanceIds
==
null
)
{
throw
new
FlowableIllegalArgumentException
(
"Case instance ids is null"
);
}
this
.
caseInstanceIds
=
caseInstanceIds
;
return
this
;
}
@Override
public
CaseInstanceQueryImpl
caseInstanceBusinessKey
(
String
businessKey
)
{
...
...
modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/CaseInstance.xml
浏览文件 @
6a12173c
...
...
@@ -152,6 +152,12 @@
<if
test=
"caseInstanceId != null"
>
and RES.ID_ = #{caseInstanceId}
</if>
<if
test=
"caseInstanceIds != null"
>
and RES.ID_ IN
<foreach
item=
"caseInstanceId"
index=
"index"
collection=
"caseInstanceIds"
open=
"("
separator=
","
close=
")"
>
#{caseInstanceId}
</foreach>
</if>
<if
test=
"caseDefinitionId != null"
>
RES.CASE_DEF_ID_ = #{caseDefinitionId}
</if>
...
...
modules/flowable-cmmn-engine/src/main/resources/org/flowable/cmmn/db/mapping/entity/HistoricCaseInstance.xml
浏览文件 @
6a12173c
...
...
@@ -158,6 +158,13 @@
<if
test=
"caseInstanceId != null"
>
RES.ID_ = #{caseInstanceId}
</if>
<if
test=
"caseInstanceIds != null && caseInstanceIds.size() > 0"
>
and RES.ID_ IN
<foreach
item=
"caseInstanceId"
index=
"index"
collection=
"caseInstanceIds"
open=
"("
separator=
","
close=
")"
>
#{caseInstanceId}
</foreach>
</if>
<if
test=
"caseDefinitionId != null"
>
and RES.CASE_DEF_ID_ = #{caseDefinitionId}
</if>
...
...
@@ -188,7 +195,7 @@
open=
"("
separator=
","
close=
")"
>
#{deploymentId}
</foreach>
</if>
</if>
<if
test=
"businessKey != null"
>
and RES.BUSINESS_KEY_ = #{businessKey}
</if>
...
...
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/i18n/en.json
浏览文件 @
6a12173c
...
...
@@ -154,6 +154,7 @@
"ASSIGNEE"
:
"Assignee"
,
"DUE"
:
"Due"
,
"PROCESS-INSTANCE"
:
"Part of process"
,
"CASE-INSTANCE"
:
"Part of case"
,
"ENDED"
:
"Ended"
,
"DURATION"
:
"Duration"
},
...
...
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/scripts/controllers/task.js
浏览文件 @
6a12173c
...
...
@@ -235,11 +235,17 @@ angular.module('flowableApp')
$scope
.
loadComments
();
$scope
.
loadRelatedContent
();
if
(
$scope
.
model
.
task
.
processInstanceId
)
{
if
(
$scope
.
model
.
task
.
processInstanceId
)
{
$scope
.
loadProcessInstance
();
}
else
{
$scope
.
model
.
processInstance
=
null
;
}
if
(
$scope
.
model
.
task
.
scopeId
)
{
$scope
.
loadCaseInstance
();
}
else
{
$scope
.
model
.
caseInstance
=
null
;
}
$scope
.
refreshInvolvmentSummary
();
...
...
@@ -483,7 +489,6 @@ angular.module('flowableApp')
});
};
// TODO: move process instance loading to separate service and merge with process.js
$scope
.
loadProcessInstance
=
function
()
{
$http
({
method
:
'
GET
'
,
url
:
FLOWABLE
.
CONFIG
.
contextRoot
+
'
/app/rest/process-instances/
'
+
$scope
.
model
.
task
.
processInstanceId
}).
success
(
function
(
response
,
status
,
headers
,
config
)
{
...
...
@@ -502,6 +507,25 @@ angular.module('flowableApp')
}
$location
.
path
(
path
+
"
/processes
"
);
};
$scope
.
loadCaseInstance
=
function
()
{
$http
({
method
:
'
GET
'
,
url
:
FLOWABLE
.
CONFIG
.
contextRoot
+
'
/app/rest/case-instances/
'
+
$scope
.
model
.
task
.
scopeId
}).
success
(
function
(
response
,
status
,
headers
,
config
)
{
$scope
.
model
.
caseInstance
=
response
;
}).
error
(
function
(
response
,
status
,
headers
,
config
)
{
// Do nothing. User is not allowed to see the process instance
});
};
$scope
.
openCaseInstance
=
function
(
id
)
{
$rootScope
.
root
.
selectedCaseId
=
id
;
var
path
=
''
;
if
(
$rootScope
.
activeAppDefinition
&&
!
FLOWABLE
.
CONFIG
.
integrationProfile
)
{
path
=
"
/apps/
"
+
$rootScope
.
activeAppDefinition
.
id
;
}
$location
.
path
(
path
+
"
/cases
"
);
};
$scope
.
returnToTaskList
=
function
()
{
var
path
=
''
;
...
...
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/scripts/services/task-service.js
浏览文件 @
6a12173c
...
...
@@ -241,18 +241,5 @@ angular.module('flowableApp').service('TaskService', ['$http', '$q', '$rootScope
var
promise
=
deferred
.
promise
;
return
promise
;
};
this
.
getProcessInstanceVariables
=
function
(
taskId
)
{
var
data
=
{
taskId
:
taskId
};
return
httpAsPromise
(
{
method
:
'
GET
'
,
url
:
FLOWABLE
.
CONFIG
.
contextRoot
+
'
/app/rest/task-forms/
'
+
taskId
+
'
/variables
'
,
data
:
data
}
);
}
}]);
modules/flowable-ui-task/flowable-ui-task-app/src/main/webapp/workflow/views/task-detail.html
浏览文件 @
6a12173c
...
...
@@ -95,6 +95,10 @@
<span
ng-if=
"model.processInstance"
>
<a
ng-click=
"openProcessInstance(model.processInstance.id)"
>
{{model.processInstance.name
&&
model.processInstance.name || model.processInstance.processDefinitionName}}
</a>
</span>
<span
ng-if=
"model.task.scopeId && model.caseInstance"
class=
"label"
>
{{'TASK.FIELD.CASE-INSTANCE' | translate}}:
</span>
<span
ng-if=
"model.caseInstance"
>
<a
ng-click=
"openCaseInstance(model.caseInstance.id)"
>
{{model.caseInstance.name
&&
model.caseInstance.name || model.caseInstance.caseDefinitionName}}
</a>
</span>
<span
class=
"label"
ng-if=
"model.task.endDate != null && model.task.endDate != undefined"
>
{{'TASK.FIELD.ENDED' | translate}}:
</span>
<span
ng-if=
"model.task.endDate != null && model.task.endDate != undefined"
>
{{model.task.endDate | dateformat:'fromNow'}}
</span>
...
...
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/model/runtime/TaskRepresentation.java
浏览文件 @
6a12173c
...
...
@@ -17,6 +17,7 @@ import java.util.List;
import
org.flowable.app.model.common.AbstractRepresentation
;
import
org.flowable.app.model.common.UserRepresentation
;
import
org.flowable.cmmn.engine.repository.CaseDefinition
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.flowable.task.service.Task
;
import
org.flowable.task.service.TaskInfo
;
...
...
@@ -45,6 +46,7 @@ public class TaskRepresentation extends AbstractRepresentation {
protected
Integer
priority
;
protected
String
processInstanceId
;
protected
String
processInstanceName
;
protected
String
processDefinitionId
;
protected
String
processDefinitionName
;
protected
String
processDefinitionDescription
;
...
...
@@ -52,6 +54,19 @@ public class TaskRepresentation extends AbstractRepresentation {
protected
String
processDefinitionCategory
;
protected
int
processDefinitionVersion
;
protected
String
processDefinitionDeploymentId
;
protected
String
scopeId
;
protected
String
scopeType
;
protected
String
caseInstanceName
;
protected
String
scopeDefinitionId
;
protected
String
caseDefinitionName
;
protected
String
caseDefinitionDescription
;
protected
String
caseDefinitionKey
;
protected
String
caseDefinitionCategory
;
protected
int
caseDefinitionVersion
;
protected
String
caseDefinitionDeploymentId
;
protected
String
formKey
;
protected
String
processInstanceStartUserId
;
protected
boolean
initiatorCanCompleteTask
;
...
...
@@ -67,14 +82,50 @@ public class TaskRepresentation extends AbstractRepresentation {
}
public
TaskRepresentation
(
Task
task
)
{
this
(
task
,
null
);
initializeTaskDetails
(
task
);
}
public
TaskRepresentation
(
HistoricTaskInstance
task
)
{
this
(
task
,
null
);
initializeTaskDetails
(
task
);
}
public
TaskRepresentation
(
TaskInfo
taskInfo
,
ProcessDefinition
processDefinition
)
{
initializeTaskDetails
(
taskInfo
);
if
(
processDefinition
!=
null
)
{
this
.
processDefinitionName
=
processDefinition
.
getName
();
this
.
processDefinitionDescription
=
processDefinition
.
getDescription
();
this
.
processDefinitionKey
=
processDefinition
.
getKey
();
this
.
processDefinitionCategory
=
processDefinition
.
getCategory
();
this
.
processDefinitionVersion
=
processDefinition
.
getVersion
();
this
.
processDefinitionDeploymentId
=
processDefinition
.
getDeploymentId
();
}
}
public
TaskRepresentation
(
TaskInfo
taskInfo
,
CaseDefinition
caseDefinition
)
{
initializeTaskDetails
(
taskInfo
);
if
(
caseDefinition
!=
null
)
{
this
.
caseDefinitionName
=
caseDefinition
.
getName
();
this
.
caseDefinitionDescription
=
caseDefinition
.
getDescription
();
this
.
caseDefinitionKey
=
caseDefinition
.
getKey
();
this
.
caseDefinitionCategory
=
caseDefinition
.
getCategory
();
this
.
caseDefinitionVersion
=
caseDefinition
.
getVersion
();
this
.
caseDefinitionDeploymentId
=
caseDefinition
.
getDeploymentId
();
}
}
public
TaskRepresentation
(
TaskInfo
taskInfo
,
ProcessDefinition
processDefinition
,
String
processInstanceName
)
{
this
(
taskInfo
,
processDefinition
);
this
.
processInstanceName
=
processInstanceName
;
}
public
TaskRepresentation
(
TaskInfo
taskInfo
,
CaseDefinition
caseDefinition
,
String
caseInstanceName
)
{
this
(
taskInfo
,
caseDefinition
);
this
.
caseInstanceName
=
caseInstanceName
;
}
public
void
initializeTaskDetails
(
TaskInfo
taskInfo
)
{
this
.
id
=
taskInfo
.
getId
();
this
.
name
=
taskInfo
.
getName
();
this
.
description
=
taskInfo
.
getDescription
();
...
...
@@ -84,6 +135,9 @@ public class TaskRepresentation extends AbstractRepresentation {
this
.
priority
=
taskInfo
.
getPriority
();
this
.
processInstanceId
=
taskInfo
.
getProcessInstanceId
();
this
.
processDefinitionId
=
taskInfo
.
getProcessDefinitionId
();
this
.
scopeId
=
taskInfo
.
getScopeId
();
this
.
scopeType
=
taskInfo
.
getScopeType
();
this
.
scopeDefinitionId
=
taskInfo
.
getScopeDefinitionId
();
if
(
taskInfo
instanceof
HistoricTaskInstance
)
{
this
.
endDate
=
((
HistoricTaskInstance
)
taskInfo
).
getEndTime
();
...
...
@@ -93,21 +147,6 @@ public class TaskRepresentation extends AbstractRepresentation {
// Rendering of forms for historic tasks not supported currently
this
.
formKey
=
taskInfo
.
getFormKey
();
}
if
(
processDefinition
!=
null
)
{
this
.
processDefinitionName
=
processDefinition
.
getName
();
this
.
processDefinitionDescription
=
processDefinition
.
getDescription
();
this
.
processDefinitionKey
=
processDefinition
.
getKey
();
this
.
processDefinitionCategory
=
processDefinition
.
getCategory
();
this
.
processDefinitionVersion
=
processDefinition
.
getVersion
();
this
.
processDefinitionDeploymentId
=
processDefinition
.
getDeploymentId
();
}
}
public
TaskRepresentation
(
TaskInfo
taskInfo
,
ProcessDefinition
processDefinition
,
String
processInstanceName
)
{
// todo Once a ProcessInstanceInfo class is implemented, lets send in that as the 3rd parameter instead
this
(
taskInfo
,
processDefinition
);
this
.
processInstanceName
=
processInstanceName
;
}
public
void
fillTask
(
Task
task
)
{
...
...
@@ -258,6 +297,86 @@ public class TaskRepresentation extends AbstractRepresentation {
public
void
setProcessDefinitionDeploymentId
(
String
processDefinitionDeploymentId
)
{
this
.
processDefinitionDeploymentId
=
processDefinitionDeploymentId
;
}
public
String
getScopeId
()
{
return
scopeId
;
}
public
void
setScopeId
(
String
scopeId
)
{
this
.
scopeId
=
scopeId
;
}
public
String
getScopeType
()
{
return
scopeType
;
}
public
void
setScopeType
(
String
scopeType
)
{
this
.
scopeType
=
scopeType
;
}
public
String
getCaseInstanceName
()
{
return
caseInstanceName
;
}
public
void
setCaseInstanceName
(
String
caseInstanceName
)
{
this
.
caseInstanceName
=
caseInstanceName
;
}
public
String
getScopeDefinitionId
()
{
return
scopeDefinitionId
;
}
public
void
setScopeDefinitionId
(
String
scopeDefinitionId
)
{
this
.
scopeDefinitionId
=
scopeDefinitionId
;
}
public
String
getCaseDefinitionName
()
{
return
caseDefinitionName
;
}
public
void
setCaseDefinitionName
(
String
caseDefinitionName
)
{
this
.
caseDefinitionName
=
caseDefinitionName
;
}
public
String
getCaseDefinitionDescription
()
{
return
caseDefinitionDescription
;
}
public
void
setCaseDefinitionDescription
(
String
caseDefinitionDescription
)
{
this
.
caseDefinitionDescription
=
caseDefinitionDescription
;
}
public
String
getCaseDefinitionKey
()
{
return
caseDefinitionKey
;
}
public
void
setCaseDefinitionKey
(
String
caseDefinitionKey
)
{
this
.
caseDefinitionKey
=
caseDefinitionKey
;
}
public
String
getCaseDefinitionCategory
()
{
return
caseDefinitionCategory
;
}
public
void
setCaseDefinitionCategory
(
String
caseDefinitionCategory
)
{
this
.
caseDefinitionCategory
=
caseDefinitionCategory
;
}
public
int
getCaseDefinitionVersion
()
{
return
caseDefinitionVersion
;
}
public
void
setCaseDefinitionVersion
(
int
caseDefinitionVersion
)
{
this
.
caseDefinitionVersion
=
caseDefinitionVersion
;
}
public
String
getCaseDefinitionDeploymentId
()
{
return
caseDefinitionDeploymentId
;
}
public
void
setCaseDefinitionDeploymentId
(
String
caseDefinitionDeploymentId
)
{
this
.
caseDefinitionDeploymentId
=
caseDefinitionDeploymentId
;
}
public
String
getFormKey
()
{
return
formKey
;
...
...
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableAbstractTaskService.java
浏览文件 @
6a12173c
...
...
@@ -23,6 +23,7 @@ import org.flowable.bpmn.model.BpmnModel;
import
org.flowable.bpmn.model.ExtensionElement
;
import
org.flowable.bpmn.model.FlowElement
;
import
org.flowable.bpmn.model.UserTask
;
import
org.flowable.cmmn.engine.CmmnRepositoryService
;
import
org.flowable.cmmn.engine.CmmnTaskService
;
import
org.flowable.editor.language.json.converter.util.CollectionUtils
;
import
org.flowable.engine.HistoryService
;
...
...
@@ -42,6 +43,9 @@ public abstract class FlowableAbstractTaskService {
@Autowired
protected
RepositoryService
repositoryService
;
@Autowired
protected
CmmnRepositoryService
cmmnRepositoryService
;
@Autowired
protected
TaskService
taskService
;
...
...
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableTaskFormService.java
浏览文件 @
6a12173c
...
...
@@ -12,17 +12,12 @@
*/
package
org.flowable.app.service.runtime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.flowable.app.model.runtime.CompleteFormRepresentation
;
import
org.flowable.app.model.runtime.ProcessInstanceVariableRepresentation
;
import
org.flowable.app.model.runtime.SaveFormRepresentation
;
import
org.flowable.app.security.SecurityUtils
;
import
org.flowable.app.service.exception.NotFoundException
;
import
org.flowable.app.service.exception.NotPermittedException
;
import
org.flowable.cmmn.engine.CmmnTaskService
;
import
org.flowable.engine.HistoryService
;
import
org.flowable.engine.RepositoryService
;
import
org.flowable.engine.TaskService
;
...
...
@@ -32,7 +27,6 @@ import org.flowable.form.model.FormModel;
import
org.flowable.idm.api.User
;
import
org.flowable.task.service.Task
;
import
org.flowable.task.service.history.HistoricTaskInstance
;
import
org.flowable.variable.service.history.HistoricVariableInstance
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -52,6 +46,9 @@ public class FlowableTaskFormService {
@Autowired
protected
TaskService
taskService
;
@Autowired
protected
CmmnTaskService
cmmnTaskService
;
@Autowired
protected
RepositoryService
repositoryService
;
...
...
@@ -73,7 +70,11 @@ public class FlowableTaskFormService {
public
FormModel
getTaskForm
(
String
taskId
)
{
HistoricTaskInstance
task
=
permissionService
.
validateReadPermissionOnTask
(
SecurityUtils
.
getCurrentUserObject
(),
taskId
);
return
taskService
.
getTaskFormModel
(
task
.
getId
());
if
(
task
.
getProcessInstanceId
()
!=
null
)
{
return
taskService
.
getTaskFormModel
(
task
.
getId
());
}
else
{
return
cmmnTaskService
.
getTaskFormModel
(
task
.
getId
());
}
}
public
void
saveTaskForm
(
String
taskId
,
SaveFormRepresentation
saveFormRepresentation
)
{
...
...
@@ -109,28 +110,16 @@ public class FlowableTaskFormService {
checkCurrentUserCanModifyTask
(
task
);
taskService
.
completeTaskWithForm
(
taskId
,
completeTaskFormRepresentation
.
getFormId
(),
completeTaskFormRepresentation
.
getOutcome
(),
completeTaskFormRepresentation
.
getValues
());
}
public
List
<
ProcessInstanceVariableRepresentation
>
getProcessInstanceVariables
(
String
taskId
)
{
HistoricTaskInstance
task
=
permissionService
.
validateReadPermissionOnTask
(
SecurityUtils
.
getCurrentUserObject
(),
taskId
);
List
<
HistoricVariableInstance
>
historicVariables
=
historyService
.
createHistoricVariableInstanceQuery
().
processInstanceId
(
task
.
getProcessInstanceId
()).
list
();
// Get all process-variables to extract values from
Map
<
String
,
ProcessInstanceVariableRepresentation
>
processInstanceVariables
=
new
HashMap
<>();
for
(
HistoricVariableInstance
historicVariableInstance
:
historicVariables
)
{
ProcessInstanceVariableRepresentation
processInstanceVariableRepresentation
=
new
ProcessInstanceVariableRepresentation
(
historicVariableInstance
.
getVariableName
(),
historicVariableInstance
.
getVariableTypeName
(),
historicVariableInstance
.
getValue
());
processInstanceVariables
.
put
(
historicVariableInstance
.
getId
(),
processInstanceVariableRepresentation
);
if
(
task
.
getProcessInstanceId
()
!=
null
)
{
taskService
.
completeTaskWithForm
(
taskId
,
completeTaskFormRepresentation
.
getFormId
(),
completeTaskFormRepresentation
.
getOutcome
(),
completeTaskFormRepresentation
.
getValues
());
}
else
{
cmmnTaskService
.
completeTaskWithForm
(
taskId
,
completeTaskFormRepresentation
.
getFormId
(),
completeTaskFormRepresentation
.
getOutcome
(),
completeTaskFormRepresentation
.
getValues
());
}
List
<
ProcessInstanceVariableRepresentation
>
processInstanceVariableRepresenations
=
new
ArrayList
<>(
processInstanceVariables
.
values
());
return
processInstanceVariableRepresenations
;
}
pr
ivate
void
checkCurrentUserCanModifyTask
(
Task
task
)
{
pr
otected
void
checkCurrentUserCanModifyTask
(
Task
task
)
{
User
currentUser
=
SecurityUtils
.
getCurrentUserObject
();
if
(!
permissionService
.
isTaskOwnerOrAssignee
(
currentUser
,
task
.
getId
()))
{
if
(!
permissionService
.
validateIfUserIsInitiatorAndCanCompleteTask
(
currentUser
,
task
))
{
...
...
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableTaskQueryService.java
浏览文件 @
6a12173c
...
...
@@ -30,6 +30,12 @@ import org.flowable.app.security.SecurityUtils;
import
org.flowable.app.service.api.UserCache
;
import
org.flowable.app.service.api.UserCache.CachedUser
;
import
org.flowable.app.service.exception.BadRequestException
;
import
org.flowable.cmmn.engine.CmmnHistoryService
;
import
org.flowable.cmmn.engine.CmmnRepositoryService
;
import
org.flowable.cmmn.engine.CmmnRuntimeService
;
import
org.flowable.cmmn.engine.history.HistoricCaseInstance
;
import
org.flowable.cmmn.engine.repository.CaseDefinition
;
import
org.flowable.cmmn.engine.runtime.CaseInstance
;
import
org.flowable.editor.language.json.converter.util.CollectionUtils
;
import
org.flowable.engine.HistoryService
;
import
org.flowable.engine.RepositoryService
;
...
...
@@ -71,15 +77,24 @@ public class FlowableTaskQueryService {
@Autowired
protected
RepositoryService
repositoryService
;
@Autowired
protected
CmmnRepositoryService
cmmnRepositoryService
;
@Autowired
protected
TaskService
taskService
;
@Autowired
protected
RuntimeService
runtimeService
;
@Autowired
protected
CmmnRuntimeService
cmmnRuntimeService
;
@Autowired
protected
HistoryService
historyService
;
@Autowired
protected
CmmnHistoryService
cmmnHistoryService
;
@Autowired
protected
UserCache
userCache
;
...
...
@@ -172,13 +187,14 @@ public class FlowableTaskQueryService {
List
<?
extends
TaskInfo
>
tasks
=
taskInfoQueryWrapper
.
getTaskInfoQuery
().
listPage
(
page
*
size
,
size
);
JsonNode
includeProcessInstanceNode
=
requestNode
.
get
(
"includeProcessInstance"
);
// todo Once a ProcessInstanceInfo class has been implement use it instead rather than just the name
Map
<
String
,
String
>
processInstancesNames
=
new
HashMap
<>();
Map
<
String
,
String
>
caseInstancesNames
=
new
HashMap
<>();
if
(
includeProcessInstanceNode
!=
null
)
{
handleIncludeProcessInstance
(
taskInfoQueryWrapper
,
includeProcessInstanceNode
,
tasks
,
processInstancesNames
);
handleIncludeCaseInstance
(
taskInfoQueryWrapper
,
includeProcessInstanceNode
,
tasks
,
caseInstancesNames
);
}
ResultListDataRepresentation
result
=
new
ResultListDataRepresentation
(
convertTaskInfoList
(
tasks
,
processInstancesNames
));
ResultListDataRepresentation
result
=
new
ResultListDataRepresentation
(
convertTaskInfoList
(
tasks
,
processInstancesNames
,
caseInstancesNames
));
// In case we're not on the first page and the size exceeds the page size, we need to do an additional count for the total
if
(
page
!=
0
||
tasks
.
size
()
==
size
)
{
...
...
@@ -312,26 +328,58 @@ public class FlowableTaskQueryService {
}
}
}
protected
void
handleIncludeCaseInstance
(
TaskInfoQueryWrapper
taskInfoQueryWrapper
,
JsonNode
includeProcessInstanceNode
,
List
<?
extends
TaskInfo
>
tasks
,
Map
<
String
,
String
>
caseInstanceNames
)
{
if
(
includeProcessInstanceNode
.
asBoolean
()
&&
CollectionUtils
.
isNotEmpty
(
tasks
))
{
Set
<
String
>
caseInstanceIds
=
new
HashSet
<>();
for
(
TaskInfo
task
:
tasks
)
{
if
(
task
.
getScopeId
()
!=
null
)
{
caseInstanceIds
.
add
(
task
.
getScopeId
());
}
}
if
(
CollectionUtils
.
isNotEmpty
(
caseInstanceIds
))
{
if
(
taskInfoQueryWrapper
.
getTaskInfoQuery
()
instanceof
HistoricTaskInstanceQuery
)
{
List
<
HistoricCaseInstance
>
caseInstances
=
cmmnHistoryService
.
createHistoricCaseInstanceQuery
().
caseInstanceIds
(
caseInstanceIds
).
list
();
for
(
HistoricCaseInstance
caseInstance
:
caseInstances
)
{
caseInstanceNames
.
put
(
caseInstance
.
getId
(),
caseInstance
.
getName
());
}
}
else
{
List
<
CaseInstance
>
caseInstances
=
cmmnRuntimeService
.
createCaseInstanceQuery
().
caseInstanceIds
(
caseInstanceIds
).
list
();
for
(
CaseInstance
caseInstance
:
caseInstances
)
{
caseInstanceNames
.
put
(
caseInstance
.
getId
(),
caseInstance
.
getName
());
}
}
}
}
}
protected
List
<
TaskRepresentation
>
convertTaskInfoList
(
List
<?
extends
TaskInfo
>
tasks
,
Map
<
String
,
String
>
processInstanceNames
)
{
protected
List
<
TaskRepresentation
>
convertTaskInfoList
(
List
<?
extends
TaskInfo
>
tasks
,
Map
<
String
,
String
>
processInstanceNames
,
Map
<
String
,
String
>
caseInstancesNames
)
{
List
<
TaskRepresentation
>
result
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
tasks
))
{
for
(
TaskInfo
task
:
tasks
)
{
ProcessDefinitionEntity
processDefinition
=
null
;
if
(
task
.
getProcessDefinitionId
()
!=
null
)
{
processDefinition
=
(
ProcessDefinitionEntity
)
repositoryService
.
getProcessDefinition
(
task
.
getProcessDefinitionId
());
TaskRepresentation
taskRepresentation
=
null
;
if
(
task
.
getScopeDefinitionId
()
!=
null
)
{
CaseDefinition
caseDefinition
=
cmmnRepositoryService
.
getCaseDefinition
(
task
.
getScopeDefinitionId
());
taskRepresentation
=
new
TaskRepresentation
(
task
,
caseDefinition
,
caseInstancesNames
.
get
(
task
.
getScopeId
()));
}
else
{
ProcessDefinitionEntity
processDefinition
=
null
;
if
(
task
.
getProcessDefinitionId
()
!=
null
)
{
processDefinition
=
(
ProcessDefinitionEntity
)
repositoryService
.
getProcessDefinition
(
task
.
getProcessDefinitionId
());
}
taskRepresentation
=
new
TaskRepresentation
(
task
,
processDefinition
,
processInstanceNames
.
get
(
task
.
getProcessInstanceId
()));
}
TaskRepresentation
representation
=
new
TaskRepresentation
(
task
,
processDefinition
,
processInstanceNames
.
get
(
task
.
getProcessInstanceId
()));
if
(
StringUtils
.
isNotEmpty
(
task
.
getAssignee
()))
{
CachedUser
cachedUser
=
userCache
.
getUser
(
task
.
getAssignee
());
if
(
cachedUser
!=
null
&&
cachedUser
.
getUser
()
!=
null
)
{
User
assignee
=
cachedUser
.
getUser
();
r
epresentation
.
setAssignee
(
new
UserRepresentation
(
assignee
));
taskR
epresentation
.
setAssignee
(
new
UserRepresentation
(
assignee
));
}
}
result
.
add
(
r
epresentation
);
result
.
add
(
taskR
epresentation
);
}
}
return
result
;
...
...
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/FlowableTaskService.java
浏览文件 @
6a12173c
...
...
@@ -24,6 +24,7 @@ import org.flowable.app.model.runtime.TaskUpdateRepresentation;
import
org.flowable.app.security.SecurityUtils
;
import
org.flowable.app.service.api.UserCache.CachedUser
;
import
org.flowable.app.service.exception.NotFoundException
;
import
org.flowable.cmmn.engine.repository.CaseDefinition
;
import
org.flowable.engine.common.api.FlowableException
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.flowable.identitylink.service.IdentityLinkType
;
...
...
@@ -50,16 +51,26 @@ public class FlowableTaskService extends FlowableAbstractTaskService {
User
currentUser
=
SecurityUtils
.
getCurrentUserObject
();
HistoricTaskInstance
task
=
permissionService
.
validateReadPermissionOnTask
(
currentUser
,
taskId
);
ProcessDefinition
processDefinition
=
null
;
TaskRepresentation
rep
=
null
;
if
(
StringUtils
.
isNotEmpty
(
task
.
getProcessDefinitionId
()))
{
try
{
processDefinition
=
repositoryService
.
getProcessDefinition
(
task
.
getProcessDefinitionId
());
ProcessDefinition
processDefinition
=
repositoryService
.
getProcessDefinition
(
task
.
getProcessDefinitionId
());
rep
=
new
TaskRepresentation
(
task
,
processDefinition
);
}
catch
(
FlowableException
e
)
{
LOGGER
.
error
(
"Error getting process definition {}"
,
task
.
getProcessDefinitionId
(),
e
);
}
}
else
if
(
StringUtils
.
isNotEmpty
(
task
.
getScopeDefinitionId
()))
{
try
{
CaseDefinition
caseDefinition
=
cmmnRepositoryService
.
getCaseDefinition
(
task
.
getScopeDefinitionId
());
rep
=
new
TaskRepresentation
(
task
,
caseDefinition
);
}
catch
(
FlowableException
e
)
{
LOGGER
.
error
(
"Error getting case definition {}"
,
task
.
getScopeDefinitionId
(),
e
);
}
}
TaskRepresentation
rep
=
new
TaskRepresentation
(
task
,
processDefinition
);
fillPermissionInformation
(
rep
,
task
,
currentUser
);
// Populate the people
...
...
modules/flowable-ui-task/flowable-ui-task-logic/src/main/java/org/flowable/app/service/runtime/PermissionService.java
浏览文件 @
6a12173c
...
...
@@ -24,6 +24,8 @@ import org.flowable.bpmn.model.BpmnModel;
import
org.flowable.bpmn.model.ExtensionElement
;
import
org.flowable.bpmn.model.FlowElement
;
import
org.flowable.bpmn.model.UserTask
;
import
org.flowable.cmmn.engine.CmmnHistoryService
;
import
org.flowable.cmmn.engine.history.HistoricCaseInstance
;
import
org.flowable.content.api.ContentItem
;
import
org.flowable.editor.language.json.converter.util.CollectionUtils
;
import
org.flowable.engine.HistoryService
;
...
...
@@ -63,6 +65,9 @@ public class PermissionService {
@Autowired
protected
HistoryService
historyService
;
@Autowired
protected
CmmnHistoryService
cmmnHistoryService
;
@Autowired
protected
RemoteIdmService
remoteIdmService
;
...
...
@@ -146,6 +151,15 @@ public class PermissionService {
}
}
}
}
else
if
(
task
.
getScopeId
()
!=
null
)
{
HistoricCaseInstance
historicCaseInstance
=
cmmnHistoryService
.
createHistoricCaseInstanceQuery
().
caseInstanceId
(
task
.
getScopeId
()).
singleResult
();
if
(
historicCaseInstance
!=
null
&&
StringUtils
.
isNotEmpty
(
historicCaseInstance
.
getStartUserId
()))
{
String
caseInstanceStartUserId
=
historicCaseInstance
.
getStartUserId
();
if
(
String
.
valueOf
(
user
.
getId
()).
equals
(
caseInstanceStartUserId
))
{
canCompleteTask
=
true
;
}
}
}
return
canCompleteTask
;
}
...
...
modules/flowable-ui-task/flowable-ui-task-rest/src/main/java/org/flowable/app/rest/runtime/TaskFormResource.java
浏览文件 @
6a12173c
...
...
@@ -12,10 +12,7 @@
*/
package
org.flowable.app.rest.runtime
;
import
java.util.List
;
import
org.flowable.app.model.runtime.CompleteFormRepresentation
;
import
org.flowable.app.model.runtime.ProcessInstanceVariableRepresentation
;
import
org.flowable.app.model.runtime.SaveFormRepresentation
;
import
org.flowable.app.service.runtime.FlowableTaskFormService
;
import
org.flowable.form.model.FormModel
;
...
...
@@ -54,9 +51,4 @@ public class TaskFormResource {
public
void
saveTaskForm
(
@PathVariable
String
taskId
,
@RequestBody
SaveFormRepresentation
saveFormRepresentation
)
{
taskFormService
.
saveTaskForm
(
taskId
,
saveFormRepresentation
);
}
@RequestMapping
(
value
=
"/{taskId}/variables"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json"
)
public
List
<
ProcessInstanceVariableRepresentation
>
getProcessInstanceVariables
(
@PathVariable
String
taskId
)
{
return
taskFormService
.
getProcessInstanceVariables
(
taskId
);
}
}
modules/flowable-variable-service/src/main/resources/org/flowable/variable/db/mapping/entity/HistoricVariableInstance.xml
浏览文件 @
6a12173c
...
...
@@ -224,6 +224,15 @@
<if
test=
"excludeTaskRelated"
>
and RES.TASK_ID_ is NULL
</if>
<if
test=
"scopeId != null"
>
and RES.SCOPE_ID_ = #{scopeId}
</if>
<if
test=
"subScopeId != null"
>
and RES.SUB_SCOPE_ID_ = #{subScopeId}
</if>
<if
test=
"scopeType != null"
>
and RES.SCOPE_TYPE_ = #{scopeType}
</if>
<if
test=
"variableName != null"
>
and RES.NAME_ = #{variableName}
</if>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录