package com.owncloud.android.datamodel;
+import com.owncloud.android.oc_framework.operations.ShareRemoteFile;
import com.owncloud.android.oc_framework.operations.ShareType;
import com.owncloud.android.utils.Log_OC;
mPath = path;
}
+ public OCShare(ShareRemoteFile remoteFile) {
+ mId = -1;
+
+ String path = remoteFile.getPath();
+ if (path == null || path.length() <= 0 || !path.startsWith(OCFile.PATH_SEPARATOR)) {
+ Log_OC.e(TAG, "Trying to create a OCShare with a non valid path");
+ throw new IllegalArgumentException("Trying to create a OCShare with a non valid path: " + path);
+ }
+ mPath = path;
+
+ mFileSource = remoteFile.getFileSource();
+ mItemSource = remoteFile.getItemSource();
+ mShareType = remoteFile.getShareType();
+ mShareWith = remoteFile.getShareWith();
+ mPermissions = remoteFile.getPermissions();
+ mSharedDate = remoteFile.getSharedDate();
+ mExpirationDate = remoteFile.getExpirationDate();
+ mToken = remoteFile.getToken();
+ mSharedWithDisplayName = remoteFile.getSharedWithDisplayName();
+ mIsDirectory = remoteFile.isDirectory();
+ mUserId = remoteFile.getUserId();
+ mIdRemoteShared = remoteFile.getIdRemoteShared();
+ }
+
/**
* Used internally. Reset all file properties
*/
public long getId() {
return mId;
}
+
+ public void setId(long id){
+ mId = id;
+ }
/**
* Parcelable Methods
dest.writeLong(mUserId);
dest.writeLong(mIdRemoteShared);
}
-
}