forked from rspace-os/rspace-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExportToFileConfig.java
135 lines (111 loc) · 3.52 KB
/
ExportToFileConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package com.researchspace.export.pdf;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.researchspace.archive.ExportScope;
import com.researchspace.archive.model.IExportConfig;
import com.researchspace.model.User;
import com.researchspace.model.audittrail.AuditDomain;
import com.researchspace.model.audittrail.AuditTrailData;
import com.researchspace.model.audittrail.AuditTrailProperty;
import com.researchspace.model.preference.ExportPageSize;
import java.util.Date;
import javax.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;
/** user defined configuration details for export to external format */
@Data
@AuditTrailData(auditDomain = AuditDomain.RECORD)
public class ExportToFileConfig implements StructuredDocumentHTMLViewConfig, IExportConfig {
/** Various dates that could be put into exported file footer. */
public enum DATE_FOOTER_PREF {
/** Date of export */
EXP,
/** Date document was created */
NEW,
/** Last modified date */
UPD
}
private Date createDt;
@JsonIgnore private User exporter;
private int startPage;
/**
* Gets export scope - default is ExportScope.SELECTION
*
* @return
*/
private ExportScope exportScope = ExportScope.SELECTION;
private ExportFormat exportFormat = ExportFormat.PDF;
@NotEmpty(message = "PDF name {errors.required.field}")
private String exportName = "PDF export";
private boolean provenance = true;
private boolean comments = true;
private boolean annotations = true;
private boolean restartPageNumberPerDoc = true;
private boolean includeFieldLastModifiedDate = true;
@NotNull private ExportPageSize pageSize = ExportPageSize.A4;
@NotNull private DATE_FOOTER_PREF dateType = DATE_FOOTER_PREF.EXP;
private boolean includeFooterAtEndOnly = true;
@NotNull private Boolean setPageSizeAsDefault = false;
@AuditTrailProperty(name = "format")
public ExportFormat getExportFormat() {
return exportFormat;
}
@AuditTrailProperty(name = "scope")
public ExportScope getExportScope() {
return exportScope;
}
/** A name() String of an {@link ExportFormat} enum */
public void setExportFormat(String exportFormat) {
this.exportFormat = ExportFormat.valueOf(exportFormat);
}
public String getPageSize() {
return pageSize.name();
}
public ExportPageSize getPageSizeEnum() {
return pageSize;
}
public void setPageSize(String pageSize) {
this.pageSize = ExportPageSize.valueOf(pageSize);
}
public String getDateType() {
return dateType.name();
}
public DATE_FOOTER_PREF getDateTypeEnum() {
return dateType;
}
public void setDateType(String dateType) {
this.dateType = DATE_FOOTER_PREF.valueOf(dateType);
}
@Override
public String toString() {
return "PdfConfigInfo [startPage="
+ startPage
+ ", provenance="
+ provenance
+ ", comments="
+ comments
+ ", annotations="
+ annotations
+ ", restartPageNumberPerDoc="
+ restartPageNumberPerDoc
+ ", pageSize="
+ pageSize
+ ", dateType="
+ dateType
+ ", includeFooter="
+ includeFooterAtEndOnly
+ ", exportName="
+ exportName
+ "]";
}
public boolean isSelectionScope() {
return ExportScope.SELECTION.equals(exportScope);
}
@Override
public boolean isUserScope() {
return ExportScope.USER.equals(exportScope);
}
@Override
public boolean isGroupScope() {
return ExportScope.GROUP.equals(exportScope);
}
}