}
}
public String describeTask(ImportTask task) {
if (task.getPayload().hasFindWavesTask()) {
FindRemoteWavesTask t = task.getPayload().getFindWavesTask();
return taskAgePrefix(task)
+ (t.hasAutoImportSettings() ? "Find and import" : "Find") + " waves on "
+ sourceInstanceFactory.parseUnchecked(t.getInstance()).getShortName()
+ " between " + DaysSinceEpoch.toLocalDate(t.getOnOrAfterDays())
+ " and " + DaysSinceEpoch.toLocalDate(t.getBeforeDays());
} else if (task.getPayload().hasFindWaveletsTask()) {
FindWaveletsForRemoteWaveTask t = task.getPayload().getFindWaveletsTask();
return taskAgePrefix(task)
+ (t.hasAutoImportSettings() ? "Find and import" : "Find")
+ " wavelets in wave " + t.getWaveDigest().getWaveId() + " on "
+ sourceInstanceFactory.parseUnchecked(t.getInstance()).getShortName();
} else if (task.getPayload().hasImportWaveletTask()) {
ImportWaveletTask t = task.getPayload().getImportWaveletTask();
String sharingMode;
switch (t.getSettings().getSharingMode()) {
case PRIVATE:
sharingMode = "Private";
break;
case SHARED:
sharingMode = "Shared";
break;
case PRIVATE_UNLESS_PARTICIPANT:
sharingMode = "Shared (if participant)";
break;
default:
throw new AssertionError("Unexpected SharingMode: " + t.getSettings().getSharingMode());
}
return taskAgePrefix(task)
+ sharingMode + " import of wavelet " + t.getWaveId() + " " + t.getWaveletId()
+ " from " + sourceInstanceFactory.parseUnchecked(t.getInstance()).getShortName();
} else if (task.getPayload().hasFetchAttachmentsTask()) {
FetchAttachmentsAndImportWaveletTask t = task.getPayload().getFetchAttachmentsTask();
return taskAgePrefix(task)
+ " Fetch attachments for wavelet "
+ t.getOriginalImportTask().getWaveId() + " " + t.getOriginalImportTask().getWaveletId()
+ " from " + sourceInstanceFactory.parseUnchecked(
t.getOriginalImportTask().getInstance()).getShortName()
+ " (" + t.getImportedSize() + "/" + (t.getImportedSize() + t.getToImportSize()) + ")";
} else {
throw new AssertionError("Unknown task payload type: " + task);
}
}