|
3 | 3 | /**
|
4 | 4 | * This file is part of the Goobi Application - a Workflow tool for the support of mass digitization.
|
5 | 5 | *
|
6 |
| - * Visit the websites for more information. |
| 6 | + * Visit the websites for more information. |
7 | 7 | * - https://goobi.io
|
8 | 8 | * - https://www.intranda.com
|
9 | 9 | * - https://github.com/intranda/goobi
|
@@ -88,8 +88,8 @@ public class ExportMets {
|
88 | 88 | * @throws TypeNotAllowedForParentException
|
89 | 89 | */
|
90 | 90 | public boolean startExport(Process myProzess) throws IOException, InterruptedException, DocStructHasNoTypeException, PreferencesException,
|
91 |
| - WriteException, MetadataTypeNotAllowedException, ExportFileException, UghHelperException, ReadException, SwapException, DAOException, |
92 |
| - TypeNotAllowedForParentException { |
| 91 | + WriteException, MetadataTypeNotAllowedException, ExportFileException, UghHelperException, ReadException, SwapException, DAOException, |
| 92 | + TypeNotAllowedForParentException { |
93 | 93 | LoginBean login = (LoginBean) Helper.getManagedBeanValue("#{LoginForm}");
|
94 | 94 | String benutzerHome = "";
|
95 | 95 | if (login != null) {
|
@@ -119,8 +119,8 @@ public boolean startExport(Process myProzess) throws IOException, InterruptedExc
|
119 | 119 | * @throws TypeNotAllowedForParentException
|
120 | 120 | */
|
121 | 121 | public boolean startExport(Process myProzess, String inZielVerzeichnis) throws IOException, InterruptedException, PreferencesException,
|
122 |
| - WriteException, DocStructHasNoTypeException, MetadataTypeNotAllowedException, ExportFileException, UghHelperException, ReadException, |
123 |
| - SwapException, DAOException, TypeNotAllowedForParentException { |
| 122 | + WriteException, DocStructHasNoTypeException, MetadataTypeNotAllowedException, ExportFileException, UghHelperException, ReadException, |
| 123 | + SwapException, DAOException, TypeNotAllowedForParentException { |
124 | 124 |
|
125 | 125 | /*
|
126 | 126 | * -------------------------------- Read Document --------------------------------
|
@@ -250,28 +250,20 @@ protected boolean writeMetsFile(Process myProzess, String targetFileName, Filefo
|
250 | 250 |
|
251 | 251 | if (myFilegroups != null && myFilegroups.size() > 0) {
|
252 | 252 | for (ProjectFileGroup pfg : myFilegroups) {
|
| 253 | + |
253 | 254 | // check if source files exists
|
254 | 255 | if (pfg.getFolder() != null && pfg.getFolder().length() > 0) {
|
255 | 256 | String foldername = myProzess.getMethodFromName(pfg.getFolder());
|
256 | 257 | if (foldername != null) {
|
257 | 258 | Path folder = Paths.get(myProzess.getMethodFromName(pfg.getFolder()));
|
258 | 259 | if (folder != null && StorageProvider.getInstance().isFileExists(folder)
|
259 | 260 | && !StorageProvider.getInstance().list(folder.toString()).isEmpty()) {
|
260 |
| - VirtualFileGroup v = new VirtualFileGroup(); |
261 |
| - v.setName(pfg.getName()); |
262 |
| - v.setPathToFiles(vp.replace(pfg.getPath())); |
263 |
| - v.setMimetype(pfg.getMimetype()); |
264 |
| - v.setFileSuffix(pfg.getSuffix()); |
| 261 | + VirtualFileGroup v = createFilegroup(vp, pfg); |
265 | 262 | mm.getDigitalDocument().getFileSet().addVirtualFileGroup(v);
|
266 | 263 | }
|
267 | 264 | }
|
268 | 265 | } else {
|
269 |
| - |
270 |
| - VirtualFileGroup v = new VirtualFileGroup(); |
271 |
| - v.setName(pfg.getName()); |
272 |
| - v.setPathToFiles(vp.replace(pfg.getPath())); |
273 |
| - v.setMimetype(pfg.getMimetype()); |
274 |
| - v.setFileSuffix(pfg.getSuffix()); |
| 266 | + VirtualFileGroup v = createFilegroup(vp, pfg); |
275 | 267 | mm.getDigitalDocument().getFileSet().addVirtualFileGroup(v);
|
276 | 268 | }
|
277 | 269 | }
|
@@ -306,10 +298,9 @@ protected boolean writeMetsFile(Process myProzess, String targetFileName, Filefo
|
306 | 298 | mm.setGoobiID(String.valueOf(myProzess.getId()));
|
307 | 299 |
|
308 | 300 | // if (!ConfigMain.getParameter("ImagePrefix", "\\d{8}").equals("\\d{8}")) {
|
309 |
| - List<String> images = new ArrayList<String>(); |
| 301 | + List<String> images = new ArrayList<>(); |
310 | 302 | if (ConfigurationHelper.getInstance().isExportValidateImages()) {
|
311 | 303 | try {
|
312 |
| - // TODO andere Dateigruppen nicht mit image Namen ersetzen |
313 | 304 | images = new MetadatenImagesHelper(this.myPrefs, dd).getDataFiles(myProzess, imageFolderPath);
|
314 | 305 |
|
315 | 306 | int sizeOfPagination = dd.getPhysicalDocStruct().getAllChildren().size();
|
@@ -354,6 +345,17 @@ protected boolean writeMetsFile(Process myProzess, String targetFileName, Filefo
|
354 | 345 | return true;
|
355 | 346 | }
|
356 | 347 |
|
| 348 | + private VirtualFileGroup createFilegroup(VariableReplacer variableRplacer, ProjectFileGroup projectFileGroup) { |
| 349 | + VirtualFileGroup v = new VirtualFileGroup(); |
| 350 | + v.setName(projectFileGroup.getName()); |
| 351 | + v.setPathToFiles(variableRplacer.replace(projectFileGroup.getPath())); |
| 352 | + v.setMimetype(projectFileGroup.getMimetype()); |
| 353 | + v.setFileSuffix(projectFileGroup.getSuffix()); |
| 354 | + v.setFileExtensionsToIgnore( projectFileGroup.getIgnoreMimetypes()); |
| 355 | + v.setIgnoreConfiguredMimetypeAndSuffix(projectFileGroup.isUseOriginalFiles()); |
| 356 | + return v; |
| 357 | + } |
| 358 | + |
357 | 359 | public List<String> getProblems() {
|
358 | 360 | return problems;
|
359 | 361 | }
|
|
0 commit comments