Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b09969d0 authored by David A. Velasco's avatar David A. Velasco
Browse files

Merge pull request #92 from owncloud/read_capabilities_for_showing_share_options

Added resource Capabilities and operation to get them
parents 7bd4dc96 75581c18
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@

package com.owncloud.android.lib.common.operations;

import java.io.IOException;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountsException;
@@ -42,6 +40,8 @@ import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
import com.owncloud.android.lib.common.utils.Log_OC;

import java.io.IOException;


/**
 * Operation which execution involves one or several interactions with an ownCloud server.
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.http.HttpStatus;


/** 
 * Get the data about a Share resource, known its remote ID.
 */
+0 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;


/**
 * Provide a list shares for a specific file.  
 * The input is the full path of the desired file.  
+0 −2
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;


/** 
 * Get the data from the server about ALL the known shares owned by the requester.
 * 
@@ -72,7 +71,6 @@ public class GetRemoteSharesOperation extends RemoteOperation {
				parser.setOwnCloudVersion(client.getOwnCloudVersion());
				parser.setServerBaseUri(client.getBaseUri());
				result = parser.parse(response);

			} else {
				result = new RemoteOperationResult(false, status, get.getResponseHeaders());
			}
+83 −0
Original line number Diff line number Diff line
/* ownCloud Android Library is available under MIT license
 *   Copyright (C) 2015 ownCloud Inc.
 *   @author masensio
 *
 *   Permission is hereby granted, free of charge, to any person obtaining a copy
 *   of this software and associated documentation files (the "Software"), to deal
 *   in the Software without restriction, including without limitation the rights
 *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *   copies of the Software, and to permit persons to whom the Software is
 *   furnished to do so, subject to the following conditions:
 *
 *   The above copyright notice and this permission notice shall be included in
 *   all copies or substantial portions of the Software.
 *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 *   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 *   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 *   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *   THE SOFTWARE.
 *
 */
package com.owncloud.android.lib.resources.status;

/**
 * Enum for Boolean Type in OCCapability parameters, with values:
 * -1 - Unknown
 *  0 - False
 *  1 - True
 */
public enum CapabilityBooleanType {
    UNKNOWN (-1),
    FALSE (0),
    TRUE (1);

    private int value;

    CapabilityBooleanType(int value)
    {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public static CapabilityBooleanType fromValue(int value)
    {
        switch (value)
        {
            case -1:
                return UNKNOWN;
            case 0:
                return FALSE;
            case 1:
                return TRUE;
        }
        return null;
    }

    public static CapabilityBooleanType fromBooleanValue(boolean boolValue){
        if (boolValue){
            return TRUE;
        } else {
            return FALSE;
        }
    }

    public boolean isUnknown(){
        return getValue() == -1;
    }

    public boolean isFalse(){
        return getValue() == 0;
    }

    public boolean isTrue(){
        return getValue() == 1;
    }

};
 No newline at end of file
Loading