use of org.openforis.collect.persistence.xml.DataUnmarshaller.ParseRecordResult in project collect by openforis.
the class BackupDataExtractor method nextRecord.
public ParseRecordResult nextRecord() throws Exception {
checkInitialized();
ParseRecordResult result = null;
ZipEntry zipEntry = nextDataEntry();
while (zipEntry != null) {
String entryName = zipEntry.getName();
if (BackupRecordEntry.isValidRecordEntry(zipEntry, oldFormat)) {
BackupRecordEntry recordEntry = BackupRecordEntry.parse(entryName, oldFormat);
if (isToBeExported(recordEntry)) {
InputStream is = zipFile.getInputStream(zipEntry);
return parse(is);
} else {
zipEntry = nextDataEntry();
}
}
}
return result;
}
use of org.openforis.collect.persistence.xml.DataUnmarshaller.ParseRecordResult in project collect by openforis.
the class DataMarshallerIntegrationTest method testMarshal.
@Test
public void testMarshal() throws Exception {
// LOAD MODEL
CollectSurvey survey = loadSurvey();
CollectRecord record = createTestRecord(survey);
StringWriter out = new StringWriter();
dataMarshaller.write(record, out);
String xml = out.toString();
assertNotNull(xml);
ParseRecordResult parseRecordResult = parseRecord(survey, xml);
assertNotNull(parseRecordResult);
CollectRecord record2 = parseRecordResult.getRecord();
assertNotNull(record2);
assertEquals(record, record2);
}
Aggregations