diff --git a/dbptk-bindings/dbptk-bindings-siarddk-1007/src/main/resources/config/jaxb/types.xjb b/dbptk-bindings/dbptk-bindings-siarddk-1007/src/main/resources/config/jaxb/types.xjb deleted file mode 100644 index 8f893f35..00000000 --- a/dbptk-bindings/dbptk-bindings-siarddk-1007/src/main/resources/config/jaxb/types.xjb +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dbptk-bindings/dbptk-bindings-siarddk-128/src/main/resources/config/jaxb/types.xjb b/dbptk-bindings/dbptk-bindings-siarddk-128/src/main/resources/config/jaxb/types.xjb deleted file mode 100644 index 515d3a1c..00000000 --- a/dbptk-bindings/dbptk-bindings-siarddk-128/src/main/resources/config/jaxb/types.xjb +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dbptk-bindings/pom.xml b/dbptk-bindings/pom.xml index 8d93c962..22f2fb56 100644 --- a/dbptk-bindings/pom.xml +++ b/dbptk-bindings/pom.xml @@ -60,6 +60,30 @@ com.databasepreservation.modules.siard.bindings.${packagename} + + generate-siard-1007-contextDocumentationIndex + + generate + + + false + + + ${basedir}/src/main/resources/schema/1007 + + contextDocumentationIndex.xsd + + + + ${project.build.directory}/generated-sources/xjc-a + + + + + com.databasepreservation.modules.siard.bindings.${packagename}.context + + + generate-siard-1007 @@ -73,24 +97,43 @@ archiveIndex.xsd docIndex.xsd - contextDocumentationIndex.xsd fileIndex.xsd XMLSchema.xsd tableIndex.xsd + true - - ${basedir}/src/main/resources/config/jaxb - - *.xjb - - - ${project.build.directory}/generated-sources/xjc + ${project.build.directory}/generated-sources/xjc-b + com.databasepreservation.modules.siard.bindings.${packagename} + + generate-siard-128-contextDocumentationIndex + + generate + + + false + + + ${basedir}/src/main/resources/schema/128 + + contextDocumentationIndex.xsd + + + + ${project.build.directory}/generated-sources/xjc-a + + + + + com.databasepreservation.modules.siard.bindings.${packagename}.context + + + generate-siardk-128 @@ -104,20 +147,16 @@ archiveIndex.xsd docIndex.xsd - contextDocumentationIndex.xsd fileIndex.xsd researchIndex.xsd XMLSchema.xsd tableIndex.xsd + true - - ${basedir}/src/main/resources/config/jaxb - - *.xjb - - ${project.build.directory}/generated-sources/xjc + ${project.build.directory}/generated-sources/xjc-b + com.databasepreservation.modules.siard.bindings.${packagename} diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK1007ContentImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK1007ContentImportStrategy.java index c4d26e37..f8eaa3dc 100644 --- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK1007ContentImportStrategy.java +++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK1007ContentImportStrategy.java @@ -24,7 +24,7 @@ import org.xml.sax.SAXException; import com.databasepreservation.model.exception.ModuleException; -import com.databasepreservation.modules.siard.bindings.siard_dk_1007.ContextDocumentationIndex; +import com.databasepreservation.modules.siard.bindings.siard_dk_1007.context.ContextDocumentationIndex; import com.databasepreservation.modules.siard.constants.SIARDDKConstants; import com.databasepreservation.modules.siard.in.path.SIARDDKPathImportStrategy; import com.databasepreservation.modules.siard.in.read.FolderReadStrategyMD5Sum; diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK128ContentImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK128ContentImportStrategy.java index a4672e49..1cc6884b 100644 --- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK128ContentImportStrategy.java +++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDK128ContentImportStrategy.java @@ -24,7 +24,7 @@ import org.xml.sax.SAXException; import com.databasepreservation.model.exception.ModuleException; -import com.databasepreservation.modules.siard.bindings.siard_dk_128.ContextDocumentationIndex; +import com.databasepreservation.modules.siard.bindings.siard_dk_128.context.ContextDocumentationIndex; import com.databasepreservation.modules.siard.bindings.siard_dk_128.DocIndexType; import com.databasepreservation.modules.siard.bindings.siard_dk_128.DocumentType; import com.databasepreservation.modules.siard.constants.SIARDDKConstants; diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java index 7f0f19fe..de527c2e 100644 --- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java +++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/content/SIARDDKContentImportStrategy.java @@ -31,6 +31,7 @@ import javax.xml.validation.TypeInfoProvider; import javax.xml.validation.ValidatorHandler; +import com.databasepreservation.modules.siard.validate.common.ZipFileManager; import org.apache.commons.codec.Charsets; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.FileUtils; @@ -221,7 +222,7 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont } } else if (table.getId().contains(SIARDDKConstants.CONTEXT_DOCUMENTATION_VIRTUAL_TABLE_NAME)) { try { - populateContextDocumentationTable(table); + populateContextDocumentationTable(table, databaseStructure.getName().replace(" ", "")); } catch (FileNotFoundException e) { throw new ModuleException() .withMessage( @@ -236,7 +237,7 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont } - void populateContextDocumentationTable(TableStructure table) throws ModuleException, FileNotFoundException { + void populateContextDocumentationTable(TableStructure table, String dbName) throws ModuleException, FileNotFoundException { F contextDoc = loadContextDocTableContent(); currentTable = table; this.dbExportHandler.handleDataOpenTable(table.getId()); @@ -260,20 +261,19 @@ void populateContextDocumentationTable(TableStructure table) throws ModuleExcept getDocumentDate(doc)); cells[cellCounter] = documentDateCell; cellCounter++; - //String binPath; - String binPath = pathStrategy.getMainFolder().getPath().toString() + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + String binPath = ""; + String docPath = pathStrategy.getMainFolder().getPath().toString() + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + SIARDDKConstants.CONTEXT_DOCUMENTATION_FOLDER_NAME + SIARDDKConstants.RESOURCE_FILE_SEPARATOR - + SIARDDKConstants.DOC_COLLECTION_FOLDER_NAME + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + getDocumentID(doc) - + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + "1.tif"; -// File docFolder = new File(docPath); -// if (docFolder.exists() && docFolder.isDirectory()) { -// File[] fileList = docFolder.listFiles(); -// if (fileList != null && fileList.length == 1) { -// binPath = docPath + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + fileList[0].getName(); -// } else { -// -// } -// } + + SIARDDKConstants.DOC_COLLECTION_FOLDER_NAME + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + getDocumentID(doc); + File docFolder = new File(docPath); + if (docFolder.exists() && docFolder.isDirectory()) { + File[] fileList = docFolder.listFiles(); + if (fileList != null && fileList.length == 1) { + binPath = docPath + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + fileList[0].getName(); + } else if (fileList != null && fileList.length > 1){ + binPath = docPath; + } + } try { Cell blobCell = new BinaryCell( SIARDDKConstants.BLOB_EXTENSION + SIARDDKConstants.FILE_EXTENSION_SEPARATOR + rowCounter, diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK1007MetadataImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK1007MetadataImportStrategy.java index 230a5683..1b1e991b 100644 --- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK1007MetadataImportStrategy.java +++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK1007MetadataImportStrategy.java @@ -50,7 +50,7 @@ import com.databasepreservation.model.structure.virtual.VirtualPrimaryKey; import com.databasepreservation.model.structure.virtual.VirtualTableStructure; import com.databasepreservation.modules.siard.bindings.siard_dk_1007.ArchiveIndex; -import com.databasepreservation.modules.siard.bindings.siard_dk_1007.ContextDocumentationIndex; +import com.databasepreservation.modules.siard.bindings.siard_dk_1007.context.ContextDocumentationIndex; import com.databasepreservation.modules.siard.common.SIARDArchiveContainer; import com.databasepreservation.modules.siard.constants.SIARDDKConstants; import com.databasepreservation.modules.siard.in.metadata.typeConverter.SQL99StandardDatatypeImporter; diff --git a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK128MetadataImportStrategy.java b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK128MetadataImportStrategy.java index 9f267f6e..1bdbe23c 100644 --- a/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK128MetadataImportStrategy.java +++ b/dbptk-modules/dbptk-module-siard/src/main/java/com/databasepreservation/modules/siard/in/metadata/SIARDDK128MetadataImportStrategy.java @@ -27,7 +27,7 @@ import com.databasepreservation.modules.siard.bindings.siard_dk_128.ArchiveIndex; import com.databasepreservation.modules.siard.bindings.siard_dk_128.ColumnType; import com.databasepreservation.modules.siard.bindings.siard_dk_128.ColumnsType; -import com.databasepreservation.modules.siard.bindings.siard_dk_128.ContextDocumentationIndex; +import com.databasepreservation.modules.siard.bindings.siard_dk_128.context.ContextDocumentationIndex; import com.databasepreservation.modules.siard.bindings.siard_dk_128.DocIndexType; import com.databasepreservation.modules.siard.bindings.siard_dk_128.ForeignKeyType; import com.databasepreservation.modules.siard.bindings.siard_dk_128.ForeignKeysType;