Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
9d660f94
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9d660f94
编写于
11月 25, 2022
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复cancel work 过程中未删除docSignScrawl
上级
9db92356
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
518 addition
and
391 deletion
+518
-391
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/BaseAction.java
...essplatform/service/processing/jaxrs/work/BaseAction.java
+257
-257
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/AeiObjects.java
...cessplatform/service/processing/processor/AeiObjects.java
+126
-0
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/cancel/CancelProcessor.java
.../service/processing/processor/cancel/CancelProcessor.java
+135
-134
未找到文件。
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/jaxrs/work/BaseAction.java
浏览文件 @
9d660f94
此差异已折叠。
点击以展开。
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/AeiObjects.java
浏览文件 @
9d660f94
...
...
@@ -33,6 +33,8 @@ import com.x.base.core.project.webservices.WebservicesClient;
import
com.x.organization.core.express.Organization
;
import
com.x.processplatform.core.entity.content.Attachment
;
import
com.x.processplatform.core.entity.content.Data
;
import
com.x.processplatform.core.entity.content.DocSign
;
import
com.x.processplatform.core.entity.content.DocSignScrawl
;
import
com.x.processplatform.core.entity.content.DocumentVersion
;
import
com.x.processplatform.core.entity.content.Read
;
import
com.x.processplatform.core.entity.content.ReadCompleted
;
...
...
@@ -107,6 +109,10 @@ public class AeiObjects extends GsonPropertyObject {
// 使用用懒加载,初始为null
private
List
<
DocumentVersion
>
documentVersions
=
null
;
// 使用用懒加载,初始为null
private
List
<
DocSignScrawl
>
docSignScrawls
=
null
;
// 使用用懒加载,初始为null
private
List
<
DocSign
>
docSigns
=
null
;
// 使用用懒加载,初始为null
private
List
<
Snap
>
snaps
=
null
;
// 使用用懒加载,初始为null
private
List
<
Record
>
records
=
null
;
...
...
@@ -173,6 +179,14 @@ public class AeiObjects extends GsonPropertyObject {
private
List
<
DocumentVersion
>
updateDocumentVersions
=
new
ArrayList
<>();
private
List
<
DocumentVersion
>
deleteDocumentVersions
=
new
ArrayList
<>();
private
List
<
DocSignScrawl
>
createDocSignScrawls
=
new
ArrayList
<>();
private
List
<
DocSignScrawl
>
updateDocSignScrawls
=
new
ArrayList
<>();
private
List
<
DocSignScrawl
>
deleteDocSignScrawls
=
new
ArrayList
<>();
private
List
<
DocSign
>
createDocSigns
=
new
ArrayList
<>();
private
List
<
DocSign
>
updateDocSigns
=
new
ArrayList
<>();
private
List
<
DocSign
>
deleteDocSigns
=
new
ArrayList
<>();
private
List
<
Snap
>
createSnaps
=
new
ArrayList
<>();
private
List
<
Snap
>
updateSnaps
=
new
ArrayList
<>();
private
List
<
Snap
>
deleteSnaps
=
new
ArrayList
<>();
...
...
@@ -371,6 +385,22 @@ public class AeiObjects extends GsonPropertyObject {
return
this
.
documentVersions
;
}
public
List
<
DocSignScrawl
>
getDocSignScrawls
()
throws
Exception
{
if
(
null
==
this
.
docSignScrawls
)
{
this
.
docSignScrawls
=
this
.
business
.
entityManagerContainer
().
listEqual
(
DocSignScrawl
.
class
,
DocSignScrawl
.
job_FIELDNAME
,
this
.
work
.
getJob
());
}
return
this
.
docSignScrawls
;
}
public
List
<
DocSign
>
getDocSigns
()
throws
Exception
{
if
(
null
==
this
.
docSigns
)
{
this
.
docSigns
=
this
.
business
.
entityManagerContainer
().
listEqual
(
DocSign
.
class
,
DocSign
.
job_FIELDNAME
,
this
.
work
.
getJob
());
}
return
this
.
docSigns
;
}
public
List
<
Snap
>
getSnaps
()
throws
Exception
{
if
(
null
==
this
.
snaps
)
{
this
.
snaps
=
this
.
business
.
entityManagerContainer
().
listEqual
(
Snap
.
class
,
Snap
.
job_FIELDNAME
,
...
...
@@ -506,6 +536,30 @@ public class AeiObjects extends GsonPropertyObject {
return
updateDocumentVersions
;
}
public
List
<
DocSignScrawl
>
getCreateDocSignScrawls
()
{
return
createDocSignScrawls
;
}
public
List
<
DocSignScrawl
>
getDeleteDocSignScrawls
()
{
return
deleteDocSignScrawls
;
}
public
List
<
DocSignScrawl
>
getUpdateDocSignScrawls
()
{
return
updateDocSignScrawls
;
}
public
List
<
DocSign
>
getCreateDocSigns
()
{
return
createDocSigns
;
}
public
List
<
DocSign
>
getDeleteDocSigns
()
{
return
deleteDocSigns
;
}
public
List
<
DocSign
>
getUpdateDocSigns
()
{
return
updateDocSigns
;
}
public
List
<
Snap
>
getCreateSnaps
()
{
return
createSnaps
;
}
...
...
@@ -604,6 +658,8 @@ public class AeiObjects extends GsonPropertyObject {
/* review必须在task,taskCompleted,read,readCompleted之后提交,需要创建新的review */
this
.
commitReview
();
this
.
commitDocumentVersion
();
this
.
commitDocSign
();
this
.
commitDocSignScrawl
();
this
.
commitSnap
();
this
.
commitRecord
();
this
.
commitAttachment
();
...
...
@@ -1269,6 +1325,76 @@ public class AeiObjects extends GsonPropertyObject {
}
}
private
void
commitDocSignScrawl
()
throws
Exception
{
if
(
ListTools
.
isNotEmpty
(
this
.
getCreateDocSignScrawls
())
||
ListTools
.
isNotEmpty
(
this
.
getDeleteDocSignScrawls
())
||
ListTools
.
isNotEmpty
(
this
.
getUpdateDocSignScrawls
()))
{
this
.
entityManagerContainer
().
beginTransaction
(
DocSignScrawl
.
class
);
// 保存签批涂鸦信息
this
.
getCreateDocSignScrawls
().
stream
().
forEach
(
o
->
{
try
{
this
.
business
.
entityManagerContainer
().
persist
(
o
,
CheckPersistType
.
all
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
});
// 更新签批涂鸦信息
this
.
getUpdateDocSignScrawls
().
stream
().
forEach
(
o
->
{
try
{
this
.
business
.
entityManagerContainer
().
check
(
o
,
CheckPersistType
.
all
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
});
// 删除签批涂鸦信息
this
.
getDeleteDocSignScrawls
().
stream
().
forEach
(
o
->
{
try
{
DocSignScrawl
obj
=
this
.
business
.
entityManagerContainer
().
find
(
o
.
getId
(),
DocSignScrawl
.
class
);
if
(
null
!=
obj
)
{
this
.
business
.
entityManagerContainer
().
remove
(
obj
,
CheckRemoveType
.
all
);
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
});
}
}
private
void
commitDocSign
()
throws
Exception
{
if
(
ListTools
.
isNotEmpty
(
this
.
getCreateDocSigns
())
||
ListTools
.
isNotEmpty
(
this
.
getDeleteDocSigns
())
||
ListTools
.
isNotEmpty
(
this
.
getUpdateDocSigns
()))
{
this
.
entityManagerContainer
().
beginTransaction
(
DocSign
.
class
);
// 保存手写签批
this
.
getCreateDocSigns
().
stream
().
forEach
(
o
->
{
try
{
this
.
business
.
entityManagerContainer
().
persist
(
o
,
CheckPersistType
.
all
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
});
// 更新手写签批
this
.
getUpdateDocSigns
().
stream
().
forEach
(
o
->
{
try
{
this
.
business
.
entityManagerContainer
().
check
(
o
,
CheckPersistType
.
all
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
});
// 删除手写签批
this
.
getDeleteDocSigns
().
stream
().
forEach
(
o
->
{
try
{
DocSign
obj
=
this
.
business
.
entityManagerContainer
().
find
(
o
.
getId
(),
DocSign
.
class
);
if
(
null
!=
obj
)
{
this
.
business
.
entityManagerContainer
().
remove
(
obj
,
CheckRemoveType
.
all
);
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
});
}
}
private
void
commitSnap
()
throws
Exception
{
if
(
ListTools
.
isNotEmpty
(
this
.
getCreateSnaps
())
||
ListTools
.
isNotEmpty
(
this
.
getDeleteSnaps
())
||
ListTools
.
isNotEmpty
(
this
.
getUpdateSnaps
()))
{
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/cancel/CancelProcessor.java
浏览文件 @
9d660f94
...
...
@@ -30,139 +30,140 @@ import com.x.processplatform.service.processing.processor.AeiObjects;
public
class
CancelProcessor
extends
AbstractCancelProcessor
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CancelProcessor
.
class
);
public
CancelProcessor
(
EntityManagerContainer
entityManagerContainer
)
throws
Exception
{
super
(
entityManagerContainer
);
}
@Override
protected
Work
arriving
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
().
push
(
Signal
.
cancelArrive
(
aeiObjects
.
getWork
().
getActivityToken
(),
cancel
));
return
aeiObjects
.
getWork
();
}
@Override
protected
void
arrivingCommitted
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// nothing
}
@Override
public
List
<
Work
>
executing
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
()
.
push
(
Signal
.
cancelExecute
(
aeiObjects
.
getWork
().
getActivityToken
(),
cancel
));
// 唯一work处理
if
(
aeiObjects
.
getWorks
().
size
()
>
1
)
{
aeiObjects
.
getDeleteWorks
().
add
(
aeiObjects
.
getWork
());
aeiObjects
.
getTasks
().
stream
().
filter
(
o
->
StringUtils
.
equals
(
o
.
getWork
(),
aeiObjects
.
getWork
().
getId
()))
.
forEach
(
o
->
aeiObjects
.
getDeleteTasks
().
add
(
o
));
}
else
{
aeiObjects
.
getTasks
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteTasks
().
add
(
o
));
aeiObjects
.
getTaskCompleteds
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteTaskCompleteds
().
add
(
o
));
aeiObjects
.
getReads
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteReads
().
add
(
o
));
aeiObjects
.
getReadCompleteds
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteReadCompleteds
().
add
(
o
));
aeiObjects
.
getReviews
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteReviews
().
add
(
o
));
aeiObjects
.
getWorkLogs
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteWorkLogs
().
add
(
o
));
aeiObjects
.
getDocumentVersions
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteDocumentVersions
().
add
(
o
));
aeiObjects
.
getRecords
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteRecords
().
add
(
o
));
aeiObjects
.
getWorkLogs
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteWorkLogs
().
add
(
o
));
// 附件删除单独处理,需要删除Attachment的二进制文件
aeiObjects
.
getAttachments
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteAttachments
().
add
(
o
));
// 如果只有一份数据,没有拆分,那么删除Data
aeiObjects
.
getWorkDataHelper
().
remove
();
aeiObjects
.
getWorks
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteWorks
().
add
(
o
));
// cancel 可以不删除快照
}
return
new
ArrayList
<>();
}
@Override
protected
void
executingCommitted
(
AeiObjects
aeiObjects
,
Cancel
cancel
,
List
<
Work
>
works
)
throws
Exception
{
// 删除后再次检查,如果存在多个副本,且都已经在End状态,那么试图推动一个
if
(!
aeiObjects
.
getWorks
().
isEmpty
())
{
Predicate
<
Work
>
p
=
o
->
Objects
.
equals
(
ActivityType
.
end
,
o
.
getActivityType
());
if
(
aeiObjects
.
getWorks
().
stream
().
allMatch
(
p
))
{
touchWork
(
aeiObjects
.
getWorks
().
get
(
0
).
getId
());
}
}
tryUpdateParentWork
(
aeiObjects
);
}
private
void
tryUpdateParentWork
(
AeiObjects
aeiObjects
)
{
if
(
StringUtils
.
isNotBlank
(
aeiObjects
.
getWork
().
getProperties
().
getParentWork
()))
{
try
{
Work
parent
=
aeiObjects
.
entityManagerContainer
()
.
find
(
aeiObjects
.
getWork
().
getProperties
().
getParentWork
(),
Work
.
class
);
if
((
null
!=
parent
)
&&
Objects
.
equals
(
parent
.
getActivityType
(),
ActivityType
.
embed
))
{
Embed
embed
=
(
Embed
)
aeiObjects
.
business
().
element
().
get
(
parent
.
getActivity
(),
parent
.
getActivityType
());
if
((
null
!=
embed
)
&&
BooleanUtils
.
isTrue
(
embed
.
getWaitUntilCompleted
()))
{
updateParentWork
(
aeiObjects
,
parent
,
embed
);
}
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
new
ExceptionUpdateParentWork
(
e
,
aeiObjects
.
getWork
().
getId
(),
aeiObjects
.
getWork
().
getProperties
().
getParentWork
()));
}
}
}
private
void
updateParentWork
(
AeiObjects
aeiObjects
,
Work
parent
,
Embed
embed
)
throws
Exception
{
// 先把状态值注入,这样脚本执行时可以取得到值.
parent
.
setEmbedCompleted
(
ActivityType
.
cancel
.
toString
());
AeiObjects
embedAeiObjects
=
new
AeiObjects
(
aeiObjects
.
business
(),
parent
,
embed
,
aeiObjects
.
getProcessingConfigurator
(),
aeiObjects
.
getProcessingAttributes
());
embedAeiObjects
.
entityManagerContainer
().
beginTransaction
(
Work
.
class
);
if
(
this
.
hasEmbedCompletedScript
(
embed
)
||
this
.
hasEmbedCompletedCancelScript
(
embed
))
{
ScriptContext
scriptContext
=
embedAeiObjects
.
scriptContext
();
Bindings
bindings
=
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
bindings
.
put
(
ScriptingFactory
.
BINDING_NAME_EMBEDDATA
,
aeiObjects
.
getData
());
if
(
this
.
hasEmbedCompletedScript
(
embed
))
{
CompiledScript
cs
=
aeiObjects
.
business
().
element
()
.
getCompiledScript
(
aeiObjects
.
getWork
().
getApplication
(),
embed
,
Business
.
EVENT_EMBEDCOMPLETED
);
JsonScriptingExecutor
.
eval
(
cs
,
scriptContext
);
}
if
(
this
.
hasEmbedCompletedCancelScript
(
embed
))
{
CompiledScript
cs
=
aeiObjects
.
business
().
element
().
getCompiledScript
(
aeiObjects
.
getWork
().
getApplication
(),
embed
,
Business
.
EVENT_EMBEDCOMPLETEDCANCEL
);
JsonScriptingExecutor
.
eval
(
cs
,
scriptContext
);
}
}
embedAeiObjects
.
commit
();
touchWork
(
parent
.
getId
());
}
/**
* 触发在等待状态的父文档
*
* @param parentWorkId
*/
private
void
touchWork
(
String
workId
)
{
new
Thread
(
CancelProcessor
.
class
.
getName
()
+
"_touchWork"
)
{
@Override
public
void
run
()
{
try
{
new
Processing
(
new
ProcessingAttributes
()).
processing
(
workId
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
}
}.
start
();
}
@Override
protected
List
<
Route
>
inquiring
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
()
.
push
(
Signal
.
cancelInquire
(
aeiObjects
.
getWork
().
getActivityToken
(),
cancel
));
return
new
ArrayList
<>();
}
@Override
protected
void
inquiringCommitted
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// nothing
}
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
CancelProcessor
.
class
);
public
CancelProcessor
(
EntityManagerContainer
entityManagerContainer
)
throws
Exception
{
super
(
entityManagerContainer
);
}
@Override
protected
Work
arriving
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
().
push
(
Signal
.
cancelArrive
(
aeiObjects
.
getWork
().
getActivityToken
(),
cancel
));
return
aeiObjects
.
getWork
();
}
@Override
protected
void
arrivingCommitted
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// nothing
}
@Override
public
List
<
Work
>
executing
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
()
.
push
(
Signal
.
cancelExecute
(
aeiObjects
.
getWork
().
getActivityToken
(),
cancel
));
// 唯一work处理
if
(
aeiObjects
.
getWorks
().
size
()
>
1
)
{
aeiObjects
.
getDeleteWorks
().
add
(
aeiObjects
.
getWork
());
aeiObjects
.
getTasks
().
stream
().
filter
(
o
->
StringUtils
.
equals
(
o
.
getWork
(),
aeiObjects
.
getWork
().
getId
()))
.
forEach
(
o
->
aeiObjects
.
getDeleteTasks
().
add
(
o
));
}
else
{
aeiObjects
.
getTasks
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteTasks
().
add
(
o
));
aeiObjects
.
getTaskCompleteds
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteTaskCompleteds
().
add
(
o
));
aeiObjects
.
getReads
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteReads
().
add
(
o
));
aeiObjects
.
getReadCompleteds
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteReadCompleteds
().
add
(
o
));
aeiObjects
.
getReviews
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteReviews
().
add
(
o
));
aeiObjects
.
getDocumentVersions
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteDocumentVersions
().
add
(
o
));
aeiObjects
.
getDocSignScrawls
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteDocSignScrawls
().
add
(
o
));
aeiObjects
.
getDocSigns
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteDocSigns
().
add
(
o
));
aeiObjects
.
getRecords
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteRecords
().
add
(
o
));
aeiObjects
.
getWorkLogs
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteWorkLogs
().
add
(
o
));
// 附件删除单独处理,需要删除Attachment的二进制文件
aeiObjects
.
getAttachments
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteAttachments
().
add
(
o
));
// 如果只有一份数据,没有拆分,那么删除Data
aeiObjects
.
getWorkDataHelper
().
remove
();
aeiObjects
.
getWorks
().
stream
().
forEach
(
o
->
aeiObjects
.
getDeleteWorks
().
add
(
o
));
// cancel 可以不删除快照
}
return
new
ArrayList
<>();
}
@Override
protected
void
executingCommitted
(
AeiObjects
aeiObjects
,
Cancel
cancel
,
List
<
Work
>
works
)
throws
Exception
{
// 删除后再次检查,如果存在多个副本,且都已经在End状态,那么试图推动一个
if
(!
aeiObjects
.
getWorks
().
isEmpty
())
{
Predicate
<
Work
>
p
=
o
->
Objects
.
equals
(
ActivityType
.
end
,
o
.
getActivityType
());
if
(
aeiObjects
.
getWorks
().
stream
().
allMatch
(
p
))
{
touchWork
(
aeiObjects
.
getWorks
().
get
(
0
).
getId
());
}
}
tryUpdateParentWork
(
aeiObjects
);
}
private
void
tryUpdateParentWork
(
AeiObjects
aeiObjects
)
{
if
(
StringUtils
.
isNotBlank
(
aeiObjects
.
getWork
().
getProperties
().
getParentWork
()))
{
try
{
Work
parent
=
aeiObjects
.
entityManagerContainer
()
.
find
(
aeiObjects
.
getWork
().
getProperties
().
getParentWork
(),
Work
.
class
);
if
((
null
!=
parent
)
&&
Objects
.
equals
(
parent
.
getActivityType
(),
ActivityType
.
embed
))
{
Embed
embed
=
(
Embed
)
aeiObjects
.
business
().
element
().
get
(
parent
.
getActivity
(),
parent
.
getActivityType
());
if
((
null
!=
embed
)
&&
BooleanUtils
.
isTrue
(
embed
.
getWaitUntilCompleted
()))
{
updateParentWork
(
aeiObjects
,
parent
,
embed
);
}
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
new
ExceptionUpdateParentWork
(
e
,
aeiObjects
.
getWork
().
getId
(),
aeiObjects
.
getWork
().
getProperties
().
getParentWork
()));
}
}
}
private
void
updateParentWork
(
AeiObjects
aeiObjects
,
Work
parent
,
Embed
embed
)
throws
Exception
{
// 先把状态值注入,这样脚本执行时可以取得到值.
parent
.
setEmbedCompleted
(
ActivityType
.
cancel
.
toString
());
AeiObjects
embedAeiObjects
=
new
AeiObjects
(
aeiObjects
.
business
(),
parent
,
embed
,
aeiObjects
.
getProcessingConfigurator
(),
aeiObjects
.
getProcessingAttributes
());
embedAeiObjects
.
entityManagerContainer
().
beginTransaction
(
Work
.
class
);
if
(
this
.
hasEmbedCompletedScript
(
embed
)
||
this
.
hasEmbedCompletedCancelScript
(
embed
))
{
ScriptContext
scriptContext
=
embedAeiObjects
.
scriptContext
();
Bindings
bindings
=
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
);
bindings
.
put
(
ScriptingFactory
.
BINDING_NAME_EMBEDDATA
,
aeiObjects
.
getData
());
if
(
this
.
hasEmbedCompletedScript
(
embed
))
{
CompiledScript
cs
=
aeiObjects
.
business
().
element
()
.
getCompiledScript
(
aeiObjects
.
getWork
().
getApplication
(),
embed
,
Business
.
EVENT_EMBEDCOMPLETED
);
JsonScriptingExecutor
.
eval
(
cs
,
scriptContext
);
}
if
(
this
.
hasEmbedCompletedCancelScript
(
embed
))
{
CompiledScript
cs
=
aeiObjects
.
business
().
element
().
getCompiledScript
(
aeiObjects
.
getWork
().
getApplication
(),
embed
,
Business
.
EVENT_EMBEDCOMPLETEDCANCEL
);
JsonScriptingExecutor
.
eval
(
cs
,
scriptContext
);
}
}
embedAeiObjects
.
commit
();
touchWork
(
parent
.
getId
());
}
/**
* 触发在等待状态的父文档
*
* @param parentWorkId
*/
private
void
touchWork
(
String
workId
)
{
new
Thread
(
CancelProcessor
.
class
.
getName
()
+
"_touchWork"
)
{
@Override
public
void
run
()
{
try
{
new
Processing
(
new
ProcessingAttributes
()).
processing
(
workId
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
e
);
}
}
}.
start
();
}
@Override
protected
List
<
Route
>
inquiring
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// 发送ProcessingSignal
aeiObjects
.
getProcessingAttributes
()
.
push
(
Signal
.
cancelInquire
(
aeiObjects
.
getWork
().
getActivityToken
(),
cancel
));
return
new
ArrayList
<>();
}
@Override
protected
void
inquiringCommitted
(
AeiObjects
aeiObjects
,
Cancel
cancel
)
throws
Exception
{
// nothing
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录