mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-28 17:07:49 +00:00 
			
		
		
		
	Merge pull request #31 from owncloud/see_files_shared_with_me
Process extra properties oc:permissions and oc:id
This commit is contained in:
		
						commit
						48d43b576c
					
				| @ -30,18 +30,20 @@ import org.apache.jackrabbit.webdav.MultiStatusResponse; | |||||||
| import org.apache.jackrabbit.webdav.property.DavProperty; | import org.apache.jackrabbit.webdav.property.DavProperty; | ||||||
| import org.apache.jackrabbit.webdav.property.DavPropertyName; | import org.apache.jackrabbit.webdav.property.DavPropertyName; | ||||||
| import org.apache.jackrabbit.webdav.property.DavPropertySet; | import org.apache.jackrabbit.webdav.property.DavPropertySet; | ||||||
| 
 | import org.apache.jackrabbit.webdav.xml.Namespace; | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| import android.net.Uri; | import android.net.Uri; | ||||||
| import android.util.Log; | import android.util.Log; | ||||||
| 
 | 
 | ||||||
| public class WebdavEntry { | public class WebdavEntry { | ||||||
|     private String mName, mPath, mUri, mContentType, mEtag; | 	private static final String NAMESPACE_OC = "http://owncloud.org/ns"; | ||||||
|     private long mContentLength, mCreateTimestamp, mModifiedTimestamp; | 	private static final String EXTENDED_PROPERTY_NAME_PERMISSIONS = "permissions"; | ||||||
|  | 	private static final String EXTENDED_PROPERTY_NAME_REMOTE_ID = "id"; | ||||||
| 
 | 
 | ||||||
|     public WebdavEntry(MultiStatusResponse ms, String splitElement) { | 	private String mName, mPath, mUri, mContentType, mEtag, mPermissions, mRemoteId; | ||||||
|  | 	private long mContentLength, mCreateTimestamp, mModifiedTimestamp; | ||||||
|  | 
 | ||||||
|  | 	public WebdavEntry(MultiStatusResponse ms, String splitElement) { | ||||||
|         resetData(); |         resetData(); | ||||||
|         if (ms.getStatus().length != 0) { |         if (ms.getStatus().length != 0) { | ||||||
|             mUri = ms.getHref(); |             mUri = ms.getHref(); | ||||||
| @ -106,6 +108,22 @@ public class WebdavEntry { | |||||||
|                 mEtag = mEtag.substring(1, mEtag.length()-1); |                 mEtag = mEtag.substring(1, mEtag.length()-1); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |             // OC permissions property <oc:permissions> | ||||||
|  |             prop = propSet.get( | ||||||
|  |             		EXTENDED_PROPERTY_NAME_PERMISSIONS, Namespace.getNamespace(NAMESPACE_OC) | ||||||
|  |     		); | ||||||
|  |             if (prop != null) { | ||||||
|  |                 mPermissions = prop.getValue().toString(); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             // OC remote id property <oc:id> | ||||||
|  |             prop = propSet.get( | ||||||
|  |             		EXTENDED_PROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(NAMESPACE_OC) | ||||||
|  |     		); | ||||||
|  |             if (prop != null) { | ||||||
|  |                 mRemoteId = prop.getValue().toString(); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|         } else { |         } else { | ||||||
|             Log.e("WebdavEntry", |             Log.e("WebdavEntry", | ||||||
|                     "General fuckup, no status for webdav response"); |                     "General fuckup, no status for webdav response"); | ||||||
| @ -152,8 +170,16 @@ public class WebdavEntry { | |||||||
|         return mEtag; |         return mEtag; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public String permissions() { | ||||||
|  |         return mPermissions; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String remoteId() { | ||||||
|  |         return mRemoteId; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private void resetData() { |     private void resetData() { | ||||||
|         mName = mUri = mContentType = null; |         mName = mUri = mContentType = mPermissions = null; mRemoteId = null; | ||||||
|         mContentLength = mCreateTimestamp = mModifiedTimestamp = 0; |         mContentLength = mCreateTimestamp = mModifiedTimestamp = 0; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -163,6 +163,8 @@ public class ReadRemoteFolderOperation extends RemoteOperation { | |||||||
|         file.setMimeType(we.contentType()); |         file.setMimeType(we.contentType()); | ||||||
|         file.setModifiedTimestamp(we.modifiedTimestamp()); |         file.setModifiedTimestamp(we.modifiedTimestamp()); | ||||||
|         file.setEtag(we.etag()); |         file.setEtag(we.etag()); | ||||||
|  |         file.setPermissions(we.permissions()); | ||||||
|  |         file.setRemoteId(we.remoteId()); | ||||||
|         return file; |         return file; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -48,7 +48,9 @@ public class RemoteFile implements Parcelable, Serializable { | |||||||
| 	private long mCreationTimestamp; | 	private long mCreationTimestamp; | ||||||
| 	private long mModifiedTimestamp; | 	private long mModifiedTimestamp; | ||||||
| 	private String mEtag; | 	private String mEtag; | ||||||
| 	 | 	private String mPermissions; | ||||||
|  | 	private String mRemoteId; | ||||||
|  | 
 | ||||||
| 	/**  | 	/**  | ||||||
| 	 * Getters and Setters | 	 * Getters and Setters | ||||||
| 	 */ | 	 */ | ||||||
| @ -101,6 +103,22 @@ public class RemoteFile implements Parcelable, Serializable { | |||||||
| 		this.mEtag = etag; | 		this.mEtag = etag; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	public String getPermissions() { | ||||||
|  | 		return mPermissions; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public void setPermissions(String permissions) { | ||||||
|  | 		this.mPermissions = permissions; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public String getRemoteId() { | ||||||
|  | 		return mRemoteId; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public void setRemoteId(String remoteId) { | ||||||
|  | 		this.mRemoteId = remoteId; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	public RemoteFile() { | 	public RemoteFile() { | ||||||
| 		resetData(); | 		resetData(); | ||||||
| 	} | 	} | ||||||
| @ -127,6 +145,8 @@ public class RemoteFile implements Parcelable, Serializable { | |||||||
|         this.setMimeType(we.contentType()); |         this.setMimeType(we.contentType()); | ||||||
|         this.setModifiedTimestamp(we.modifiedTimestamp()); |         this.setModifiedTimestamp(we.modifiedTimestamp()); | ||||||
|         this.setEtag(we.etag()); |         this.setEtag(we.etag()); | ||||||
|  |         this.setPermissions(we.permissions()); | ||||||
|  |         this.setRemoteId(we.remoteId()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
| @ -139,6 +159,8 @@ public class RemoteFile implements Parcelable, Serializable { | |||||||
|         mCreationTimestamp = 0; |         mCreationTimestamp = 0; | ||||||
|         mModifiedTimestamp = 0; |         mModifiedTimestamp = 0; | ||||||
|         mEtag = null; |         mEtag = null; | ||||||
|  |         mPermissions = null; | ||||||
|  |         mRemoteId = null; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /**  |     /**  | ||||||
| @ -173,6 +195,8 @@ public class RemoteFile implements Parcelable, Serializable { | |||||||
|         mCreationTimestamp = source.readLong(); |         mCreationTimestamp = source.readLong(); | ||||||
|         mModifiedTimestamp = source.readLong(); |         mModifiedTimestamp = source.readLong(); | ||||||
|         mEtag = source.readString(); |         mEtag = source.readString(); | ||||||
|  |         mPermissions= source.readString(); | ||||||
|  |         mRemoteId = source.readString(); | ||||||
|     } |     } | ||||||
|      |      | ||||||
| 	@Override | 	@Override | ||||||
| @ -187,7 +211,9 @@ public class RemoteFile implements Parcelable, Serializable { | |||||||
| 		dest.writeLong(mLength); | 		dest.writeLong(mLength); | ||||||
| 		dest.writeLong(mCreationTimestamp); | 		dest.writeLong(mCreationTimestamp); | ||||||
| 		dest.writeLong(mModifiedTimestamp); | 		dest.writeLong(mModifiedTimestamp); | ||||||
| 		dest.writeString(mEtag);		 | 		dest.writeString(mEtag); | ||||||
|  | 		dest.writeString(mPermissions); | ||||||
|  | 		dest.writeString(mRemoteId); | ||||||
| 	} | 	} | ||||||
|      |      | ||||||
|      |      | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user