Skip to content

Commit 783bb30

Browse files
committed
export: override mime type with original data, ignore types in fileGrp
1 parent dceeb6d commit 783bb30

File tree

6 files changed

+112
-77
lines changed

6 files changed

+112
-77
lines changed

Goobi/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@
12271227
<dependency>
12281228
<groupId>de.intranda.ugh</groupId>
12291229
<artifactId>ugh-core</artifactId>
1230-
<version>3.0.12-SNAPSHOT</version>
1230+
<version>3.0.12</version>
12311231
<exclusions>
12321232
<exclusion>
12331233
<groupId>poi</groupId>

Goobi/src/de/sub/goobi/export/download/ExportMets.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the Goobi Application - a Workflow tool for the support of mass digitization.
55
*
6-
* Visit the websites for more information.
6+
* Visit the websites for more information.
77
* - https://goobi.io
88
* - https://www.intranda.com
99
* - https://github.com/intranda/goobi
@@ -88,8 +88,8 @@ public class ExportMets {
8888
* @throws TypeNotAllowedForParentException
8989
*/
9090
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 {
9393
LoginBean login = (LoginBean) Helper.getManagedBeanValue("#{LoginForm}");
9494
String benutzerHome = "";
9595
if (login != null) {
@@ -119,8 +119,8 @@ public boolean startExport(Process myProzess) throws IOException, InterruptedExc
119119
* @throws TypeNotAllowedForParentException
120120
*/
121121
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 {
124124

125125
/*
126126
* -------------------------------- Read Document --------------------------------
@@ -250,28 +250,20 @@ protected boolean writeMetsFile(Process myProzess, String targetFileName, Filefo
250250

251251
if (myFilegroups != null && myFilegroups.size() > 0) {
252252
for (ProjectFileGroup pfg : myFilegroups) {
253+
253254
// check if source files exists
254255
if (pfg.getFolder() != null && pfg.getFolder().length() > 0) {
255256
String foldername = myProzess.getMethodFromName(pfg.getFolder());
256257
if (foldername != null) {
257258
Path folder = Paths.get(myProzess.getMethodFromName(pfg.getFolder()));
258259
if (folder != null && StorageProvider.getInstance().isFileExists(folder)
259260
&& !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);
265262
mm.getDigitalDocument().getFileSet().addVirtualFileGroup(v);
266263
}
267264
}
268265
} 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);
275267
mm.getDigitalDocument().getFileSet().addVirtualFileGroup(v);
276268
}
277269
}
@@ -306,10 +298,9 @@ protected boolean writeMetsFile(Process myProzess, String targetFileName, Filefo
306298
mm.setGoobiID(String.valueOf(myProzess.getId()));
307299

308300
// if (!ConfigMain.getParameter("ImagePrefix", "\\d{8}").equals("\\d{8}")) {
309-
List<String> images = new ArrayList<String>();
301+
List<String> images = new ArrayList<>();
310302
if (ConfigurationHelper.getInstance().isExportValidateImages()) {
311303
try {
312-
// TODO andere Dateigruppen nicht mit image Namen ersetzen
313304
images = new MetadatenImagesHelper(this.myPrefs, dd).getDataFiles(myProzess, imageFolderPath);
314305

315306
int sizeOfPagination = dd.getPhysicalDocStruct().getAllChildren().size();
@@ -354,6 +345,17 @@ protected boolean writeMetsFile(Process myProzess, String targetFileName, Filefo
354345
return true;
355346
}
356347

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+
357359
public List<String> getProblems() {
358360
return problems;
359361
}

0 commit comments

Comments
 (0)