예제 #1
0
 private void backup(ZipOutputStream zipOutputStream, CollectRecord summary, int stepNumber) {
   Integer id = summary.getId();
   try {
     CollectRecord record = recordManager.load(survey, id, stepNumber);
     String entryFileName = buildEntryFileName(record, stepNumber);
     ZipEntry entry = new ZipEntry(entryFileName);
     zipOutputStream.putNextEntry(entry);
     OutputStreamWriter writer = new OutputStreamWriter(zipOutputStream);
     dataMarshaller.write(record, writer);
     zipOutputStream.closeEntry();
     zipOutputStream.flush();
   } catch (Exception e) {
     String message = "Error while backing up " + id + " " + e.getMessage();
     if (LOG.isErrorEnabled()) {
       LOG.error(message, e);
     }
     throw new RuntimeException(message, e);
   }
 }