Search in sources :

Example 1 with StoreMetadataRemoteOperation

use of com.owncloud.android.lib.resources.e2ee.StoreMetadataRemoteOperation in project android by nextcloud.

the class EncryptionUtils method uploadMetadata.

public static void uploadMetadata(OCFile parentFile, String serializedFolderMetadata, String token, OwnCloudClient client, boolean metadataExists) throws UploadException {
    RemoteOperationResult uploadMetadataOperationResult;
    if (metadataExists) {
        // update metadata
        UpdateMetadataRemoteOperation storeMetadataOperation = new UpdateMetadataRemoteOperation(parentFile.getLocalId(), serializedFolderMetadata, token);
        uploadMetadataOperationResult = storeMetadataOperation.execute(client);
    } else {
        // store metadata
        StoreMetadataRemoteOperation storeMetadataOperation = new StoreMetadataRemoteOperation(parentFile.getLocalId(), serializedFolderMetadata);
        uploadMetadataOperationResult = storeMetadataOperation.execute(client);
    }
    if (!uploadMetadataOperationResult.isSuccess()) {
        throw new UploadException("Storing/updating metadata was not successful");
    }
}
Also used : RemoteOperationResult(com.owncloud.android.lib.common.operations.RemoteOperationResult) UpdateMetadataRemoteOperation(com.owncloud.android.lib.resources.e2ee.UpdateMetadataRemoteOperation) UploadException(com.owncloud.android.operations.UploadException) StoreMetadataRemoteOperation(com.owncloud.android.lib.resources.e2ee.StoreMetadataRemoteOperation)

Aggregations

RemoteOperationResult (com.owncloud.android.lib.common.operations.RemoteOperationResult)1 StoreMetadataRemoteOperation (com.owncloud.android.lib.resources.e2ee.StoreMetadataRemoteOperation)1 UpdateMetadataRemoteOperation (com.owncloud.android.lib.resources.e2ee.UpdateMetadataRemoteOperation)1 UploadException (com.owncloud.android.operations.UploadException)1