@Override
public StatusOperationResult execute() throws Exception {
logger.log(Level.INFO, "");
logger.log(Level.INFO, "Running 'Status' at client " + config.getMachineName() + " ...");
logger.log(Level.INFO, "--------------------------------------------");
if (options != null && options.isForceChecksum()) {
logger.log(Level.INFO, "Force checksum ENABLED.");
}
if (options != null && !options.isDelete()) {
logger.log(Level.INFO, "Delete missing files DISABLED.");
}
logger.log(Level.INFO, "Querying current file tree from database ...");
eventBus.post(new StatusStartSyncExternalEvent(config.getLocalDir().getAbsolutePath()));
final Map<String, FileVersion> filesInDatabase = localDatabase.getCurrentFileTree();
logger.log(Level.INFO, "Analyzing local folder " + config.getLocalDir() + " ...");
ChangeSet localChanges = findLocalChanges(filesInDatabase);
if (!localChanges.hasChanges()) {
logger.log(Level.INFO, "- No changes to local database");
}
StatusOperationResult statusResult = new StatusOperationResult();
statusResult.setChangeSet(localChanges);
eventBus.post(new StatusEndSyncExternalEvent(config.getLocalDir().getAbsolutePath(), localChanges.hasChanges()));
return statusResult;
}