use of org.openforis.collect.io.data.BackupDataExtractor.BackupRecordEntry in project collect by openforis.
the class DataBackupTask method backup.
private void backup(CollectRecordSummary summary, Step step) {
Integer id = summary.getId();
try {
CollectRecord record = recordManager.load(survey, id, step, false);
BackupRecordEntry recordEntry = new BackupRecordEntry(step, id);
ZipEntry entry = new ZipEntry(recordEntry.getName());
zipOutputStream.putNextEntry(entry);
OutputStreamWriter writer = new OutputStreamWriter(zipOutputStream);
dataMarshaller.write(record, writer);
zipOutputStream.closeEntry();
} catch (Exception e) {
DataBackupError error = new DataBackupError(summary.getId(), summary.getRootEntityKeyValues(), summary.getStep(), e.getMessage());
errors.add(error);
log().error(error.toString(), e);
}
}
use of org.openforis.collect.io.data.BackupDataExtractor.BackupRecordEntry in project collect by openforis.
the class DataRestoreSummaryTask method getEntryName.
private String getEntryName(int entryId, Step step) {
BackupRecordEntry recordEntry = new BackupRecordEntry(step, entryId, oldFormat);
String entryName = recordEntry.getName();
return entryName;
}
use of org.openforis.collect.io.data.BackupDataExtractor.BackupRecordEntry in project collect by openforis.
the class XMLParsingRecordProvider method getEntryName.
@Override
public String getEntryName(int entryId, Step step) {
if (backupFileExtractor.isOldFormat()) {
return step.getStepNumber() + "/" + entryId + ".xml";
} else {
BackupRecordEntry recordEntry = new BackupRecordEntry(step, entryId);
String entryName = recordEntry.getName();
return entryName;
}
}
Aggregations