use of com.owncloud.android.lib.common.operations.RemoteOperationResult in project android by owncloud.
the class RefreshFolderOperation method updateOCVersion.
private void updateOCVersion(OwnCloudClient client) {
UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
RemoteOperationResult result = update.execute(client);
if (result.isSuccess()) {
mIsShareSupported = update.getOCVersion().isSharedSupported();
// Update Capabilities for this account
if (update.getOCVersion().isVersionWithCapabilitiesAPI()) {
updateCapabilities();
} else {
Log_OC.d(TAG, "Capabilities API disabled");
}
}
}
use of com.owncloud.android.lib.common.operations.RemoteOperationResult in project android by owncloud.
the class RefreshFolderOperation method updateUserProfile.
private void updateUserProfile() {
GetUserProfileOperation update = new GetUserProfileOperation();
RemoteOperationResult result = update.execute(getStorageManager(), mContext);
if (!result.isSuccess()) {
Log_OC.w(TAG, "Couldn't update user profile from server");
} else {
Log_OC.i(TAG, "Got user profile");
}
}
use of com.owncloud.android.lib.common.operations.RemoteOperationResult in project android by owncloud.
the class RefreshFolderOperation method updateCapabilities.
private void updateCapabilities() {
GetCapabilitiesOperarion getCapabilities = new GetCapabilitiesOperarion();
RemoteOperationResult result = getCapabilities.execute(getStorageManager(), mContext);
if (!result.isSuccess()) {
Log_OC.w(TAG, "Update Capabilities unsuccessfully");
}
}
use of com.owncloud.android.lib.common.operations.RemoteOperationResult in project android by owncloud.
the class FileSyncAdapter method updateOCVersion.
/**
* Updates the locally stored version value of the ownCloud server
*/
private void updateOCVersion() {
UpdateOCVersionOperation update = new UpdateOCVersionOperation(getAccount(), getContext());
RemoteOperationResult result = update.execute(getClient());
if (!result.isSuccess()) {
mLastFailedResult = result;
}
}
use of com.owncloud.android.lib.common.operations.RemoteOperationResult in project android by owncloud.
the class SynchronizeFolderOperation method run.
/**
* Performs the synchronization.
*
* {@inheritDoc}
*/
@Override
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result;
mFailsInFileSyncsFound = 0;
mConflictsFound = 0;
mForgottenLocalFiles.clear();
try {
// get locally cached information about folder
mLocalFolder = getStorageManager().getFileByPath(mRemotePath);
if (mPushOnly) {
// assuming there is no update in the server side, still need to handle local changes
Log_OC.i(TAG, "Push only sync of " + mAccount.name + mRemotePath);
preparePushOfLocalChanges();
syncContents();
//pushOnlySync();
result = new RemoteOperationResult(ResultCode.OK);
} else {
// get list of files in folder from remote server
result = fetchRemoteFolder(client);
if (result.isSuccess()) {
// success - merge updates in server with local state
mergeRemoteFolder(result.getData());
syncContents();
} else {
// fail fetching the server
if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
removeLocalFolder();
}
if (result.isException()) {
Log_OC.e(TAG, "Checked " + mAccount.name + mRemotePath + " : " + result.getLogMessage(), result.getException());
} else {
Log_OC.e(TAG, "Checked " + mAccount.name + mRemotePath + " : " + result.getLogMessage());
}
}
}
} catch (OperationCancelledException e) {
result = new RemoteOperationResult(e);
}
return result;
}
Aggregations