diff --git a/src/main/java/org/roda_project/commons_ip2/model/impl/eark/EARKSIP.java b/src/main/java/org/roda_project/commons_ip2/model/impl/eark/EARKSIP.java index d2f47b48..b14b5c87 100644 --- a/src/main/java/org/roda_project/commons_ip2/model/impl/eark/EARKSIP.java +++ b/src/main/java/org/roda_project/commons_ip2/model/impl/eark/EARKSIP.java @@ -191,6 +191,9 @@ public Path build(final Path destinationDirectory, final String fileNameWithoutE Path zipPath = getZipPath(destinationDirectory, fileNameWithoutExtension); try { Map zipEntries = getZipEntries(); + //default metadata need to be added before creating the mets in order to add them in the mets file + EARKUtils.addDefaultSchemas(LOGGER, getSchemas(), buildDir); + boolean isMetadataOther = (this.getOtherMetadata() != null && !this.getOtherMetadata().isEmpty()); boolean isMetadata = ((this.getDescriptiveMetadata() != null && !this.getDescriptiveMetadata().isEmpty()) || (this.getPreservationMetadata() != null && !this.getPreservationMetadata().isEmpty())); @@ -207,7 +210,6 @@ public Path build(final Path destinationDirectory, final String fileNameWithoutE EARKUtils.addOtherMetadataToZipAndMETS(zipEntries, mainMETSWrapper, getOtherMetadata(), null); EARKUtils.addRepresentationsToZipAndMETS(this, getRepresentations(), zipEntries, mainMETSWrapper, buildDir, sipType); - EARKUtils.addDefaultSchemas(LOGGER, getSchemas(), buildDir); EARKUtils.addSchemasToZipAndMETS(zipEntries, mainMETSWrapper, getSchemas(), null); EARKUtils.addDocumentationToZipAndMETS(zipEntries, mainMETSWrapper, getDocumentation(), null); METSUtils.addMainMETSToZip(zipEntries, mainMETSWrapper, buildDir);