1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package cz.zcu.mre.anonmed;
23
24 import cz.zcu.mre.anonmed.rule.ProfileBuilder;
25 import cz.zcu.mre.mrelib.cipher.CipherService;
26 import java.io.File;
27 import java.util.ArrayList;
28 import java.util.List;
29
30
31
32
33
34
35
36 public final class AnonMedConfiguration {
37
38
39
40
41 public static final String ANONMED_X500_PRINCIPAL
42 = "CN=AnonMed, OU=medical.zcu.cz, O=ZCU, C=CS";
43
44
45
46
47 private static final String DEFAULT_PASSWORD = "AnonMed";
48
49
50
51 private Boolean changeFilename = false;
52
53
54
55 private Boolean deleteOriginal = false;
56
57
58
59 private Boolean overwriteFile = false;
60
61
62
63 private Boolean strictMode = false;
64
65
66
67 private List<File> inputFiles = new ArrayList<>();
68
69
70
71 private File outputDirectory = null;
72
73
74
75 private ProfileBuilder profileBuilder = null;
76
77
78
79 private File uncertainDirectory = null;
80
81
82
83
84 private File keystoresDirectory = null;
85
86 private String password = DEFAULT_PASSWORD;
87
88
89
90 private CipherService cipherService = null;
91
92 private String context = null;
93
94
95
96
97
98
99 public Boolean isChangeFilename() {
100 return changeFilename;
101 }
102
103
104
105
106
107
108 public void setChangeFilename(final Boolean value) {
109 this.changeFilename = value;
110 }
111
112
113
114
115
116
117 public Boolean isDeleteOriginal() {
118 return deleteOriginal;
119 }
120
121
122
123
124
125
126 public void setDeleteOriginal(final Boolean delete) {
127 this.deleteOriginal = delete;
128 }
129
130
131
132
133
134
135 public Boolean isOverwriteFile() {
136 return overwriteFile;
137 }
138
139
140
141
142
143
144 public void setOverwriteFile(final Boolean overwrite) {
145 this.overwriteFile = overwrite;
146 }
147
148
149
150
151
152
153 public Boolean isStrictMode() {
154 return strictMode;
155 }
156
157
158
159
160
161
162 public void setStrictMode(final Boolean strict) {
163 this.strictMode = strict;
164 }
165
166
167
168
169
170
171 public List<File> getInputFiles() {
172 return inputFiles;
173 }
174
175
176
177
178
179
180 public void setInputFiles(final List<File> files) {
181 this.inputFiles = files;
182 }
183
184
185
186
187
188
189 public File getOutputDirectory() {
190 return outputDirectory;
191 }
192
193
194
195
196
197
198 public void setOutputDirectory(final File output) {
199
200 if (!output.exists()
201 || !output.isDirectory()
202 || !output.canWrite()) {
203 throw new AnonMedException("Output directory "
204 + output.getAbsolutePath()
205 + " does not exist, it is not a directory "
206 + "or permission to write is missing.", -1);
207 }
208 this.outputDirectory = output;
209 }
210
211
212
213
214
215
216 public ProfileBuilder getProfileBuilder() {
217 return profileBuilder;
218 }
219
220
221
222
223
224
225 public void setProfileBuilder(final ProfileBuilder builder) {
226 this.profileBuilder = builder;
227 }
228
229
230
231
232
233
234 public File getUncertainDirectory() {
235 return uncertainDirectory;
236 }
237
238
239
240
241
242
243 public void setUncertainDirectory(final File dir) {
244
245 if (!dir.exists() || !dir.isDirectory() || !dir.canWrite()) {
246 throw new AnonMedException("Uncertain output directory "
247 + dir.getAbsolutePath()
248 + " does not exist, it is not a directory "
249 + "or permission to write is missing.", -1);
250 }
251
252 this.uncertainDirectory = dir;
253 }
254
255
256
257
258
259
260 public void setKeystoresDirectory(final File directory) {
261
262 if (!directory.exists()
263 || !directory.isDirectory()
264 || !directory.canWrite()) {
265 throw new AnonMedException("KeyStore directory "
266 + directory.getAbsolutePath()
267 + " does not exist, it is not a directory "
268 + "or permission to write is missing.", -1);
269 }
270 this.keystoresDirectory = directory;
271 }
272
273 public File getKeystoresDirectory() {
274 return keystoresDirectory;
275 }
276
277 public CipherService getCipherService() {
278 return cipherService;
279 }
280
281 public void setCipherService(CipherService cipherService) {
282 this.cipherService = cipherService;
283 }
284
285 public String getPassword() {
286 return password;
287 }
288
289 public void setPassword(String password) {
290 this.password = password;
291 }
292
293 public void setContext(String context) {
294 this.context = context;
295 }
296
297 public String getContext() {
298 return context;
299 }
300
301 }