Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
65f6204f
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
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,发现更多精彩内容 >>
提交
65f6204f
编写于
9月 03, 2020
作者:
Z
zhourui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ec
上级
f7d36e65
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
28 deletion
+38
-28
o2server/configSample/components.json
o2server/configSample/components.json
+2
-2
o2server/x_console/src/main/java/com/x/server/console/action/EraseContent.java
...c/main/java/com/x/server/console/action/EraseContent.java
+36
-26
未找到文件。
o2server/configSample/components.json
浏览文件 @
65f6204f
...
...
@@ -81,8 +81,8 @@
"dentyList"
:
[]
},
{
"name"
:
"AppMarket"
,
"path"
:
"AppMarket"
,
"name"
:
"AppMarket
V2
"
,
"path"
:
"AppMarket
V2
"
,
"title"
:
"应用市场"
,
"iconPath"
:
"appicon.png"
,
"orderNumber"
:
8.0
,
...
...
o2server/x_console/src/main/java/com/x/server/console/action/EraseContent.java
浏览文件 @
65f6204f
...
...
@@ -26,6 +26,7 @@ import com.x.base.core.project.config.StorageMapping;
import
com.x.base.core.project.config.StorageMappings
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.tools.ClassLoaderTools
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.ListTools
;
...
...
@@ -58,32 +59,42 @@ public abstract class EraseContent {
}
protected
void
run
()
throws
Exception
{
logger
.
print
(
"erase {} content data: start at {}."
,
name
,
DateTools
.
format
(
start
));
this
.
classNames
=
ListUtils
.
intersection
(
this
.
classNames
,
(
List
<
String
>)
Config
.
resource
(
Config
.
RESOURCE_CONTAINERENTITYNAMES
));
StorageMappings
storageMappings
=
Config
.
storageMappings
();
File
persistence
=
new
File
(
Config
.
dir_local_temp_classes
(),
DateTools
.
compact
(
this
.
start
)
+
"_eraseContent.xml"
);
PersistenceXmlHelper
.
write
(
persistence
.
getAbsolutePath
(),
classNames
);
for
(
int
i
=
0
;
i
<
classNames
.
size
();
i
++)
{
Class
<?
extends
JpaObject
>
cls
=
(
Class
<?
extends
JpaObject
>)
Class
.
forName
(
classNames
.
get
(
i
));
EntityManagerFactory
emf
=
OpenJPAPersistence
.
createEntityManagerFactory
(
cls
.
getName
(),
persistence
.
getName
(),
PersistenceXmlHelper
.
properties
(
cls
.
getName
(),
Config
.
slice
().
getEnable
()));
EntityManager
em
=
emf
.
createEntityManager
();
if
(
DataItem
.
class
.
isAssignableFrom
(
cls
))
{
Long
total
=
this
.
estimateItemCount
(
em
,
cls
);
logger
.
print
(
"erase {} content data:{}, total {}."
,
name
,
cls
.
getName
(),
total
);
this
.
eraseItem
(
cls
,
em
,
total
);
}
else
{
Long
total
=
this
.
estimateCount
(
em
,
cls
);
logger
.
print
(
"erase {} content data:{}, total {}."
,
name
,
cls
.
getName
(),
total
);
this
.
erase
(
cls
,
em
,
storageMappings
,
total
);
new
Thread
(()
->
{
try
{
Thread
.
currentThread
().
setContextClassLoader
(
ClassLoaderTools
.
urlClassLoader
(
false
,
true
,
true
,
true
,
true
,
Config
.
dir_local_temp_classes
().
toPath
()));
logger
.
print
(
"erase {} content data: start at {}."
,
name
,
DateTools
.
format
(
start
));
this
.
classNames
=
ListUtils
.
intersection
(
this
.
classNames
,
(
List
<
String
>)
Config
.
resource
(
Config
.
RESOURCE_CONTAINERENTITYNAMES
));
StorageMappings
storageMappings
=
Config
.
storageMappings
();
File
persistence
=
new
File
(
Config
.
dir_local_temp_classes
(),
DateTools
.
compact
(
this
.
start
)
+
"_eraseContent.xml"
);
PersistenceXmlHelper
.
write
(
persistence
.
getAbsolutePath
(),
classNames
);
for
(
int
i
=
0
;
i
<
classNames
.
size
();
i
++)
{
Class
<?
extends
JpaObject
>
cls
=
(
Class
<?
extends
JpaObject
>)
Thread
.
currentThread
()
.
getContextClassLoader
().
loadClass
(
classNames
.
get
(
i
));
EntityManagerFactory
emf
=
OpenJPAPersistence
.
createEntityManagerFactory
(
cls
.
getName
(),
persistence
.
getName
(),
PersistenceXmlHelper
.
properties
(
cls
.
getName
(),
Config
.
slice
().
getEnable
()));
EntityManager
em
=
emf
.
createEntityManager
();
if
(
DataItem
.
class
.
isAssignableFrom
(
cls
))
{
Long
total
=
this
.
estimateItemCount
(
em
,
cls
);
logger
.
print
(
"erase {} content data:{}, total {}."
,
name
,
cls
.
getName
(),
total
);
this
.
eraseItem
(
cls
,
em
,
total
);
}
else
{
Long
total
=
this
.
estimateCount
(
em
,
cls
);
logger
.
print
(
"erase {} content data:{}, total {}."
,
name
,
cls
.
getName
(),
total
);
this
.
erase
(
cls
,
em
,
storageMappings
,
total
);
}
}
Date
end
=
new
Date
();
logger
.
print
(
"erase {} content data: completed at {}, elapsed {} ms."
,
name
,
DateTools
.
format
(
end
),
(
end
.
getTime
()
-
start
.
getTime
()));
}
catch
(
Exception
e
)
{
logger
.
error
(
e
);
}
}
Date
end
=
new
Date
();
logger
.
print
(
"erase {} content data: completed at {}, elapsed {} ms."
,
name
,
DateTools
.
format
(
end
),
(
end
.
getTime
()
-
start
.
getTime
()));
},
"eraseContentThread"
).
start
();
}
private
<
T
extends
JpaObject
>
long
estimateCount
(
EntityManager
em
,
Class
<
T
>
cls
)
{
...
...
@@ -108,7 +119,6 @@ public abstract class EraseContent {
Long
count
=
0L
;
List
<
T
>
list
=
null
;
ContainerEntity
containerEntity
=
cls
.
getAnnotation
(
ContainerEntity
.
class
);
do
{
if
(
ListTools
.
isNotEmpty
(
list
))
{
em
.
getTransaction
().
begin
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录