提交 700e8691 编写于 作者: O o2sword

云文件增加管理配置

上级 f852c384
......@@ -40,6 +40,9 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
public static class Link {
public static final String table = "FILE_LINK";
}
public static class Config {
public static final String table = "FILE_CONFIG";
}
}
......
package com.x.file.core.entity.open;
import com.x.base.core.entity.JsonProperties;
import com.x.base.core.project.annotation.FieldDescribe;
import java.util.ArrayList;
import java.util.List;
public class FileConfigProperties extends JsonProperties {
private static final long serialVersionUID = -1259157593040432239L;
@FieldDescribe("只允许上传的文件后缀")
private List<String> fileTypeIncludes = new ArrayList<>();
@FieldDescribe("不允许上传的文件后缀")
private List<String> fileTypeExcludes = new ArrayList<>();
public List<String> getFileTypeIncludes() {
return fileTypeIncludes;
}
public void setFileTypeIncludes(List<String> fileTypeIncludes) {
this.fileTypeIncludes = fileTypeIncludes;
}
public List<String> getFileTypeExcludes() {
return fileTypeExcludes;
}
public void setFileTypeExcludes(List<String> fileTypeExcludes) {
this.fileTypeExcludes = fileTypeExcludes;
}
}
package com.x.file.core.entity.open;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.*;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.file.core.entity.PersistenceProperties;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.Persistent;
import org.apache.openjpa.persistence.jdbc.Index;
import org.apache.openjpa.persistence.jdbc.Strategy;
import javax.persistence.*;
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Entity
@Table(name = PersistenceProperties.Open.Config.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.Personal.Folder.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class FileConifg extends SliceJpaObject {
private static final long serialVersionUID = -2266232193925155825L;
private static final String TABLE = PersistenceProperties.Open.Config.table;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
}
public FileConifg() {
this.properties = new FileConfigProperties();
}
/* 更新运行方法 */
public static final String person_FIELDNAME = "person";
@FieldDescribe("所属用户.")
@Column(length = length_255B, name = ColumnNamePrefix + person_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + person_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String person;
public static final String name_FIELDNAME = "name";
@FieldDescribe("分类名称.")
@Column(length = length_255B, name = ColumnNamePrefix + name_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String name;
public static final String capacity_FIELDNAME = "capacity";
@FieldDescribe("容量(单位M).")
@Column(name = ColumnNamePrefix + capacity_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Integer capacity;
public static final String properties_FIELDNAME = "properties";
@FieldDescribe("属性对象存储字段.")
@Persistent(fetch = FetchType.EAGER)
@Strategy(JsonPropertiesValueHandler)
@Column(length = JpaObject.length_4K, name = ColumnNamePrefix + properties_FIELDNAME)
@CheckPersist(allowEmpty = true)
private FileConfigProperties properties;
public String getPerson() {
return person;
}
public void setPerson(String person) {
this.person = person;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCapacity() {
return capacity;
}
public void setCapacity(Integer capacity) {
this.capacity = capacity;
}
public FileConfigProperties getProperties() {
if (null == this.properties) {
this.properties = new FileConfigProperties();
}
return this.properties;
}
public void setProperties(FileConfigProperties properties) {
this.properties = properties;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册