}
int exportedCount = 0;
int failedCount = 0;
for (int i = 0; i < waves.size(); i++) {
boolean errorOccured = false;
WaveId waveId = waves.get(i);
try {
if (excludeList != null && excludeList.contains(waveId)) {
Console.println("Skipping wave " + waveId.serialise() + "...");
continue;
}
Console.println("Exporting wave " + waveId.serialise()
+ " (" + (i + 1) + " of " + waves.size() + ") ...");
new File(fileNames.getWaveDirPath(waveId)).mkdir();
for (WaveletId waveletId : api.retrieveWaveletIds(waveId, rpcServerUrl)) {
WaveletSnapshotProtoImpl snapshot = exportSnapshot(waveId, waveletId);
Set<AttachmentId> attachmentIds = new HashSet<AttachmentId>();
try {
exportDeltas(waveId, waveletId, snapshot.getVersion().getPB(), attachmentIds);
} catch (IOException ex) {
errorOccured = true;
Console.error("Export of deltas error.", ex);
}
if (!attachmentIds.isEmpty()) {
new File(fileNames.getAttachmentsDirPath(waveId, waveletId)).mkdir();
for (AttachmentId attachmentId : attachmentIds) {
try {
exportAttachment(waveId, waveletId, attachmentId);
} catch (IOException ex) {
errorOccured = true;
Console.error("Uploading of attachment error.", ex);
}
}
}
}
} catch (Exception ex) {
errorOccured = true;
Console.error("Exporting of " + waveId.serialise() + " error.", ex);
}
if (errorOccured) {
failedCount++;
} else {
exportedCount++;