use of uk.m0nom.adif3.transform.Adif3RecordTransformer in project adif-processor by urbancamo.
the class Adif3Transformer method transform.
public Qsos transform(Adif3 log, TransformControl control, TransformResults results) throws UnsupportedHeaderException {
Adif3RecordTransformer transformer;
Qsos qsos = new Qsos(log);
transformer = new CommentParsingAdifRecordTransformer(config, summits, qrzService, control, results);
int index = 1;
for (Adif3Record rec : log.getRecords()) {
if ((rec.getStationCallsign() != null || rec.getOperator() != null) && rec.getCall() != null) {
transformer.transform(qsos, rec, index++);
}
}
AdifHeader header = new AdifHeader();
header.setProgramId("M0NOM ADIF Processor");
header.setProgramVersion("1.0");
log.setHeader(header);
return qsos;
}
use of uk.m0nom.adif3.transform.Adif3RecordTransformer in project adif-processor by urbancamo.
the class AdifReaderTest method testAdifFLE.
@Test
public void testAdifFLE() throws Exception {
AdiReader reader = new AdiReader();
BufferedReader inputReader = resourceInput("adif/2021-01-09-Queen-Adelaides-Hill.adi");
Optional<Adif3> result = reader.read(inputReader);
// System.out.println(new File("tmp.txt").getAbsolutePath());
YamlMapping config = Yaml.createYamlInput(new File("adif-processor.yaml")).readYamlMapping();
if (result.isPresent()) {
Adif3 log = result.get();
Qsos qsos = new Qsos(log);
assertThat(log.getHeader().getProgramId()).isEqualTo("FLE");
ActivityDatabases summits = new ActivityDatabases();
summits.loadData();
QrzXmlService qrzXmlService = new QrzXmlService(null, null);
if (!qrzXmlService.getSessionKey()) {
System.err.println("Could not connect to QRZ.COM, continuing...");
}
TransformResults results = new TransformResults();
Adif3RecordTransformer transformer = new CommentParsingAdifRecordTransformer(config, summits, qrzXmlService, control, results);
int index = 1;
for (Adif3Record rec : log.getRecords()) {
transformer.transform(qsos, rec, index++);
}
assertThat(log.getRecords()).hasSize(16);
}
}
Aggregations