Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
45e7216f
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,发现更多精彩内容 >>
提交
45e7216f
编写于
12月 27, 2021
作者:
O
o2null
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '云文件定时清除回收站' into 'wrdp'
定时清除云文件回收站数据 See merge request o2oa/o2oa!6409
上级
5dc8e820
2c480145
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
240 addition
and
28 deletion
+240
-28
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java
...ain/java/com/x/file/assemble/control/ThisApplication.java
+5
-0
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/config/ActionSaveSystemConfig.java
...assemble/control/jaxrs/config/ActionSaveSystemConfig.java
+8
-0
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/recycle/ActionDelete.java
...m/x/file/assemble/control/jaxrs/recycle/ActionDelete.java
+35
-12
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/recycle/ActionEmpty.java
...om/x/file/assemble/control/jaxrs/recycle/ActionEmpty.java
+35
-12
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/schedule/RecycleClean.java
...va/com/x/file/assemble/control/schedule/RecycleClean.java
+122
-0
o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfig.java
...src/main/java/com/x/file/core/entity/open/FileConfig.java
+22
-1
o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfigProperties.java
...ava/com/x/file/core/entity/open/FileConfigProperties.java
+5
-0
o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/personal/Recycle.java
...rc/main/java/com/x/file/core/entity/personal/Recycle.java
+8
-3
未找到文件。
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/ThisApplication.java
浏览文件 @
45e7216f
...
...
@@ -4,7 +4,11 @@ import com.x.base.core.project.Context;
import
com.x.base.core.project.cache.CacheManager
;
import
com.x.base.core.project.message.MessageConnector
;
import
com.x.file.assemble.control.jaxrs.file.FileRemoveQueue
;
import
com.x.file.assemble.control.schedule.RecycleClean
;
/**
* @author sword
*/
public
class
ThisApplication
{
private
ThisApplication
()
{
...
...
@@ -23,6 +27,7 @@ public class ThisApplication {
try
{
CacheManager
.
init
(
context
.
clazz
().
getSimpleName
());
MessageConnector
.
start
(
context
());
context
.
schedule
(
RecycleClean
.
class
,
"0 20 15 * * ?"
);
context
().
startQueue
(
fileRemoveQueue
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/config/ActionSaveSystemConfig.java
浏览文件 @
45e7216f
...
...
@@ -41,6 +41,11 @@ public class ActionSaveSystemConfig extends BaseAction {
}
else
{
fileConfig
.
setCapacity
(
wi
.
getCapacity
());
}
if
(
wi
.
getRecycleDays
()==
null
||
wi
.
getRecycleDays
()
<
1
){
fileConfig
.
setRecycleDays
(
FileConfig
.
DEFAULT_RECYCLE_DAYS
);
}
else
{
fileConfig
.
setRecycleDays
(
wi
.
getRecycleDays
());
}
fileConfig
.
getProperties
().
setFileTypeIncludes
(
wi
.
getFileTypeIncludes
());
fileConfig
.
getProperties
().
setFileTypeExcludes
(
wi
.
getFileTypeExcludes
());
emc
.
check
(
fileConfig
,
CheckPersistType
.
all
);
...
...
@@ -49,6 +54,9 @@ public class ActionSaveSystemConfig extends BaseAction {
if
(
fileConfig
.
getCapacity
()==
null
||
fileConfig
.
getCapacity
()
<
1
){
fileConfig
.
setCapacity
(
0
);
}
if
(
wi
.
getRecycleDays
()==
null
||
wi
.
getRecycleDays
()
<
1
){
fileConfig
.
setRecycleDays
(
FileConfig
.
DEFAULT_RECYCLE_DAYS
);
}
fileConfig
.
setPerson
(
Business
.
SYSTEM_CONFIG
);
fileConfig
.
getProperties
().
setFileTypeIncludes
(
wi
.
getFileTypeIncludes
());
fileConfig
.
getProperties
().
setFileTypeExcludes
(
wi
.
getFileTypeExcludes
());
...
...
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/recycle/ActionDelete.java
浏览文件 @
45e7216f
...
...
@@ -5,6 +5,10 @@ import java.util.List;
import
javax.persistence.EntityManager
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.file.assemble.control.ThisApplication
;
import
com.x.file.core.entity.open.OriginFile
;
import
com.x.file.core.entity.personal.Share
;
import
org.apache.commons.lang3.StringUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
...
...
@@ -31,10 +35,11 @@ class ActionDelete extends BaseAction {
if
(!
effectivePerson
.
isManager
()
&&
!
StringUtils
.
equals
(
effectivePerson
.
getDistinguishedName
(),
recycle
.
getPerson
()))
{
throw
new
ExceptionAccessDenied
(
effectivePerson
.
getDistinguishedName
());
}
if
(
"attachment"
.
equals
(
recycle
.
getFileType
())){
EntityManager
aem
=
emc
.
beginTransaction
(
Attachment2
.
class
);
emc
.
delete
(
Attachment2
.
class
,
recycle
.
getFileId
());
aem
.
getTransaction
().
commit
();
if
(
Share
.
FILE_TYPE_ATTACHMENT
.
equals
(
recycle
.
getFileType
())){
Attachment2
att
=
emc
.
find
(
recycle
.
getFileId
(),
Attachment2
.
class
);
if
(
att
!=
null
){
this
.
deleteFile
(
business
,
att
);
}
}
else
{
Folder2
folder
=
emc
.
find
(
recycle
.
getFileId
(),
Folder2
.
class
);
if
(
folder
!=
null
)
{
...
...
@@ -44,19 +49,17 @@ class ActionDelete extends BaseAction {
for
(
int
i
=
ids
.
size
()
-
1
;
i
>=
0
;
i
--)
{
List
<
Attachment2
>
attachments
=
business
.
attachment2
().
listWithFolder2
(
ids
.
get
(
i
),
null
);
for
(
Attachment2
att
:
attachments
)
{
EntityManager
aem
=
emc
.
beginTransaction
(
Attachment2
.
class
);
aem
.
remove
(
att
);
aem
.
getTransaction
().
commit
();
this
.
deleteFile
(
business
,
att
);
}
EntityManager
fem
=
emc
.
beginTransaction
(
Folder2
.
class
);
emc
.
beginTransaction
(
Folder2
.
class
);
emc
.
delete
(
Folder2
.
class
,
ids
.
get
(
i
));
fem
.
getTransaction
()
.
commit
();
emc
.
commit
();
}
}
}
EntityManager
em
=
emc
.
beginTransaction
(
Recycle
.
class
);
emc
.
beginTransaction
(
Recycle
.
class
);
emc
.
delete
(
Recycle
.
class
,
recycle
.
getId
());
em
.
getTransaction
()
.
commit
();
em
c
.
commit
();
Wo
wo
=
new
Wo
();
wo
.
setValue
(
true
);
result
.
setData
(
wo
);
...
...
@@ -64,6 +67,26 @@ class ActionDelete extends BaseAction {
}
}
private
void
deleteFile
(
Business
business
,
Attachment2
att
)
throws
Exception
{
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
Long
count
=
emc
.
countEqual
(
Attachment2
.
class
,
Attachment2
.
originFile_FIELDNAME
,
att
.
getOriginFile
());
if
(
count
.
equals
(
1L
)){
OriginFile
originFile
=
emc
.
find
(
att
.
getOriginFile
(),
OriginFile
.
class
);
if
(
originFile
!=
null
){
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
OriginFile
.
class
,
originFile
.
getStorage
());
if
(
mapping
!=
null
){
originFile
.
deleteContent
(
mapping
);
}
emc
.
beginTransaction
(
Attachment2
.
class
);
emc
.
beginTransaction
(
OriginFile
.
class
);
emc
.
remove
(
att
);
emc
.
remove
(
originFile
);
emc
.
commit
();
}
}
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
\ No newline at end of file
}
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/jaxrs/recycle/ActionEmpty.java
浏览文件 @
45e7216f
...
...
@@ -7,13 +7,17 @@ import javax.persistence.EntityManager;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.http.EffectivePerson
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.file.assemble.control.Business
;
import
com.x.file.assemble.control.ThisApplication
;
import
com.x.file.core.entity.open.OriginFile
;
import
com.x.file.core.entity.personal.Attachment2
;
import
com.x.file.core.entity.personal.Folder2
;
import
com.x.file.core.entity.personal.Recycle
;
import
com.x.file.core.entity.personal.Share
;
class
ActionEmpty
extends
BaseAction
{
...
...
@@ -24,10 +28,11 @@ class ActionEmpty extends BaseAction {
List
<
Recycle
>
recycleList
=
business
.
recycle
().
listWithPerson
(
effectivePerson
.
getDistinguishedName
());
if
(
recycleList
!=
null
&&
!
recycleList
.
isEmpty
()){
for
(
Recycle
recycle
:
recycleList
){
if
(
"attachment"
.
equals
(
recycle
.
getFileType
())){
EntityManager
aem
=
emc
.
beginTransaction
(
Attachment2
.
class
);
emc
.
delete
(
Attachment2
.
class
,
recycle
.
getFileId
());
aem
.
getTransaction
().
commit
();
if
(
Share
.
FILE_TYPE_ATTACHMENT
.
equals
(
recycle
.
getFileType
())){
Attachment2
att
=
emc
.
find
(
recycle
.
getFileId
(),
Attachment2
.
class
);
if
(
att
!=
null
){
this
.
deleteFile
(
business
,
att
);
}
}
else
{
Folder2
folder
=
emc
.
find
(
recycle
.
getFileId
(),
Folder2
.
class
);
if
(
folder
!=
null
)
{
...
...
@@ -37,19 +42,17 @@ class ActionEmpty extends BaseAction {
for
(
int
i
=
ids
.
size
()
-
1
;
i
>=
0
;
i
--)
{
List
<
Attachment2
>
attachments
=
business
.
attachment2
().
listWithFolder2
(
ids
.
get
(
i
),
null
);
for
(
Attachment2
att
:
attachments
)
{
EntityManager
aem
=
emc
.
beginTransaction
(
Attachment2
.
class
);
aem
.
remove
(
att
);
aem
.
getTransaction
().
commit
();
this
.
deleteFile
(
business
,
att
);
}
EntityManager
fem
=
emc
.
beginTransaction
(
Folder2
.
class
);
emc
.
beginTransaction
(
Folder2
.
class
);
emc
.
delete
(
Folder2
.
class
,
ids
.
get
(
i
));
fem
.
getTransaction
()
.
commit
();
emc
.
commit
();
}
}
}
EntityManager
em
=
emc
.
beginTransaction
(
Recycle
.
class
);
emc
.
beginTransaction
(
Recycle
.
class
);
emc
.
delete
(
Recycle
.
class
,
recycle
.
getId
());
em
.
getTransaction
()
.
commit
();
em
c
.
commit
();
}
}
Wo
wo
=
new
Wo
();
...
...
@@ -59,6 +62,26 @@ class ActionEmpty extends BaseAction {
}
}
private
void
deleteFile
(
Business
business
,
Attachment2
att
)
throws
Exception
{
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
Long
count
=
emc
.
countEqual
(
Attachment2
.
class
,
Attachment2
.
originFile_FIELDNAME
,
att
.
getOriginFile
());
if
(
count
.
equals
(
1L
)){
OriginFile
originFile
=
emc
.
find
(
att
.
getOriginFile
(),
OriginFile
.
class
);
if
(
originFile
!=
null
){
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
OriginFile
.
class
,
originFile
.
getStorage
());
if
(
mapping
!=
null
){
originFile
.
deleteContent
(
mapping
);
}
emc
.
beginTransaction
(
Attachment2
.
class
);
emc
.
beginTransaction
(
OriginFile
.
class
);
emc
.
remove
(
att
);
emc
.
remove
(
originFile
);
emc
.
commit
();
}
}
}
public
static
class
Wo
extends
WrapBoolean
{
}
}
\ No newline at end of file
}
o2server/x_file_assemble_control/src/main/java/com/x/file/assemble/control/schedule/RecycleClean.java
0 → 100644
浏览文件 @
45e7216f
package
com.x.file.assemble.control.schedule
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.container.factory.EntityManagerContainerFactory
;
import
com.x.base.core.project.config.StorageMapping
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
com.x.base.core.project.schedule.AbstractJob
;
import
com.x.base.core.project.tools.DateTools
;
import
com.x.base.core.project.tools.ListTools
;
import
com.x.file.assemble.control.Business
;
import
com.x.file.assemble.control.ThisApplication
;
import
com.x.file.core.entity.open.FileConfig
;
import
com.x.file.core.entity.open.OriginFile
;
import
com.x.file.core.entity.personal.*
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
javax.persistence.EntityManager
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 定时清理回收站数据
* @author sword
*/
public
class
RecycleClean
extends
AbstractJob
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
RecycleClean
.
class
);
@Override
public
void
schedule
(
JobExecutionContext
jobExecutionContext
)
throws
Exception
{
try
{
logger
.
info
(
"开始定时清理网盘回收站数据=========="
);
this
.
cleanRecycle
();
logger
.
info
(
"结束定时清理网盘回收站数据=========="
);
}
catch
(
Exception
e
)
{
throw
new
JobExecutionException
(
e
);
}
}
private
void
cleanRecycle
()
throws
Exception
{
List
<
String
>
list
=
this
.
listRecycle
();
if
(
ListTools
.
isNotEmpty
(
list
)){
for
(
String
id
:
list
){
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Business
business
=
new
Business
(
emc
);
Recycle
recycle
=
emc
.
find
(
id
,
Recycle
.
class
);
if
(
Share
.
FILE_TYPE_ATTACHMENT
.
equals
(
recycle
.
getFileType
())){
Attachment2
att
=
emc
.
find
(
recycle
.
getFileId
(),
Attachment2
.
class
);
if
(
att
!=
null
){
this
.
deleteFile
(
business
,
att
);
}
}
else
{
Folder2
folder
=
emc
.
find
(
recycle
.
getFileId
(),
Folder2
.
class
);
if
(
folder
!=
null
)
{
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
folder
.
getId
());
ids
.
addAll
(
business
.
folder2
().
listSubNested
(
folder
.
getId
(),
null
));
for
(
int
i
=
ids
.
size
()
-
1
;
i
>=
0
;
i
--)
{
List
<
Attachment2
>
attachments
=
business
.
attachment2
().
listWithFolder2
(
ids
.
get
(
i
),
null
);
for
(
Attachment2
att
:
attachments
)
{
this
.
deleteFile
(
business
,
att
);
}
emc
.
beginTransaction
(
Folder2
.
class
);
emc
.
delete
(
Folder2
.
class
,
ids
.
get
(
i
));
emc
.
commit
();
}
}
}
emc
.
beginTransaction
(
Recycle
.
class
);
emc
.
delete
(
Recycle
.
class
,
recycle
.
getId
());
emc
.
commit
();
}
catch
(
Exception
e
){
logger
.
warn
(
"清理网盘回收站文件{}异常:{}"
,
id
,
e
.
getMessage
());
}
}
}
}
private
void
deleteFile
(
Business
business
,
Attachment2
att
)
throws
Exception
{
EntityManagerContainer
emc
=
business
.
entityManagerContainer
();
Long
count
=
emc
.
countEqual
(
Attachment2
.
class
,
Attachment2
.
originFile_FIELDNAME
,
att
.
getOriginFile
());
if
(
count
.
equals
(
1L
)){
OriginFile
originFile
=
emc
.
find
(
att
.
getOriginFile
(),
OriginFile
.
class
);
if
(
originFile
!=
null
){
StorageMapping
mapping
=
ThisApplication
.
context
().
storageMappings
().
get
(
OriginFile
.
class
,
originFile
.
getStorage
());
if
(
mapping
!=
null
){
originFile
.
deleteContent
(
mapping
);
}
emc
.
beginTransaction
(
Attachment2
.
class
);
emc
.
beginTransaction
(
OriginFile
.
class
);
emc
.
remove
(
att
);
emc
.
remove
(
originFile
);
emc
.
commit
();
}
}
}
private
List
<
String
>
listRecycle
()
throws
Exception
{
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
Integer
days
=
FileConfig
.
DEFAULT_RECYCLE_DAYS
;
FileConfig
config
=
emc
.
firstEqual
(
FileConfig
.
class
,
FileConfig
.
person_FIELDNAME
,
Business
.
SYSTEM_CONFIG
);
if
(
config
!=
null
&&
config
.
getRecycleDays
()!=
null
){
days
=
config
.
getRecycleDays
();
}
EntityManager
em
=
emc
.
get
(
Recycle
.
class
);
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
String
>
cq
=
cb
.
createQuery
(
String
.
class
);
Root
<
Recycle
>
root
=
cq
.
from
(
Recycle
.
class
);
Predicate
p
=
cb
.
lessThan
(
root
.
get
(
Recycle_
.
createTime
),
DateTools
.
addDay
(
new
Date
(),
-
days
));
cq
.
select
(
root
.
get
(
Recycle_
.
id
)).
where
(
p
);
return
em
.
createQuery
(
cq
).
getResultList
();
}
}
}
o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfig.java
浏览文件 @
45e7216f
...
...
@@ -21,6 +21,10 @@ import com.x.base.core.entity.annotation.ContainerEntity;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.file.core.entity.PersistenceProperties
;
/**
* 云文件系统配置
* @author sword
*/
@ContainerEntity
(
dumpSize
=
100
,
type
=
ContainerEntity
.
Type
.
content
,
reference
=
ContainerEntity
.
Reference
.
strong
)
@Entity
@Table
(
name
=
PersistenceProperties
.
Open
.
FileConfig
.
table
,
uniqueConstraints
=
{
...
...
@@ -32,11 +36,14 @@ public class FileConfig extends SliceJpaObject {
private
static
final
long
serialVersionUID
=
-
2266232193925155825L
;
private
static
final
String
TABLE
=
PersistenceProperties
.
Open
.
FileConfig
.
table
;
public
static
final
Integer
DEFAULT_RECYCLE_DAYS
=
30
;
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
...
...
@@ -48,6 +55,7 @@ public class FileConfig extends SliceJpaObject {
/* 以上为 JpaObject 默认字段 */
@Override
public
void
onPersist
()
throws
Exception
{
if
(
this
.
properties
==
null
)
{
this
.
properties
=
new
FileConfigProperties
();
...
...
@@ -79,6 +87,11 @@ public class FileConfig extends SliceJpaObject {
@CheckPersist
(
allowEmpty
=
false
)
private
Integer
capacity
;
public
static
final
String
recycleDays_FIELDNAME
=
"recycleDays"
;
@FieldDescribe
(
"回收站数据保留天数"
)
@Column
(
name
=
ColumnNamePrefix
+
recycleDays_FIELDNAME
)
private
Integer
recycleDays
;
public
static
final
String
properties_FIELDNAME
=
"properties"
;
@FieldDescribe
(
"属性对象存储字段."
)
@Persistent
(
fetch
=
FetchType
.
EAGER
)
...
...
@@ -111,6 +124,14 @@ public class FileConfig extends SliceJpaObject {
this
.
capacity
=
capacity
;
}
public
Integer
getRecycleDays
()
{
return
recycleDays
;
}
public
void
setRecycleDays
(
Integer
recycleDays
)
{
this
.
recycleDays
=
recycleDays
;
}
public
FileConfigProperties
getProperties
()
{
if
(
null
==
this
.
properties
)
{
this
.
properties
=
new
FileConfigProperties
();
...
...
@@ -122,4 +143,4 @@ public class FileConfig extends SliceJpaObject {
this
.
properties
=
properties
;
}
}
\ No newline at end of file
}
o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/open/FileConfigProperties.java
浏览文件 @
45e7216f
...
...
@@ -6,6 +6,10 @@ import com.x.base.core.project.annotation.FieldDescribe;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 云文件系统扩展配置
* @author sword
*/
public
class
FileConfigProperties
extends
JsonProperties
{
private
static
final
long
serialVersionUID
=
-
1259157593040432239L
;
...
...
@@ -31,4 +35,5 @@ public class FileConfigProperties extends JsonProperties {
public
void
setFileTypeExcludes
(
List
<
String
>
fileTypeExcludes
)
{
this
.
fileTypeExcludes
=
fileTypeExcludes
;
}
}
o2server/x_file_core_entity/src/main/java/com/x/file/core/entity/personal/Recycle.java
浏览文件 @
45e7216f
...
...
@@ -20,6 +20,10 @@ import javax.persistence.*;
import
java.util.Date
;
import
java.util.List
;
/**
* 回收站
* @author sword
*/
@ContainerEntity
(
dumpSize
=
1000
,
type
=
ContainerEntity
.
Type
.
content
,
reference
=
ContainerEntity
.
Reference
.
strong
)
@Entity
@Table
(
name
=
PersistenceProperties
.
Personal
.
Recycle
.
table
,
uniqueConstraints
=
{
...
...
@@ -33,10 +37,12 @@ public class Recycle extends SliceJpaObject {
private
static
final
String
TABLE
=
PersistenceProperties
.
Personal
.
Recycle
.
table
;
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
...
...
@@ -48,6 +54,7 @@ public class Recycle extends SliceJpaObject {
/* 以上为 JpaObject 默认字段 */
@Override
public
void
onPersist
()
throws
Exception
{
/* 如果扩展名为空去掉null */
this
.
extension
=
StringUtils
.
trimToEmpty
(
extension
);
...
...
@@ -87,7 +94,6 @@ public class Recycle extends SliceJpaObject {
@Column
(
length
=
length_255B
,
name
=
ColumnNamePrefix
+
name_FIELDNAME
)
@Index
(
name
=
TABLE
+
IndexNameMiddle
+
name_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
,
fileNameString
=
true
,
citationNotExists
=
/* 同一个用户同一个名称文件不能多次分享 */
@CitationNotExist
(
fields
=
{
"name"
,
"id"
},
type
=
Recycle
.
class
,
equals
=
{
@Equal
(
property
=
"person"
,
field
=
"person"
)
}))
private
String
name
;
...
...
@@ -96,7 +102,6 @@ public class Recycle extends SliceJpaObject {
@FieldDescribe
(
"文件或目录id."
)
@Column
(
length
=
JpaObject
.
length_64B
,
name
=
ColumnNamePrefix
+
fileId_FIELDNAME
)
@CheckPersist
(
allowEmpty
=
false
,
fileNameString
=
true
,
citationNotExists
=
/* 同一个用户同一个文件或目录不能多次分享 */
@CitationNotExist
(
fields
=
{
"fileId"
,
"id"
},
type
=
Recycle
.
class
,
equals
=
{
@Equal
(
property
=
"person"
,
field
=
"person"
)
}))
private
String
fileId
;
...
...
@@ -182,4 +187,4 @@ public class Recycle extends SliceJpaObject {
public
void
setFileType
(
String
fileType
)
{
this
.
fileType
=
fileType
;
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录