Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioG70 committed Oct 29, 2024
1 parent 6e0f8f2 commit ecd1931
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,25 @@ 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);
}

}

void populateContextDocumentationTable(TableStructure table, String dbName)
void populateContextDocumentationTable(TableStructure table)
throws ModuleException, FileNotFoundException {
F contextDoc = loadContextDocTableContent();
currentTable = table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ protected List<TableStructure> getTables(SiardDiark siardArchive) throws ModuleE
if (needsVirtualTable) {
lstTblsDptkl.add(createVirtualTable());
}
//lstTblsDptkl.add(createContextDocumentationTable());
lstTblsDptkl.add(createContextDocumentationTable());
}
return lstTblsDptkl;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit ecd1931

Please sign in to comment.