use of name.abuchen.portfolio.datatransfer.SecurityCache in project portfolio by buchen.
the class AbstractPDFExtractor method extract.
@Override
public List<Item> extract(List<Extractor.InputFile> files, List<Exception> errors) {
// careful: security cache makes extractor stateful
securityCache = new SecurityCache(client);
List<Item> results = new ArrayList<>();
for (Extractor.InputFile f : files) {
if (!(f instanceof PDFInputFile))
throw new IllegalArgumentException();
PDFInputFile inputFile = (PDFInputFile) f;
String text = inputFile.getText();
results.addAll(extract(inputFile.getFile().getName(), text, errors));
}
results.addAll(securityCache.createMissingSecurityItems(results));
securityCache = null;
return results;
}
use of name.abuchen.portfolio.datatransfer.SecurityCache in project portfolio by buchen.
the class BaseCSVExtractor method extract.
@Override
public List<Item> extract(int skipLines, List<String[]> rawValues, Map<String, Column> field2column, List<Exception> errors) {
// careful: the security cache makes the extractor stateful because
// securities extracted during a previous run will not be created again
securityCache = new SecurityCache(client);
List<Item> results = new ArrayList<>();
// +1 because of end user
int lineNo = 1 + skipLines;
for (String[] strings : rawValues) {
try {
extract(results, strings, field2column);
} catch (ParseException | UnsupportedOperationException | IllegalArgumentException e) {
errors.add(new IOException(MessageFormat.format(Messages.CSVLineXwithMsgY, lineNo, e.getMessage()), e));
}
lineNo++;
}
results.addAll(securityCache.createMissingSecurityItems(results));
securityCache = null;
return results;
}
Aggregations