DumpRestoreData.java 3.7 KB
Newer Older
R
test  
roo00 已提交
1 2 3 4 5 6
package com.x.base.core.project.config;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.BooleanUtils;
Z
Zhou Rui 已提交
7
import org.apache.commons.lang3.StringUtils;
R
test  
roo00 已提交
8 9 10 11 12 13

import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.ListTools;

public class DumpRestoreData extends ConfigObject {

Z
zhourui 已提交
14
	private static final long serialVersionUID = 8910820385137391619L;
Z
Zhou Rui 已提交
15

R
test  
roo00 已提交
16 17 18 19
	public static DumpRestoreData defaultInstance() {
		return new DumpRestoreData();
	}

20 21
	public static final String MODE_FULL = "full";
	public static final String MODE_LITE = "lite";
22 23 24
	public static final String RESTOREOVERRIDE_CLEAN = "clean";
	public static final String RESTOREOVERRIDE_SKIPEXISTED = "skipExisted";

Z
zhourui 已提交
25 26
	public static final Boolean DEFAULT_REDISTRIBUTE = true;
	public static final Boolean DEFAULT_EXCEPTIONINVALIDSTORAGE = true;
27
	public static final Boolean DEFAULT_ATTACHSTORAGE = true;
Z
zhourui 已提交
28
	public static final String DEFAULT_ITEMCATEGORY = "";
R
update  
roo00 已提交
29

R
test  
roo00 已提交
30
	public DumpRestoreData() {
Z
zhourui 已提交
31 32
		this.includes = new ArrayList<>();
		this.excludes = new ArrayList<>();
33 34
		this.mode = MODE_LITE;
		this.attachStorage = DEFAULT_ATTACHSTORAGE;
Z
zhourui 已提交
35
		this.exceptionInvalidStorage = DEFAULT_EXCEPTIONINVALIDSTORAGE;
Z
zhourui 已提交
36
		this.itemCategory = DEFAULT_ITEMCATEGORY;
R
test  
roo00 已提交
37 38
	}

39
	@FieldDescribe("导出导入包含对象,可以使用通配符*,如仅导出待办数据:com.x.processplatform.core.entity.content.Task.")
R
test  
roo00 已提交
40 41
	private List<String> includes;

42
	@FieldDescribe("导出导入排除对象,可以使用通配符*,如不导出流程实例数据com.x.processplatform.core.entity.content.*")
R
test  
roo00 已提交
43 44
	private List<String> excludes;

Z
Zhou Rui 已提交
45 46 47
	@FieldDescribe("导出数据模式,lite|full,默认使用lite")
	private String mode;

Z
zhourui 已提交
48 49 50
	@FieldDescribe("无法获取storage是否升起错误.")
	private Boolean exceptionInvalidStorage;

51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
	@FieldDescribe("是否同时导入导出storage中存储的文件.")
	private Boolean attachStorage;

	@FieldDescribe("是否进行重新分布.")
	private Boolean redistributeStorage;

	public Boolean getRedistributeStorage() {
		return redistributeStorage;
	}

	public void setRedistributeStorage(Boolean redistributeStorage) {
		this.redistributeStorage = redistributeStorage;
	}

	public Boolean getAttachStorage() {
		return attachStorage;
	}

	public void setAttachStorage(Boolean attachStorage) {
		this.attachStorage = attachStorage;
	}

73 74 75
	@FieldDescribe("数据导入方式,clean:清空重新导入,skipExisted:如果有相同id的数据跳过.默认方式为clean.")
	private String restoreOverride;

Z
zhourui 已提交
76 77 78 79 80 81 82
	@FieldDescribe("对于com.x.query.core.entity.Item的itemCategory进行单独过滤,可选值pp, cms, bbs, pp_dict.")
	private String itemCategory;

	public String getItemCategory() {
		return this.itemCategory;
	}

Z
zhourui 已提交
83 84 85 86
	public Boolean getExceptionInvalidStorage() {
		return BooleanUtils.isNotFalse(exceptionInvalidStorage);
	}

Z
Zhou Rui 已提交
87
	public String getMode() {
88
		return StringUtils.equals(MODE_FULL, mode) ? MODE_FULL : MODE_LITE;
R
test  
roo00 已提交
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
	}

	public List<String> getIncludes() {
		List<String> list = new ArrayList<>();
		for (String str : ListTools.trim(includes, true, true)) {
			list.add(str);
		}
		return list;
	}

	public List<String> getExcludes() {
		List<String> list = new ArrayList<>();
		for (String str : ListTools.trim(excludes, true, true)) {
			list.add(str);
		}
		return list;
	}

	public void setIncludes(List<String> includes) {
		this.includes = includes;
	}

	public void setExcludes(List<String> excludes) {
		this.excludes = excludes;
	}

Z
zhourui 已提交
115 116
	public void setExceptionInvalidStorage(Boolean exceptionInvalidStorage) {
		this.exceptionInvalidStorage = exceptionInvalidStorage;
R
test  
roo00 已提交
117 118
	}

Z
Zhou Rui 已提交
119 120 121 122
	public void setMode(String mode) {
		this.mode = mode;
	}

123 124 125 126 127 128 129 130
	public String getRestoreOverride() {
		return restoreOverride;
	}

	public void setRestoreOverride(String restoreOverride) {
		this.restoreOverride = restoreOverride;
	}

R
test  
roo00 已提交
131
}