Search in sources :

Example 1 with GetCapabilitiesRemoteOperation

use of com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation in project android by nextcloud.

the class GetCapabilitiesOperation method run.

@Override
protected RemoteOperationResult run(OwnCloudClient client) {
    final FileDataStorageManager storageManager = getStorageManager();
    OCCapability currentCapability = null;
    if (!storageManager.getUser().isAnonymous()) {
        currentCapability = storageManager.getCapability(storageManager.getUser().getAccountName());
    }
    RemoteOperationResult result = new GetCapabilitiesRemoteOperation(currentCapability).execute(client);
    if (result.isSuccess() && result.getData() != null && result.getData().size() > 0) {
        // Read data from the result
        OCCapability capability = (OCCapability) result.getData().get(0);
        // Save the capabilities into database
        storageManager.saveCapabilities(capability);
    }
    return result;
}
Also used : OCCapability(com.owncloud.android.lib.resources.status.OCCapability) RemoteOperationResult(com.owncloud.android.lib.common.operations.RemoteOperationResult) FileDataStorageManager(com.owncloud.android.datamodel.FileDataStorageManager) GetCapabilitiesRemoteOperation(com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation)

Aggregations

FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)1 RemoteOperationResult (com.owncloud.android.lib.common.operations.RemoteOperationResult)1 GetCapabilitiesRemoteOperation (com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation)1 OCCapability (com.owncloud.android.lib.resources.status.OCCapability)1