use of com.b2international.snowowl.core.request.io.ImportDefectAcceptor.ImportDefectBuilder in project snow-owl by b2ihealthcare.
the class SnomedRf2ImportRequest method readFile.
private void readFile(ZipEntry entry, final InputStream in, final ObjectReader oReader, Rf2EffectiveTimeSlices effectiveTimeSlices, Rf2ValidationIssueReporter reporter) throws IOException, JsonProcessingException {
final String entryName = entry.getName();
final ImportDefectAcceptor defectAcceptor = reporter.getDefectAcceptor(entryName);
boolean header = true;
Rf2ContentType<?> resolver = null;
int lineNumber = 1;
MappingIterator<String[]> mi = oReader.readValues(in);
while (mi.hasNext()) {
String[] line = mi.next();
if (header) {
for (Rf2ContentType<?> contentType : Rf2Format.getContentTypes()) {
if (contentType.canResolve(line)) {
resolver = contentType;
break;
}
}
if (resolver == null) {
log.warn("Unrecognized RF2 file: {}", entryName);
break;
}
header = false;
} else {
final String effectiveTimeKey = getEffectiveTimeKey(line[1]);
final ImportDefectBuilder defectBuilder = defectAcceptor.on(Integer.toString(lineNumber));
resolver.register(line, effectiveTimeSlices.getOrCreate(effectiveTimeKey), defectBuilder);
}
lineNumber++;
}
}
Aggregations