@Override
public void loadAll(DataAccess typeTemplate, List<DataAccess> datasets, String[] fieldNames, Object[] fieldValues) throws DatabaseReadException {
File file = new File("db/" + typeTemplate.getName() + ".xml");
if (!file.exists()) {
throw new DatabaseReadException("Table " + typeTemplate.getName() + " does not exist!");
}
if (fieldNames.length != fieldValues.length) {
throw new DatabaseReadException("Field and Value field lenghts are inconsistent!");
}
try {
FileInputStream in = new FileInputStream(file);
Document table = fileBuilder.build(in);
in.close();
loadAllData(typeTemplate, datasets, table, fieldNames, fieldValues);
}
catch (JDOMException e) {
throw new DatabaseReadException(e.getMessage(), e);
}
catch (IOException e) {
throw new DatabaseReadException(e.getMessage(), e);
}
catch (DatabaseAccessException e) {
throw new DatabaseReadException(e.getMessage(), e);
}
}