use of org.syncany.operations.down.DownOperationResult in project syncany by syncany.
the class DownCommand method execute.
@Override
public int execute(String[] operationArgs) throws Exception {
DownOperationOptions operationOptions = parseOptions(operationArgs);
DownOperationResult operationResult = new DownOperation(config, operationOptions).execute();
printResults(operationResult);
return 0;
}
use of org.syncany.operations.down.DownOperationResult in project syncany by syncany.
the class DownCommand method printResults.
@Override
public void printResults(OperationResult operationResult) {
DownOperationResult concreteOperationResult = (DownOperationResult) operationResult;
if (concreteOperationResult.getResultCode() == DownResultCode.OK_WITH_REMOTE_CHANGES) {
ChangeSet changeSet = concreteOperationResult.getChangeSet();
if (changeSet.hasChanges()) {
List<String> newFiles = new ArrayList<String>(changeSet.getNewFiles());
List<String> changedFiles = new ArrayList<String>(changeSet.getChangedFiles());
List<String> deletedFiles = new ArrayList<String>(changeSet.getDeletedFiles());
Collections.sort(newFiles);
Collections.sort(changedFiles);
Collections.sort(deletedFiles);
for (String newFile : newFiles) {
out.println("A " + newFile);
}
for (String changedFile : changedFiles) {
out.println("M " + changedFile);
}
for (String deletedFile : deletedFiles) {
out.println("D " + deletedFile);
}
} else {
out.println(concreteOperationResult.getDownloadedUnknownDatabases().size() + " database file(s) processed.");
}
out.println("Sync down finished.");
} else {
out.println("Sync down skipped, no remote changes.");
}
}
Aggregations