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 b025c56f..683bb2ff 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 @@ -219,17 +219,17 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont .withMessage( "Error reading metadata XSD file: " + pathStrategy.getXsdFilePath(SIARDDKConstants.DOC_INDEX)) .withCause(e); - }} -// } else if (table.getId().contains(SIARDDKConstants.CONTEXT_DOCUMENTATION_VIRTUAL_TABLE_NAME)) { -// try { -// populateContextDocumentationTable(table, databaseStructure.getName().replace(" ", "")); -// } catch (FileNotFoundException e) { -// throw new ModuleException() -// .withMessage( -// "Error reading metadata XSD file: " + pathStrategy.getXsdFilePath(SIARDDKConstants.DOC_INDEX)) -// .withCause(e); -// } -// } + } + } else if (table.getId().contains(SIARDDKConstants.CONTEXT_DOCUMENTATION_VIRTUAL_TABLE_NAME)) { + try { + populateContextDocumentationTable(table); + } catch (FileNotFoundException e) { + throw new ModuleException() + .withMessage( + "Error reading metadata XSD file: " + pathStrategy.getXsdFilePath(SIARDDKConstants.DOC_INDEX)) + .withCause(e); + } + } } completedSchemas++; this.dbExportHandler.handleDataCloseSchema(importAsSchema); @@ -237,7 +237,7 @@ public void importContent(DatabaseExportModule dbExportHandler, SIARDArchiveCont } - void populateContextDocumentationTable(TableStructure table, String dbName) + void populateContextDocumentationTable(TableStructure table) throws ModuleException, FileNotFoundException { F contextDoc = loadContextDocTableContent(); currentTable = table; 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 1ce98ba1..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 @@ -299,7 +299,7 @@ protected List getTables(SiardDiark siardArchive) throws ModuleE if (needsVirtualTable) { lstTblsDptkl.add(createVirtualTable()); } - //lstTblsDptkl.add(createContextDocumentationTable()); + lstTblsDptkl.add(createContextDocumentationTable()); } return lstTblsDptkl; } 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 1bdbe23c..76232a73 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 @@ -95,7 +95,7 @@ public SIARDDK128MetadataImportStrategy(SIARDDK128PathImportStrategy pathStrateg @Override public void loadMetadata(ReadStrategy readStrategy, SIARDArchiveContainer container, - ModuleConfiguration moduleConfiguration) throws ModuleException { + ModuleConfiguration moduleConfiguration) throws ModuleException { FolderReadStrategyMD5Sum readStrategyMD5Sum = null; if (!(readStrategy instanceof FolderReadStrategyMD5Sum)) { throw new IllegalArgumentException( @@ -201,7 +201,7 @@ protected DatabaseStructure getDatabaseStructure(SiardDiark siardArchive, Archiv } protected void setDatabaseMetadata(SiardDiark siardArchive, DatabaseStructure databaseStructure, - ArchiveIndex archiveIndex) { + ArchiveIndex archiveIndex) { databaseStructure.setDbOriginalName(siardArchive.getDbName()); String[] informationPackageIdSPlit = archiveIndex.getArchiveInformationPackageID().split("\\."); String id = informationPackageIdSPlit[informationPackageIdSPlit.length - 1]; @@ -318,7 +318,7 @@ private TableStructure createContextDocumentationTable() throws ModuleException return virtualTable; } catch (FileNotFoundException e) { throw new ModuleException().withMessage( - "Error reading metadata XSD file: " + pathStrategy.getXsdFilePath(SIARDDKConstants.CONTEXT_DOCUMENTATION_INDEX)) + "Error reading metadata XSD file: " + pathStrategy.getXsdFilePath(SIARDDKConstants.CONTEXT_DOCUMENTATION_INDEX)) .withCause(e); } } @@ -340,7 +340,7 @@ private ContextDocumentationIndex loadContextDocumentationTableMetadata() xsdSchema = schemaFactory.newSchema(new StreamSource(xsdInputStream)); } catch (SAXException e) { throw new ModuleException().withMessage( - "Error reading metadata XSD file: " + pathStrategy.getXsdFilePath(SIARDDKConstants.CONTEXT_DOCUMENTATION_INDEX)) + "Error reading metadata XSD file: " + pathStrategy.getXsdFilePath(SIARDDKConstants.CONTEXT_DOCUMENTATION_INDEX)) .withCause(e); } InputStream inputStreamXml = null; @@ -351,8 +351,7 @@ private ContextDocumentationIndex loadContextDocumentationTableMetadata() inputStreamXml = new FileInputStream( pathStrategy.getMainFolder().getPath().toString() + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + pathStrategy.getXmlFilePath(SIARDDKConstants.CONTEXT_DOCUMENTATION_INDEX)); - ContextDocumentationIndex jaxbElement = (ContextDocumentationIndex) unmarshaller - .unmarshal(inputStreamXml); + ContextDocumentationIndex jaxbElement = (ContextDocumentationIndex) unmarshaller.unmarshal(inputStreamXml); return jaxbElement; } catch (JAXBException e) { throw new ModuleException().withMessage("Error while Unmarshalling JAXB").withCause(e); @@ -380,8 +379,7 @@ private DocIndexType loadVirtualTableMetadata() throws ModuleException, FileNotF SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema xsdSchema = null; InputStream xsdInputStream = new FileInputStream(pathStrategy.getMainFolder().getPath().toString() - + SIARDDKConstants.RESOURCE_FILE_SEPARATOR - + pathStrategy.getXsdFilePath(SIARDDKConstants.DOC_INDEX)); + + SIARDDKConstants.RESOURCE_FILE_SEPARATOR + pathStrategy.getXsdFilePath(SIARDDKConstants.DOC_INDEX)); try { xsdSchema = schemaFactory.newSchema(new StreamSource(xsdInputStream)); @@ -533,8 +531,8 @@ protected long getNumberOfTblRows(BigInteger numRows, String tableName) throws M return numRows.longValue(); } catch (ArithmeticException e) { throw new ModuleException().withMessage("Unable to import table [" + tableName + "], as the number of rows [" - + numRows - + "] exceeds the max value of the long datatype used to store the number.(Consult the vendor/a programmer for a fix of this problem, if needed)") + + numRows + + "] exceeds the max value of the long datatype used to store the number.(Consult the vendor/a programmer for a fix of this problem, if needed)") .withCause(e); } }