mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Convert capabilities related classes to Kotlin
This commit is contained in:
		
							parent
							
								
									64f5f08ded
								
							
						
					
					
						commit
						6bd64197b4
					
				| @ -180,7 +180,6 @@ class RemoteShare : Parcelable, Serializable { | |||||||
|         const val FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9 = |         const val FEDERATED_PERMISSIONS_FOR_FOLDER_AFTER_OC9 = | ||||||
|             FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9 + SHARE_PERMISSION_FLAG |             FEDERATED_PERMISSIONS_FOR_FOLDER_UP_TO_OC9 + SHARE_PERMISSION_FLAG | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|         const val INIT_EXPIRATION_DATE_IN_MILLIS: Long = 0 |         const val INIT_EXPIRATION_DATE_IN_MILLIS: Long = 0 | ||||||
|         const val INIT_SHARED_DATE: Long = 0 |         const val INIT_SHARED_DATE: Long = 0 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,5 +1,5 @@ | |||||||
| /* ownCloud Android Library is available under MIT license | /* ownCloud Android Library is available under MIT license | ||||||
|  *   Copyright (C) 2016 ownCloud GmbH. |  *   Copyright (C) 2019 ownCloud GmbH. | ||||||
|  * |  * | ||||||
|  *   Permission is hereby granted, free of charge, to any person obtaining a copy |  *   Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
|  *   of this software and associated documentation files (the "Software"), to deal |  *   of this software and associated documentation files (the "Software"), to deal | ||||||
| @ -22,7 +22,7 @@ | |||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| package com.owncloud.android.lib.resources.shares; | package com.owncloud.android.lib.resources.shares | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Enum for Share Type, with values: |  * Enum for Share Type, with values: | ||||||
| @ -36,7 +36,7 @@ package com.owncloud.android.lib.resources.shares; | |||||||
|  * @author masensio |  * @author masensio | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| public enum ShareType { | enum class ShareType private constructor(val value: Int) { | ||||||
|     NO_SHARED(-1), |     NO_SHARED(-1), | ||||||
|     USER(0), |     USER(0), | ||||||
|     GROUP(1), |     GROUP(1), | ||||||
| @ -45,33 +45,19 @@ public enum ShareType { | |||||||
|     CONTACT(5), |     CONTACT(5), | ||||||
|     FEDERATED(6); |     FEDERATED(6); | ||||||
| 
 | 
 | ||||||
|     private int value; |     companion object { | ||||||
| 
 | 
 | ||||||
|     private ShareType(int value) { |         fun fromValue(value: Int): ShareType? { | ||||||
|         this.value = value; |             when (value) { | ||||||
|  |                 -1 -> return NO_SHARED | ||||||
|  |                 0 -> return USER | ||||||
|  |                 1 -> return GROUP | ||||||
|  |                 3 -> return PUBLIC_LINK | ||||||
|  |                 4 -> return EMAIL | ||||||
|  |                 5 -> return CONTACT | ||||||
|  |                 6 -> return FEDERATED | ||||||
|             } |             } | ||||||
| 
 |             return null | ||||||
|     public static ShareType fromValue(int value) { |  | ||||||
|         switch (value) { |  | ||||||
|             case -1: |  | ||||||
|                 return NO_SHARED; |  | ||||||
|             case 0: |  | ||||||
|                 return USER; |  | ||||||
|             case 1: |  | ||||||
|                 return GROUP; |  | ||||||
|             case 3: |  | ||||||
|                 return PUBLIC_LINK; |  | ||||||
|             case 4: |  | ||||||
|                 return EMAIL; |  | ||||||
|             case 5: |  | ||||||
|                 return CONTACT; |  | ||||||
|             case 6: |  | ||||||
|                 return FEDERATED; |  | ||||||
|         } |         } | ||||||
|         return null; |  | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     public int getValue() { |  | ||||||
|         return value; |  | ||||||
| } | } | ||||||
| }; |  | ||||||
| @ -1,5 +1,5 @@ | |||||||
| /* ownCloud Android Library is available under MIT license | /* ownCloud Android Library is available under MIT license | ||||||
|  *   Copyright (C) 2016 ownCloud GmbH. |  *   Copyright (C) 2019 ownCloud GmbH. | ||||||
|  *   @author masensio |  *   @author masensio | ||||||
|  * |  * | ||||||
|  *   Permission is hereby granted, free of charge, to any person obtaining a copy |  *   Permission is hereby granted, free of charge, to any person obtaining a copy | ||||||
| @ -22,59 +22,44 @@ | |||||||
|  *   THE SOFTWARE. |  *   THE SOFTWARE. | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| package com.owncloud.android.lib.resources.status; | package com.owncloud.android.lib.resources.status | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Enum for Boolean Type in OCCapability parameters, with values: |  * Enum for Boolean Type in RemoteCapability parameters, with values: | ||||||
|  * -1 - Unknown |  * -1 - Unknown | ||||||
|  * 0 - False |  * 0 - False | ||||||
|  * 1 - True |  * 1 - True | ||||||
|  */ |  */ | ||||||
| public enum CapabilityBooleanType { | enum class CapabilityBooleanType private constructor(val value: Int) { | ||||||
|     UNKNOWN(-1), |     UNKNOWN(-1), | ||||||
|     FALSE(0), |     FALSE(0), | ||||||
|     TRUE(1); |     TRUE(1); | ||||||
| 
 | 
 | ||||||
|     private int value; |     val isUnknown: Boolean | ||||||
|  |         get() = value == -1 | ||||||
| 
 | 
 | ||||||
|     CapabilityBooleanType(int value) { |     val isFalse: Boolean | ||||||
|         this.value = value; |         get() = value == 0 | ||||||
|  | 
 | ||||||
|  |     val isTrue: Boolean | ||||||
|  |         get() = value == 1 | ||||||
|  | 
 | ||||||
|  |     companion object { | ||||||
|  |         fun fromValue(value: Int): CapabilityBooleanType? { | ||||||
|  |             when (value) { | ||||||
|  |                 -1 -> return UNKNOWN | ||||||
|  |                 0 -> return FALSE | ||||||
|  |                 1 -> return TRUE | ||||||
|  |             } | ||||||
|  |             return null | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     public static CapabilityBooleanType fromValue(int value) { |         fun fromBooleanValue(boolValue: Boolean): CapabilityBooleanType { | ||||||
|         switch (value) { |             return if (boolValue) { | ||||||
|             case -1: |                 TRUE | ||||||
|                 return UNKNOWN; |  | ||||||
|             case 0: |  | ||||||
|                 return FALSE; |  | ||||||
|             case 1: |  | ||||||
|                 return TRUE; |  | ||||||
|         } |  | ||||||
|         return null; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public static CapabilityBooleanType fromBooleanValue(boolean boolValue) { |  | ||||||
|         if (boolValue) { |  | ||||||
|             return TRUE; |  | ||||||
|             } else { |             } else { | ||||||
|             return FALSE; |                 FALSE | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|     public int getValue() { |  | ||||||
|         return value; |  | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     public boolean isUnknown() { |  | ||||||
|         return getValue() == -1; |  | ||||||
| } | } | ||||||
| 
 |  | ||||||
|     public boolean isFalse() { |  | ||||||
|         return getValue() == 0; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public boolean isTrue() { |  | ||||||
|         return getValue() == 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| }; |  | ||||||
| @ -1,316 +0,0 @@ | |||||||
| /* ownCloud Android Library is available under MIT license |  | ||||||
|  *   @author masensio |  | ||||||
|  *   @author Semih Serhat Karakaya <karakayasemi@itu.edu.tr> |  | ||||||
|  *   @author David González Verdugo |  | ||||||
|  *   Copyright (C) 2019 ownCloud GmbH. |  | ||||||
|  * |  | ||||||
|  *   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; |  | ||||||
| 
 |  | ||||||
| import android.net.Uri; |  | ||||||
| 
 |  | ||||||
| import com.owncloud.android.lib.common.OwnCloudClient; |  | ||||||
| import com.owncloud.android.lib.common.http.HttpConstants; |  | ||||||
| import com.owncloud.android.lib.common.http.methods.nonwebdav.GetMethod; |  | ||||||
| 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; |  | ||||||
| import org.json.JSONObject; |  | ||||||
| 
 |  | ||||||
| import java.net.URL; |  | ||||||
| 
 |  | ||||||
| import static com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.OK; |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * Get the Capabilities from the server |  | ||||||
|  * Save in Result.getData in a OCCapability object |  | ||||||
|  * |  | ||||||
|  * @author masensio |  | ||||||
|  * @author David González Verdugo |  | ||||||
|  */ |  | ||||||
| public class GetRemoteCapabilitiesOperation extends RemoteOperation<OCCapability> { |  | ||||||
| 
 |  | ||||||
|     private static final String TAG = GetRemoteCapabilitiesOperation.class.getSimpleName(); |  | ||||||
| 
 |  | ||||||
|     // OCS Routes |  | ||||||
|     private static final String OCS_ROUTE = "ocs/v2.php/cloud/capabilities"; |  | ||||||
| 
 |  | ||||||
|     // Arguments - names |  | ||||||
|     private static final String PARAM_FORMAT = "format"; |  | ||||||
| 
 |  | ||||||
|     // Arguments - constant values |  | ||||||
|     private static final String VALUE_FORMAT = "json"; |  | ||||||
| 
 |  | ||||||
|     // JSON Node names |  | ||||||
|     private static final String NODE_OCS = "ocs"; |  | ||||||
| 
 |  | ||||||
|     private static final String NODE_META = "meta"; |  | ||||||
| 
 |  | ||||||
|     private static final String NODE_DATA = "data"; |  | ||||||
|     private static final String NODE_VERSION = "version"; |  | ||||||
| 
 |  | ||||||
|     private static final String NODE_CAPABILITIES = "capabilities"; |  | ||||||
|     private static final String NODE_CORE = "core"; |  | ||||||
| 
 |  | ||||||
|     private static final String NODE_FILES_SHARING = "files_sharing"; |  | ||||||
|     private static final String NODE_PUBLIC = "public"; |  | ||||||
|     private static final String NODE_PASSWORD = "password"; |  | ||||||
|     private static final String NODE_ENFORCED_FOR = "enforced_for"; |  | ||||||
|     private static final String NODE_EXPIRE_DATE = "expire_date"; |  | ||||||
|     private static final String NODE_USER = "user"; |  | ||||||
|     private static final String NODE_FEDERATION = "federation"; |  | ||||||
|     private static final String NODE_FILES = "files"; |  | ||||||
| 
 |  | ||||||
|     private static final String PROPERTY_STATUS = "status"; |  | ||||||
|     private static final String PROPERTY_STATUSCODE = "statuscode"; |  | ||||||
|     private static final String PROPERTY_MESSAGE = "message"; |  | ||||||
| 
 |  | ||||||
|     private static final String PROPERTY_POLLINTERVAL = "pollinterval"; |  | ||||||
| 
 |  | ||||||
|     private static final String PROPERTY_MAJOR = "major"; |  | ||||||
|     private static final String PROPERTY_MINOR = "minor"; |  | ||||||
|     private static final String PROPERTY_MICRO = "micro"; |  | ||||||
|     private static final String PROPERTY_STRING = "string"; |  | ||||||
|     private static final String PROPERTY_EDITION = "edition"; |  | ||||||
| 
 |  | ||||||
|     private static final String PROPERTY_API_ENABLED = "api_enabled"; |  | ||||||
|     private static final String PROPERTY_ENABLED = "enabled"; |  | ||||||
|     private static final String PROPERTY_ENFORCED = "enforced"; |  | ||||||
|     private static final String PROPERTY_ENFORCED_READ_ONLY = "read_only"; |  | ||||||
|     private static final String PROPERTY_ENFORCED_READ_WRITE = "read_write"; |  | ||||||
|     private static final String PROPERTY_ENFORCED_UPLOAD_ONLY = "upload_only"; |  | ||||||
|     private static final String PROPERTY_DAYS = "days"; |  | ||||||
|     private static final String PROPERTY_SEND_MAIL = "send_mail"; |  | ||||||
|     private static final String PROPERTY_UPLOAD = "upload"; |  | ||||||
|     private static final String PROPERTY_UPLOAD_ONLY = "supports_upload_only"; |  | ||||||
|     private static final String PROPERTY_MULTIPLE = "multiple"; |  | ||||||
|     private static final String PROPERTY_RESHARING = "resharing"; |  | ||||||
|     private static final String PROPERTY_OUTGOING = "outgoing"; |  | ||||||
|     private static final String PROPERTY_INCOMING = "incoming"; |  | ||||||
| 
 |  | ||||||
|     private static final String PROPERTY_BIGFILECHUNKING = "bigfilechunking"; |  | ||||||
|     private static final String PROPERTY_UNDELETE = "undelete"; |  | ||||||
|     private static final String PROPERTY_VERSIONING = "versioning"; |  | ||||||
| 
 |  | ||||||
|     /** |  | ||||||
|      * Constructor |  | ||||||
|      */ |  | ||||||
|     public GetRemoteCapabilitiesOperation() { |  | ||||||
| 
 |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Override |  | ||||||
|     protected RemoteOperationResult<OCCapability> run(OwnCloudClient client) { |  | ||||||
|         RemoteOperationResult<OCCapability> result; |  | ||||||
| 
 |  | ||||||
|         try { |  | ||||||
|             Uri requestUri = client.getBaseUri(); |  | ||||||
|             Uri.Builder uriBuilder = requestUri.buildUpon(); |  | ||||||
|             uriBuilder.appendEncodedPath(OCS_ROUTE);    // avoid starting "/" in this method |  | ||||||
|             uriBuilder.appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT); |  | ||||||
| 
 |  | ||||||
|             GetMethod getMethod = new GetMethod(new URL(uriBuilder.build().toString())); |  | ||||||
| 
 |  | ||||||
|             getMethod.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE); |  | ||||||
| 
 |  | ||||||
|             int status = client.executeHttpMethod(getMethod); |  | ||||||
| 
 |  | ||||||
|             String response = getMethod.getResponseBodyAsString(); |  | ||||||
|             if (isSuccess(status)) { |  | ||||||
|                 Log_OC.d(TAG, "Successful response: " + response); |  | ||||||
| 
 |  | ||||||
|                 // Parse the response |  | ||||||
|                 JSONObject respJSON = new JSONObject(response); |  | ||||||
|                 JSONObject respOCS = respJSON.getJSONObject(NODE_OCS); |  | ||||||
|                 JSONObject respMeta = respOCS.getJSONObject(NODE_META); |  | ||||||
|                 JSONObject respData = respOCS.getJSONObject(NODE_DATA); |  | ||||||
| 
 |  | ||||||
|                 // Read meta |  | ||||||
|                 boolean statusProp = respMeta.getString(PROPERTY_STATUS).equalsIgnoreCase("ok"); |  | ||||||
|                 int statuscode = respMeta.getInt(PROPERTY_STATUSCODE); |  | ||||||
|                 String message = respMeta.getString(PROPERTY_MESSAGE); |  | ||||||
| 
 |  | ||||||
|                 if (statusProp) { |  | ||||||
|                     OCCapability capability = new OCCapability(); |  | ||||||
|                     // Add Version |  | ||||||
|                     if (respData.has(NODE_VERSION)) { |  | ||||||
|                         JSONObject respVersion = respData.getJSONObject(NODE_VERSION); |  | ||||||
|                         capability.setVersionMayor(respVersion.getInt(PROPERTY_MAJOR)); |  | ||||||
|                         capability.setVersionMinor(respVersion.getInt(PROPERTY_MINOR)); |  | ||||||
|                         capability.setVersionMicro(respVersion.getInt(PROPERTY_MICRO)); |  | ||||||
|                         capability.setVersionString(respVersion.getString(PROPERTY_STRING)); |  | ||||||
|                         capability.setVersionEdition(respVersion.getString(PROPERTY_EDITION)); |  | ||||||
|                         Log_OC.d(TAG, "*** Added " + NODE_VERSION); |  | ||||||
|                     } |  | ||||||
| 
 |  | ||||||
|                     // Capabilities Object |  | ||||||
|                     if (respData.has(NODE_CAPABILITIES)) { |  | ||||||
|                         JSONObject respCapabilities = respData.getJSONObject(NODE_CAPABILITIES); |  | ||||||
| 
 |  | ||||||
|                         // Add Core: pollinterval |  | ||||||
|                         if (respCapabilities.has(NODE_CORE)) { |  | ||||||
|                             JSONObject respCore = respCapabilities.getJSONObject(NODE_CORE); |  | ||||||
|                             capability.setCorePollinterval(respCore.getInt(PROPERTY_POLLINTERVAL)); |  | ||||||
|                             Log_OC.d(TAG, "*** Added " + NODE_CORE); |  | ||||||
|                         } |  | ||||||
| 
 |  | ||||||
|                         // Add files_sharing: public, user, resharing |  | ||||||
|                         if (respCapabilities.has(NODE_FILES_SHARING)) { |  | ||||||
|                             JSONObject respFilesSharing = respCapabilities.getJSONObject(NODE_FILES_SHARING); |  | ||||||
|                             if (respFilesSharing.has(PROPERTY_API_ENABLED)) { |  | ||||||
|                                 capability.setFilesSharingApiEnabled(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respFilesSharing.getBoolean(PROPERTY_API_ENABLED))); |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             if (respFilesSharing.has(NODE_PUBLIC)) { |  | ||||||
|                                 JSONObject respPublic = respFilesSharing.getJSONObject(NODE_PUBLIC); |  | ||||||
|                                 capability.setFilesSharingPublicEnabled(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respPublic.getBoolean(PROPERTY_ENABLED))); |  | ||||||
| 
 |  | ||||||
|                                 if (respPublic.has(NODE_PASSWORD)) { |  | ||||||
|                                     JSONObject respPassword = respPublic.getJSONObject(NODE_PASSWORD); |  | ||||||
|                                     capability.setFilesSharingPublicPasswordEnforced( |  | ||||||
|                                             CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                     respPublic.getJSONObject(NODE_PASSWORD). |  | ||||||
|                                                             getBoolean(PROPERTY_ENFORCED) |  | ||||||
|                                             ) |  | ||||||
|                                     ); |  | ||||||
| 
 |  | ||||||
|                                     if(respPassword.has(NODE_ENFORCED_FOR)) { |  | ||||||
|                                         capability.setFilesSharingPublicPasswordEnforcedReadOnly( |  | ||||||
|                                                 CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                         respPassword.getJSONObject(NODE_ENFORCED_FOR). |  | ||||||
|                                                                 getBoolean(PROPERTY_ENFORCED_READ_ONLY) |  | ||||||
|                                                 ) |  | ||||||
|                                         ); |  | ||||||
| 
 |  | ||||||
|                                         capability.setFilesSharingPublicPasswordEnforcedReadWrite( |  | ||||||
|                                                 CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                         respPassword.getJSONObject(NODE_ENFORCED_FOR). |  | ||||||
|                                                                 getBoolean(PROPERTY_ENFORCED_READ_WRITE) |  | ||||||
|                                                 ) |  | ||||||
|                                         ); |  | ||||||
| 
 |  | ||||||
|                                         capability.setFilesSharingPublicPasswordEnforcedUploadOnly( |  | ||||||
|                                                 CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                         respPassword.getJSONObject(NODE_ENFORCED_FOR). |  | ||||||
|                                                                 getBoolean(PROPERTY_ENFORCED_UPLOAD_ONLY) |  | ||||||
|                                                 ) |  | ||||||
|                                         ); |  | ||||||
|                                     } |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(NODE_EXPIRE_DATE)) { |  | ||||||
|                                     JSONObject respExpireDate = respPublic.getJSONObject(NODE_EXPIRE_DATE); |  | ||||||
|                                     capability.setFilesSharingPublicExpireDateEnabled( |  | ||||||
|                                             CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                     respExpireDate.getBoolean(PROPERTY_ENABLED))); |  | ||||||
|                                     if (respExpireDate.has(PROPERTY_DAYS)) { |  | ||||||
|                                         capability.setFilesSharingPublicExpireDateDays( |  | ||||||
|                                                 respExpireDate.getInt(PROPERTY_DAYS)); |  | ||||||
|                                     } |  | ||||||
|                                     if (respExpireDate.has(PROPERTY_ENFORCED)) { |  | ||||||
|                                         capability.setFilesSharingPublicExpireDateEnforced( |  | ||||||
|                                                 CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                                         respExpireDate.getBoolean(PROPERTY_ENFORCED))); |  | ||||||
|                                     } |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(PROPERTY_UPLOAD)) { |  | ||||||
|                                     capability.setFilesSharingPublicUpload(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                             respPublic.getBoolean(PROPERTY_UPLOAD))); |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(PROPERTY_UPLOAD_ONLY)) { |  | ||||||
|                                     capability.setFilesSharingPublicSupportsUploadOnly(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                             respPublic.getBoolean(PROPERTY_UPLOAD_ONLY))); |  | ||||||
|                                 } |  | ||||||
|                                 if (respPublic.has(PROPERTY_MULTIPLE)) { |  | ||||||
|                                     capability.setFilesSharingPublicMultiple(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                             respPublic.getBoolean(PROPERTY_MULTIPLE))); |  | ||||||
|                                 } |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             if (respFilesSharing.has(NODE_USER)) { |  | ||||||
|                                 JSONObject respUser = respFilesSharing.getJSONObject(NODE_USER); |  | ||||||
|                                 capability.setFilesSharingUserSendMail(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respUser.getBoolean(PROPERTY_SEND_MAIL))); |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             capability.setFilesSharingResharing(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respFilesSharing.getBoolean(PROPERTY_RESHARING))); |  | ||||||
|                             if (respFilesSharing.has(NODE_FEDERATION)) { |  | ||||||
|                                 JSONObject respFederation = respFilesSharing.getJSONObject(NODE_FEDERATION); |  | ||||||
|                                 capability.setFilesSharingFederationOutgoing( |  | ||||||
|                                         CapabilityBooleanType.fromBooleanValue(respFederation.getBoolean(PROPERTY_OUTGOING))); |  | ||||||
|                                 capability.setFilesSharingFederationIncoming(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respFederation.getBoolean(PROPERTY_INCOMING))); |  | ||||||
|                             } |  | ||||||
|                             Log_OC.d(TAG, "*** Added " + NODE_FILES_SHARING); |  | ||||||
|                         } |  | ||||||
| 
 |  | ||||||
|                         if (respCapabilities.has(NODE_FILES)) { |  | ||||||
|                             JSONObject respFiles = respCapabilities.getJSONObject(NODE_FILES); |  | ||||||
|                             // Add files |  | ||||||
|                             capability.setFilesBigFileChuncking(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                     respFiles.getBoolean(PROPERTY_BIGFILECHUNKING))); |  | ||||||
|                             if (respFiles.has(PROPERTY_UNDELETE)) { |  | ||||||
|                                 capability.setFilesUndelete(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respFiles.getBoolean(PROPERTY_UNDELETE))); |  | ||||||
|                             } |  | ||||||
|                             if (respFiles.has(PROPERTY_VERSIONING)) { |  | ||||||
|                                 capability.setFilesVersioning(CapabilityBooleanType.fromBooleanValue( |  | ||||||
|                                         respFiles.getBoolean(PROPERTY_VERSIONING))); |  | ||||||
|                             } |  | ||||||
|                             Log_OC.d(TAG, "*** Added " + NODE_FILES); |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                     // Result |  | ||||||
|                     result = new RemoteOperationResult<>(OK); |  | ||||||
|                     result.setData(capability); |  | ||||||
| 
 |  | ||||||
|                     Log_OC.d(TAG, "*** Get Capabilities completed "); |  | ||||||
|                 } else { |  | ||||||
|                     result = new RemoteOperationResult<>(statuscode, message, null); |  | ||||||
|                     Log_OC.e(TAG, "Failed response while getting capabilities from the server "); |  | ||||||
|                     Log_OC.e(TAG, "*** status: " + statusProp + "; message: " + message); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|             } else { |  | ||||||
|                 result = new RemoteOperationResult<>(getMethod); |  | ||||||
|                 Log_OC.e(TAG, "Failed response while getting capabilities from the server "); |  | ||||||
|                 if (response != null) { |  | ||||||
|                     Log_OC.e(TAG, "*** status code: " + status + "; response message: " + response); |  | ||||||
|                 } else { |  | ||||||
|                     Log_OC.e(TAG, "*** status code: " + status); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|         } catch (Exception e) { |  | ||||||
|             result = new RemoteOperationResult<>(e); |  | ||||||
|             Log_OC.e(TAG, "Exception while getting capabilities", e); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     private boolean isSuccess(int status) { |  | ||||||
|         return (status == HttpConstants.HTTP_OK); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -0,0 +1,323 @@ | |||||||
|  | /* ownCloud Android Library is available under MIT license | ||||||
|  |  *   @author masensio | ||||||
|  |  *   @author Semih Serhat Karakaya <karakayasemi@itu.edu.tr> | ||||||
|  |  *   @author David González Verdugo | ||||||
|  |  *   Copyright (C) 2019 ownCloud GmbH. | ||||||
|  |  * | ||||||
|  |  *   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 | ||||||
|  | 
 | ||||||
|  | import com.owncloud.android.lib.common.OwnCloudClient | ||||||
|  | import com.owncloud.android.lib.common.http.HttpConstants | ||||||
|  | import com.owncloud.android.lib.common.http.methods.nonwebdav.GetMethod | ||||||
|  | import com.owncloud.android.lib.common.operations.RemoteOperation | ||||||
|  | import com.owncloud.android.lib.common.operations.RemoteOperationResult | ||||||
|  | import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.OK | ||||||
|  | import com.owncloud.android.lib.common.utils.Log_OC | ||||||
|  | import org.json.JSONObject | ||||||
|  | import java.net.URL | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Get the Capabilities from the server | ||||||
|  |  * Save in Result.getData in a RemoteCapability object | ||||||
|  |  * | ||||||
|  |  * @author masensio | ||||||
|  |  * @author David González Verdugo | ||||||
|  |  */ | ||||||
|  | /** | ||||||
|  |  * Constructor | ||||||
|  |  */ | ||||||
|  | class GetRemoteCapabilitiesOperation : RemoteOperation<RemoteCapability>() { | ||||||
|  | 
 | ||||||
|  |     override fun run(client: OwnCloudClient): RemoteOperationResult<RemoteCapability> { | ||||||
|  |         var result: RemoteOperationResult<RemoteCapability> | ||||||
|  | 
 | ||||||
|  |         try { | ||||||
|  |             val requestUri = client.baseUri | ||||||
|  |             val uriBuilder = requestUri.buildUpon() | ||||||
|  |             uriBuilder.appendEncodedPath(OCS_ROUTE)    // avoid starting "/" in this method | ||||||
|  |             uriBuilder.appendQueryParameter(PARAM_FORMAT, VALUE_FORMAT) | ||||||
|  | 
 | ||||||
|  |             val getMethod = GetMethod(URL(uriBuilder.build().toString())) | ||||||
|  | 
 | ||||||
|  |             getMethod.addRequestHeader(RemoteOperation.OCS_API_HEADER, RemoteOperation.OCS_API_HEADER_VALUE) | ||||||
|  | 
 | ||||||
|  |             val status = client.executeHttpMethod(getMethod) | ||||||
|  | 
 | ||||||
|  |             val response = getMethod.responseBodyAsString | ||||||
|  |             if (isSuccess(status)) { | ||||||
|  |                 Log_OC.d(TAG, "Successful response: " + response!!) | ||||||
|  | 
 | ||||||
|  |                 // Parse the response | ||||||
|  |                 val respJSON = JSONObject(response) | ||||||
|  |                 val respOCS = respJSON.getJSONObject(NODE_OCS) | ||||||
|  |                 val respMeta = respOCS.getJSONObject(NODE_META) | ||||||
|  |                 val respData = respOCS.getJSONObject(NODE_DATA) | ||||||
|  | 
 | ||||||
|  |                 // Read meta | ||||||
|  |                 val statusProp = respMeta.getString(PROPERTY_STATUS).equals("ok", ignoreCase = true) | ||||||
|  |                 val statuscode = respMeta.getInt(PROPERTY_STATUSCODE) | ||||||
|  |                 val message = respMeta.getString(PROPERTY_MESSAGE) | ||||||
|  | 
 | ||||||
|  |                 if (statusProp) { | ||||||
|  |                     val capability = RemoteCapability() | ||||||
|  |                     // Add Version | ||||||
|  |                     if (respData.has(NODE_VERSION)) { | ||||||
|  |                         val respVersion = respData.getJSONObject(NODE_VERSION) | ||||||
|  |                         capability.versionMayor = respVersion.getInt(PROPERTY_MAJOR) | ||||||
|  |                         capability.versionMinor = respVersion.getInt(PROPERTY_MINOR) | ||||||
|  |                         capability.versionMicro = respVersion.getInt(PROPERTY_MICRO) | ||||||
|  |                         capability.versionString = respVersion.getString(PROPERTY_STRING) | ||||||
|  |                         capability.versionEdition = respVersion.getString(PROPERTY_EDITION) | ||||||
|  |                         Log_OC.d(TAG, "*** Added $NODE_VERSION") | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     // Capabilities Object | ||||||
|  |                     if (respData.has(NODE_CAPABILITIES)) { | ||||||
|  |                         val respCapabilities = respData.getJSONObject(NODE_CAPABILITIES) | ||||||
|  | 
 | ||||||
|  |                         // Add Core: pollinterval | ||||||
|  |                         if (respCapabilities.has(NODE_CORE)) { | ||||||
|  |                             val respCore = respCapabilities.getJSONObject(NODE_CORE) | ||||||
|  |                             capability.corePollinterval = respCore.getInt(PROPERTY_POLLINTERVAL) | ||||||
|  |                             Log_OC.d(TAG, "*** Added $NODE_CORE") | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         // Add files_sharing: public, user, resharing | ||||||
|  |                         if (respCapabilities.has(NODE_FILES_SHARING)) { | ||||||
|  |                             val respFilesSharing = respCapabilities.getJSONObject(NODE_FILES_SHARING) | ||||||
|  |                             if (respFilesSharing.has(PROPERTY_API_ENABLED)) { | ||||||
|  |                                 capability.filesSharingApiEnabled = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respFilesSharing.getBoolean(PROPERTY_API_ENABLED) | ||||||
|  |                                 ) | ||||||
|  |                             } | ||||||
|  | 
 | ||||||
|  |                             if (respFilesSharing.has(NODE_PUBLIC)) { | ||||||
|  |                                 val respPublic = respFilesSharing.getJSONObject(NODE_PUBLIC) | ||||||
|  |                                 capability.filesSharingPublicEnabled = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respPublic.getBoolean(PROPERTY_ENABLED) | ||||||
|  |                                 ) | ||||||
|  | 
 | ||||||
|  |                                 if (respPublic.has(NODE_PASSWORD)) { | ||||||
|  |                                     val respPassword = respPublic.getJSONObject(NODE_PASSWORD) | ||||||
|  |                                     capability.filesSharingPublicPasswordEnforced = | ||||||
|  |                                         CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                             respPublic.getJSONObject(NODE_PASSWORD).getBoolean(PROPERTY_ENFORCED) | ||||||
|  |                                         ) | ||||||
|  | 
 | ||||||
|  |                                     if (respPassword.has(NODE_ENFORCED_FOR)) { | ||||||
|  |                                         capability.filesSharingPublicPasswordEnforcedReadOnly = | ||||||
|  |                                             CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                                 respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( | ||||||
|  |                                                     PROPERTY_ENFORCED_READ_ONLY | ||||||
|  |                                                 ) | ||||||
|  |                                             ) | ||||||
|  | 
 | ||||||
|  |                                         capability.filesSharingPublicPasswordEnforcedReadWrite = | ||||||
|  |                                             CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                                 respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( | ||||||
|  |                                                     PROPERTY_ENFORCED_READ_WRITE | ||||||
|  |                                                 ) | ||||||
|  |                                             ) | ||||||
|  | 
 | ||||||
|  |                                         capability.filesSharingPublicPasswordEnforcedUploadOnly = | ||||||
|  |                                             CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                                 respPassword.getJSONObject(NODE_ENFORCED_FOR).getBoolean( | ||||||
|  |                                                     PROPERTY_ENFORCED_UPLOAD_ONLY | ||||||
|  |                                                 ) | ||||||
|  |                                             ) | ||||||
|  |                                     } | ||||||
|  |                                 } | ||||||
|  |                                 if (respPublic.has(NODE_EXPIRE_DATE)) { | ||||||
|  |                                     val respExpireDate = respPublic.getJSONObject(NODE_EXPIRE_DATE) | ||||||
|  |                                     capability.filesSharingPublicExpireDateEnabled = | ||||||
|  |                                         CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                             respExpireDate.getBoolean(PROPERTY_ENABLED) | ||||||
|  |                                         ) | ||||||
|  |                                     if (respExpireDate.has(PROPERTY_DAYS)) { | ||||||
|  |                                         capability.filesSharingPublicExpireDateDays = | ||||||
|  |                                             respExpireDate.getInt(PROPERTY_DAYS) | ||||||
|  |                                     } | ||||||
|  |                                     if (respExpireDate.has(PROPERTY_ENFORCED)) { | ||||||
|  |                                         capability.filesSharingPublicExpireDateEnforced = | ||||||
|  |                                             CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                                 respExpireDate.getBoolean(PROPERTY_ENFORCED) | ||||||
|  |                                             ) | ||||||
|  |                                     } | ||||||
|  |                                 } | ||||||
|  |                                 if (respPublic.has(PROPERTY_UPLOAD)) { | ||||||
|  |                                     capability.filesSharingPublicUpload = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                         respPublic.getBoolean(PROPERTY_UPLOAD) | ||||||
|  |                                     ) | ||||||
|  |                                 } | ||||||
|  |                                 if (respPublic.has(PROPERTY_UPLOAD_ONLY)) { | ||||||
|  |                                     capability.filesSharingPublicSupportsUploadOnly = | ||||||
|  |                                         CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                             respPublic.getBoolean(PROPERTY_UPLOAD_ONLY) | ||||||
|  |                                         ) | ||||||
|  |                                 } | ||||||
|  |                                 if (respPublic.has(PROPERTY_MULTIPLE)) { | ||||||
|  |                                     capability.filesSharingPublicMultiple = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                         respPublic.getBoolean(PROPERTY_MULTIPLE) | ||||||
|  |                                     ) | ||||||
|  |                                 } | ||||||
|  |                             } | ||||||
|  | 
 | ||||||
|  |                             if (respFilesSharing.has(NODE_USER)) { | ||||||
|  |                                 val respUser = respFilesSharing.getJSONObject(NODE_USER) | ||||||
|  |                                 capability.filesSharingUserSendMail = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respUser.getBoolean(PROPERTY_SEND_MAIL) | ||||||
|  |                                 ) | ||||||
|  |                             } | ||||||
|  | 
 | ||||||
|  |                             capability.filesSharingResharing = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respFilesSharing.getBoolean(PROPERTY_RESHARING) | ||||||
|  |                             ) | ||||||
|  |                             if (respFilesSharing.has(NODE_FEDERATION)) { | ||||||
|  |                                 val respFederation = respFilesSharing.getJSONObject(NODE_FEDERATION) | ||||||
|  |                                 capability.filesSharingFederationOutgoing = | ||||||
|  |                                     CapabilityBooleanType.fromBooleanValue(respFederation.getBoolean(PROPERTY_OUTGOING)) | ||||||
|  |                                 capability.filesSharingFederationIncoming = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respFederation.getBoolean(PROPERTY_INCOMING) | ||||||
|  |                                 ) | ||||||
|  |                             } | ||||||
|  |                             Log_OC.d(TAG, "*** Added $NODE_FILES_SHARING") | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         if (respCapabilities.has(NODE_FILES)) { | ||||||
|  |                             val respFiles = respCapabilities.getJSONObject(NODE_FILES) | ||||||
|  |                             // Add files | ||||||
|  |                             capability.filesBigFileChuncking = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                 respFiles.getBoolean(PROPERTY_BIGFILECHUNKING) | ||||||
|  |                             ) | ||||||
|  |                             if (respFiles.has(PROPERTY_UNDELETE)) { | ||||||
|  |                                 capability.filesUndelete = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respFiles.getBoolean(PROPERTY_UNDELETE) | ||||||
|  |                                 ) | ||||||
|  |                             } | ||||||
|  |                             if (respFiles.has(PROPERTY_VERSIONING)) { | ||||||
|  |                                 capability.filesVersioning = CapabilityBooleanType.fromBooleanValue( | ||||||
|  |                                     respFiles.getBoolean(PROPERTY_VERSIONING) | ||||||
|  |                                 ) | ||||||
|  |                             } | ||||||
|  |                             Log_OC.d(TAG, "*** Added $NODE_FILES") | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  |                     // Result | ||||||
|  |                     result = RemoteOperationResult(OK) | ||||||
|  |                     result.data = capability | ||||||
|  | 
 | ||||||
|  |                     Log_OC.d(TAG, "*** Get Capabilities completed ") | ||||||
|  |                 } else { | ||||||
|  |                     result = RemoteOperationResult(statuscode, message, null) | ||||||
|  |                     Log_OC.e(TAG, "Failed response while getting capabilities from the server ") | ||||||
|  |                     Log_OC.e(TAG, "*** status: $statusProp; message: $message") | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |             } else { | ||||||
|  |                 result = RemoteOperationResult(getMethod) | ||||||
|  |                 Log_OC.e(TAG, "Failed response while getting capabilities from the server ") | ||||||
|  |                 if (response != null) { | ||||||
|  |                     Log_OC.e(TAG, "*** status code: $status; response message: $response") | ||||||
|  |                 } else { | ||||||
|  |                     Log_OC.e(TAG, "*** status code: $status") | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         } catch (e: Exception) { | ||||||
|  |             result = RemoteOperationResult(e) | ||||||
|  |             Log_OC.e(TAG, "Exception while getting capabilities", e) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return result | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private fun isSuccess(status: Int): Boolean { | ||||||
|  |         return status == HttpConstants.HTTP_OK | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     companion object { | ||||||
|  | 
 | ||||||
|  |         private val TAG = GetRemoteCapabilitiesOperation::class.java.simpleName | ||||||
|  | 
 | ||||||
|  |         // OCS Routes | ||||||
|  |         private val OCS_ROUTE = "ocs/v2.php/cloud/capabilities" | ||||||
|  | 
 | ||||||
|  |         // Arguments - names | ||||||
|  |         private val PARAM_FORMAT = "format" | ||||||
|  | 
 | ||||||
|  |         // Arguments - constant values | ||||||
|  |         private val VALUE_FORMAT = "json" | ||||||
|  | 
 | ||||||
|  |         // JSON Node names | ||||||
|  |         private val NODE_OCS = "ocs" | ||||||
|  | 
 | ||||||
|  |         private val NODE_META = "meta" | ||||||
|  | 
 | ||||||
|  |         private val NODE_DATA = "data" | ||||||
|  |         private val NODE_VERSION = "version" | ||||||
|  | 
 | ||||||
|  |         private val NODE_CAPABILITIES = "capabilities" | ||||||
|  |         private val NODE_CORE = "core" | ||||||
|  | 
 | ||||||
|  |         private val NODE_FILES_SHARING = "files_sharing" | ||||||
|  |         private val NODE_PUBLIC = "public" | ||||||
|  |         private val NODE_PASSWORD = "password" | ||||||
|  |         private val NODE_ENFORCED_FOR = "enforced_for" | ||||||
|  |         private val NODE_EXPIRE_DATE = "expire_date" | ||||||
|  |         private val NODE_USER = "user" | ||||||
|  |         private val NODE_FEDERATION = "federation" | ||||||
|  |         private val NODE_FILES = "files" | ||||||
|  | 
 | ||||||
|  |         private val PROPERTY_STATUS = "status" | ||||||
|  |         private val PROPERTY_STATUSCODE = "statuscode" | ||||||
|  |         private val PROPERTY_MESSAGE = "message" | ||||||
|  | 
 | ||||||
|  |         private val PROPERTY_POLLINTERVAL = "pollinterval" | ||||||
|  | 
 | ||||||
|  |         private val PROPERTY_MAJOR = "major" | ||||||
|  |         private val PROPERTY_MINOR = "minor" | ||||||
|  |         private val PROPERTY_MICRO = "micro" | ||||||
|  |         private val PROPERTY_STRING = "string" | ||||||
|  |         private val PROPERTY_EDITION = "edition" | ||||||
|  | 
 | ||||||
|  |         private val PROPERTY_API_ENABLED = "api_enabled" | ||||||
|  |         private val PROPERTY_ENABLED = "enabled" | ||||||
|  |         private val PROPERTY_ENFORCED = "enforced" | ||||||
|  |         private val PROPERTY_ENFORCED_READ_ONLY = "read_only" | ||||||
|  |         private val PROPERTY_ENFORCED_READ_WRITE = "read_write" | ||||||
|  |         private val PROPERTY_ENFORCED_UPLOAD_ONLY = "upload_only" | ||||||
|  |         private val PROPERTY_DAYS = "days" | ||||||
|  |         private val PROPERTY_SEND_MAIL = "send_mail" | ||||||
|  |         private val PROPERTY_UPLOAD = "upload" | ||||||
|  |         private val PROPERTY_UPLOAD_ONLY = "supports_upload_only" | ||||||
|  |         private val PROPERTY_MULTIPLE = "multiple" | ||||||
|  |         private val PROPERTY_RESHARING = "resharing" | ||||||
|  |         private val PROPERTY_OUTGOING = "outgoing" | ||||||
|  |         private val PROPERTY_INCOMING = "incoming" | ||||||
|  | 
 | ||||||
|  |         private val PROPERTY_BIGFILECHUNKING = "bigfilechunking" | ||||||
|  |         private val PROPERTY_UNDELETE = "undelete" | ||||||
|  |         private val PROPERTY_VERSIONING = "versioning" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -1,339 +0,0 @@ | |||||||
| /* ownCloud Android Library is available under MIT license |  | ||||||
|  *   @author masensio |  | ||||||
|  *   @author David González Verdugo |  | ||||||
|  *   Copyright (C) 2019 ownCloud GmbH. |  | ||||||
|  * |  | ||||||
|  *   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; |  | ||||||
| 
 |  | ||||||
| /** |  | ||||||
|  * Contains data of the Capabilities for an account, from the Capabilities API |  | ||||||
|  */ |  | ||||||
| public class OCCapability { |  | ||||||
| 
 |  | ||||||
|     private static final String TAG = OCCapability.class.getSimpleName(); |  | ||||||
| 
 |  | ||||||
|     private long mId; |  | ||||||
|     private String mAccountName; |  | ||||||
| 
 |  | ||||||
|     // Server version |  | ||||||
|     private int mVersionMayor; |  | ||||||
|     private int mVersionMinor; |  | ||||||
|     private int mVersionMicro; |  | ||||||
|     private String mVersionString; |  | ||||||
|     private String mVersionEdition; |  | ||||||
| 
 |  | ||||||
|     // Core PollInterval |  | ||||||
|     private int mCorePollinterval; |  | ||||||
| 
 |  | ||||||
|     // Files Sharing |  | ||||||
|     private CapabilityBooleanType mFilesSharingApiEnabled; |  | ||||||
| 
 |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicEnabled; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicPasswordEnforced; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicPasswordEnforcedReadOnly; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicPasswordEnforcedReadWrite; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicPasswordEnforcedUploadOnly; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicExpireDateEnabled; |  | ||||||
|     private int mFilesSharingPublicExpireDateDays; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicExpireDateEnforced; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicSendMail; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicUpload; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicMultiple; |  | ||||||
|     private CapabilityBooleanType mFilesSharingPublicSupportsUploadOnly; |  | ||||||
| 
 |  | ||||||
|     private CapabilityBooleanType mFilesSharingUserSendMail; |  | ||||||
| 
 |  | ||||||
|     private CapabilityBooleanType mFilesSharingResharing; |  | ||||||
| 
 |  | ||||||
|     private CapabilityBooleanType mFilesSharingFederationOutgoing; |  | ||||||
|     private CapabilityBooleanType mFilesSharingFederationIncoming; |  | ||||||
| 
 |  | ||||||
|     // Files |  | ||||||
|     private CapabilityBooleanType mFilesBigFileChuncking; |  | ||||||
|     private CapabilityBooleanType mFilesUndelete; |  | ||||||
|     private CapabilityBooleanType mFilesVersioning; |  | ||||||
| 
 |  | ||||||
|     public OCCapability() { |  | ||||||
|         mId = 0; |  | ||||||
|         mAccountName = ""; |  | ||||||
| 
 |  | ||||||
|         mVersionMayor = 0; |  | ||||||
|         mVersionMinor = 0; |  | ||||||
|         mVersionMicro = 0; |  | ||||||
|         mVersionString = ""; |  | ||||||
|         mVersionString = ""; |  | ||||||
| 
 |  | ||||||
|         mCorePollinterval = 0; |  | ||||||
| 
 |  | ||||||
|         mFilesSharingApiEnabled = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicEnabled = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicPasswordEnforced = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicPasswordEnforcedReadOnly = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicPasswordEnforcedReadWrite = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicPasswordEnforcedUploadOnly = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicExpireDateEnabled = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicExpireDateDays = 0; |  | ||||||
|         mFilesSharingPublicExpireDateEnforced = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicSendMail = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicUpload = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicMultiple = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingPublicSupportsUploadOnly = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingUserSendMail = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingResharing = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingFederationOutgoing = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesSharingFederationIncoming = CapabilityBooleanType.UNKNOWN; |  | ||||||
| 
 |  | ||||||
|         mFilesBigFileChuncking = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesUndelete = CapabilityBooleanType.UNKNOWN; |  | ||||||
|         mFilesVersioning = CapabilityBooleanType.UNKNOWN; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     // Getters and Setters |  | ||||||
|     public String getAccountName() { |  | ||||||
|         return mAccountName; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setAccountName(String accountName) { |  | ||||||
|         this.mAccountName = accountName; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public long getId() { |  | ||||||
|         return mId; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setId(long id) { |  | ||||||
|         this.mId = id; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public int getVersionMayor() { |  | ||||||
|         return mVersionMayor; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setVersionMayor(int versionMayor) { |  | ||||||
|         this.mVersionMayor = versionMayor; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public int getVersionMinor() { |  | ||||||
|         return mVersionMinor; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setVersionMinor(int versionMinor) { |  | ||||||
|         this.mVersionMinor = versionMinor; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public int getVersionMicro() { |  | ||||||
|         return mVersionMicro; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setVersionMicro(int versionMicro) { |  | ||||||
|         this.mVersionMicro = versionMicro; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public String getVersionString() { |  | ||||||
|         return mVersionString; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setVersionString(String versionString) { |  | ||||||
|         this.mVersionString = versionString; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public String getVersionEdition() { |  | ||||||
|         return mVersionEdition; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setVersionEdition(String versionEdition) { |  | ||||||
|         this.mVersionEdition = versionEdition; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public int getCorePollinterval() { |  | ||||||
|         return mCorePollinterval; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setCorePollinterval(int corePollinterval) { |  | ||||||
|         this.mCorePollinterval = corePollinterval; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingApiEnabled() { |  | ||||||
|         return mFilesSharingApiEnabled; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingApiEnabled(CapabilityBooleanType filesSharingApiEnabled) { |  | ||||||
|         this.mFilesSharingApiEnabled = filesSharingApiEnabled; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicEnabled() { |  | ||||||
|         return mFilesSharingPublicEnabled; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicEnabled(CapabilityBooleanType filesSharingPublicEnabled) { |  | ||||||
|         this.mFilesSharingPublicEnabled = filesSharingPublicEnabled; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicPasswordEnforced() { |  | ||||||
|         return mFilesSharingPublicPasswordEnforced; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicPasswordEnforced(CapabilityBooleanType filesSharingPublicPasswordEnforced) { |  | ||||||
|         this.mFilesSharingPublicPasswordEnforced = filesSharingPublicPasswordEnforced; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicPasswordEnforcedReadOnly() { |  | ||||||
|         return mFilesSharingPublicPasswordEnforcedReadOnly; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicPasswordEnforcedReadOnly( |  | ||||||
|             CapabilityBooleanType filesSharingPublicPasswordEnforcedReadOnly) { |  | ||||||
|         this.mFilesSharingPublicPasswordEnforcedReadOnly = filesSharingPublicPasswordEnforcedReadOnly; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicPasswordEnforcedReadWrite() { |  | ||||||
|         return mFilesSharingPublicPasswordEnforcedReadWrite; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicPasswordEnforcedReadWrite( |  | ||||||
|             CapabilityBooleanType filesSharingPublicPasswordEnforcedReadWrite) { |  | ||||||
|         this.mFilesSharingPublicPasswordEnforcedReadWrite = filesSharingPublicPasswordEnforcedReadWrite; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicPasswordEnforcedUploadOnly() { |  | ||||||
|         return mFilesSharingPublicPasswordEnforcedUploadOnly; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicPasswordEnforcedUploadOnly( |  | ||||||
|             CapabilityBooleanType filesSharingPublicPasswordEnforcedUploadOnly) { |  | ||||||
|         this.mFilesSharingPublicPasswordEnforcedUploadOnly = filesSharingPublicPasswordEnforcedUploadOnly; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicExpireDateEnabled() { |  | ||||||
|         return mFilesSharingPublicExpireDateEnabled; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicExpireDateEnabled(CapabilityBooleanType filesSharingPublicExpireDateEnabled) { |  | ||||||
|         this.mFilesSharingPublicExpireDateEnabled = filesSharingPublicExpireDateEnabled; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public int getFilesSharingPublicExpireDateDays() { |  | ||||||
|         return mFilesSharingPublicExpireDateDays; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicExpireDateDays(int filesSharingPublicExpireDateDays) { |  | ||||||
|         this.mFilesSharingPublicExpireDateDays = filesSharingPublicExpireDateDays; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicExpireDateEnforced() { |  | ||||||
|         return mFilesSharingPublicExpireDateEnforced; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicExpireDateEnforced(CapabilityBooleanType filesSharingPublicExpireDateEnforced) { |  | ||||||
|         this.mFilesSharingPublicExpireDateEnforced = filesSharingPublicExpireDateEnforced; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicSendMail() { |  | ||||||
|         return mFilesSharingPublicSendMail; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicSendMail(CapabilityBooleanType filesSharingPublicSendMail) { |  | ||||||
|         this.mFilesSharingPublicSendMail = filesSharingPublicSendMail; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicUpload() { |  | ||||||
|         return mFilesSharingPublicUpload; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicUpload(CapabilityBooleanType filesSharingPublicUpload) { |  | ||||||
|         this.mFilesSharingPublicUpload = filesSharingPublicUpload; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicMultiple() { |  | ||||||
|         return mFilesSharingPublicMultiple; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicMultiple(CapabilityBooleanType filesSharingPublicMultiple) { |  | ||||||
|         this.mFilesSharingPublicMultiple = filesSharingPublicMultiple; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingPublicSupportsUploadOnly() { |  | ||||||
|         return mFilesSharingPublicSupportsUploadOnly; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingPublicSupportsUploadOnly(CapabilityBooleanType |  | ||||||
|                                                                 filesSharingPublicMultiple) { |  | ||||||
|         this.mFilesSharingPublicSupportsUploadOnly = filesSharingPublicMultiple; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingUserSendMail() { |  | ||||||
|         return mFilesSharingUserSendMail; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingUserSendMail(CapabilityBooleanType filesSharingUserSendMail) { |  | ||||||
|         this.mFilesSharingUserSendMail = filesSharingUserSendMail; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingResharing() { |  | ||||||
|         return mFilesSharingResharing; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingResharing(CapabilityBooleanType filesSharingResharing) { |  | ||||||
|         this.mFilesSharingResharing = filesSharingResharing; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingFederationOutgoing() { |  | ||||||
|         return mFilesSharingFederationOutgoing; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingFederationOutgoing(CapabilityBooleanType filesSharingFederationOutgoing) { |  | ||||||
|         this.mFilesSharingFederationOutgoing = filesSharingFederationOutgoing; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesSharingFederationIncoming() { |  | ||||||
|         return mFilesSharingFederationIncoming; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesSharingFederationIncoming(CapabilityBooleanType filesSharingFederationIncoming) { |  | ||||||
|         this.mFilesSharingFederationIncoming = filesSharingFederationIncoming; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesBigFileChuncking() { |  | ||||||
|         return mFilesBigFileChuncking; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesBigFileChuncking(CapabilityBooleanType filesBigFileChuncking) { |  | ||||||
|         this.mFilesBigFileChuncking = filesBigFileChuncking; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesUndelete() { |  | ||||||
|         return mFilesUndelete; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesUndelete(CapabilityBooleanType filesUndelete) { |  | ||||||
|         this.mFilesUndelete = filesUndelete; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public CapabilityBooleanType getFilesVersioning() { |  | ||||||
|         return mFilesVersioning; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void setFilesVersioning(CapabilityBooleanType filesVersioning) { |  | ||||||
|         this.mFilesVersioning = filesVersioning; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -0,0 +1,105 @@ | |||||||
|  | /* ownCloud Android Library is available under MIT license | ||||||
|  |  *   @author masensio | ||||||
|  |  *   @author David González Verdugo | ||||||
|  |  *   Copyright (C) 2019 ownCloud GmbH. | ||||||
|  |  * | ||||||
|  |  *   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 | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Contains data of the Capabilities for an account, from the Capabilities API | ||||||
|  |  */ | ||||||
|  | class RemoteCapability { | ||||||
|  |     var accountName: String? = null | ||||||
|  | 
 | ||||||
|  |     // Server version | ||||||
|  |     var versionMayor: Int = 0 | ||||||
|  |     var versionMinor: Int = 0 | ||||||
|  |     var versionMicro: Int = 0 | ||||||
|  |     var versionString: String? = null | ||||||
|  |     var versionEdition: String? = null | ||||||
|  | 
 | ||||||
|  |     // Core PollInterval | ||||||
|  |     var corePollinterval: Int = 0 | ||||||
|  | 
 | ||||||
|  |     // Files Sharing | ||||||
|  |     var filesSharingApiEnabled: CapabilityBooleanType? = null | ||||||
|  | 
 | ||||||
|  |     var filesSharingPublicEnabled: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicPasswordEnforced: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicPasswordEnforcedReadOnly: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicPasswordEnforcedReadWrite: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicPasswordEnforcedUploadOnly: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicExpireDateEnabled: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicExpireDateDays: Int = 0 | ||||||
|  |     var filesSharingPublicExpireDateEnforced: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicSendMail: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicUpload: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicMultiple: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingPublicSupportsUploadOnly: CapabilityBooleanType? = null | ||||||
|  | 
 | ||||||
|  |     var filesSharingUserSendMail: CapabilityBooleanType? = null | ||||||
|  | 
 | ||||||
|  |     var filesSharingResharing: CapabilityBooleanType? = null | ||||||
|  | 
 | ||||||
|  |     var filesSharingFederationOutgoing: CapabilityBooleanType? = null | ||||||
|  |     var filesSharingFederationIncoming: CapabilityBooleanType? = null | ||||||
|  | 
 | ||||||
|  |     // Files | ||||||
|  |     var filesBigFileChuncking: CapabilityBooleanType? = null | ||||||
|  |     var filesUndelete: CapabilityBooleanType? = null | ||||||
|  |     var filesVersioning: CapabilityBooleanType? = null | ||||||
|  | 
 | ||||||
|  |     init { | ||||||
|  |         accountName = "" | ||||||
|  | 
 | ||||||
|  |         versionMayor = 0 | ||||||
|  |         versionMinor = 0 | ||||||
|  |         versionMicro = 0 | ||||||
|  |         versionString = "" | ||||||
|  |         versionString = "" | ||||||
|  | 
 | ||||||
|  |         corePollinterval = 0 | ||||||
|  | 
 | ||||||
|  |         filesSharingApiEnabled = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicEnabled = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicPasswordEnforced = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicPasswordEnforcedReadOnly = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicPasswordEnforcedReadWrite = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicPasswordEnforcedUploadOnly = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicExpireDateEnabled = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicExpireDateDays = 0 | ||||||
|  |         filesSharingPublicExpireDateEnforced = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicSendMail = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicUpload = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicMultiple = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingPublicSupportsUploadOnly = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingUserSendMail = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingResharing = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingFederationOutgoing = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesSharingFederationIncoming = CapabilityBooleanType.UNKNOWN | ||||||
|  | 
 | ||||||
|  |         filesBigFileChuncking = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesUndelete = CapabilityBooleanType.UNKNOWN | ||||||
|  |         filesVersioning = CapabilityBooleanType.UNKNOWN | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user