OCFile.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. /*
  2. * ownCloud Android client application
  3. *
  4. * @author Bartek Przybylski
  5. * @author David A. Velasco
  6. * Copyright (C) 2012 Bartek Przybylski
  7. * Copyright (C) 2016 ownCloud Inc.
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. package com.owncloud.android.datamodel;
  23. import android.content.ContentResolver;
  24. import android.content.Context;
  25. import android.net.Uri;
  26. import android.os.Parcel;
  27. import android.os.Parcelable;
  28. import android.text.TextUtils;
  29. import com.owncloud.android.R;
  30. import com.owncloud.android.lib.common.network.WebdavEntry;
  31. import com.owncloud.android.lib.common.network.WebdavUtils;
  32. import com.owncloud.android.lib.common.utils.Log_OC;
  33. import com.owncloud.android.lib.resources.files.model.ServerFileInterface;
  34. import com.owncloud.android.lib.resources.shares.ShareeUser;
  35. import com.owncloud.android.utils.MimeType;
  36. import java.io.File;
  37. import java.util.List;
  38. import androidx.annotation.NonNull;
  39. import androidx.annotation.VisibleForTesting;
  40. import androidx.core.content.FileProvider;
  41. import third_parties.daveKoeller.AlphanumComparator;
  42. public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterface {
  43. private final static String PERMISSION_SHARED_WITH_ME = "S";
  44. @VisibleForTesting
  45. public final static String PERMISSION_CAN_RESHARE = "R";
  46. private final static String PERMISSION_CAN_WRITE = "CK";
  47. public static final String PATH_SEPARATOR = "/";
  48. public static final String ROOT_PATH = PATH_SEPARATOR;
  49. private static final String TAG = OCFile.class.getSimpleName();
  50. private long fileId; // android internal ID of the file
  51. private long parentId;
  52. private long fileLength;
  53. private long creationTimestamp; // UNIX timestamp of the time the file was created
  54. private long modificationTimestamp; // UNIX timestamp of the file modification time
  55. private long uploadTimestamp;
  56. /**
  57. * UNIX timestamp of the modification time, corresponding to the value returned by the server in the last
  58. * synchronization of THE CONTENTS of this file.
  59. */
  60. private long modificationTimestampAtLastSyncForData;
  61. private String remotePath;
  62. private String decryptedRemotePath;
  63. private String localPath;
  64. private String mimeType;
  65. private boolean needsUpdatingWhileSaving;
  66. private long lastSyncDateForProperties;
  67. private long lastSyncDateForData;
  68. private boolean previewAvailable;
  69. private String etag;
  70. private String etagOnServer;
  71. private boolean sharedViaLink;
  72. private String permissions;
  73. private String remoteId; // The fileid namespaced by the instance fileId, globally unique
  74. private boolean updateThumbnailNeeded;
  75. private boolean downloading;
  76. private String etagInConflict; // Only saves file etag in the server, when there is a conflict
  77. private boolean sharedWithSharee;
  78. private boolean favorite;
  79. private boolean encrypted;
  80. private WebdavEntry.MountType mountType;
  81. private int unreadCommentsCount;
  82. private String ownerId;
  83. private String ownerDisplayName;
  84. String note;
  85. private List<ShareeUser> sharees;
  86. private String richWorkspace;
  87. /**
  88. * URI to the local path of the file contents, if stored in the device; cached after first call
  89. * to {@link #getStorageUri()}
  90. */
  91. private Uri localUri;
  92. /**
  93. * Exportable URI to the local path of the file contents, if stored in the device.
  94. * <p>
  95. * Cached after first call, until changed.
  96. */
  97. private Uri exposedFileUri;
  98. /**
  99. * Create new {@link OCFile} with given path.
  100. * <p>
  101. * The path received must be URL-decoded. Path separator must be OCFile.PATH_SEPARATOR, and it must be the first character in 'path'.
  102. *
  103. * @param path The remote path of the file.
  104. */
  105. public OCFile(String path) {
  106. resetData();
  107. needsUpdatingWhileSaving = false;
  108. if (TextUtils.isEmpty(path) || !path.startsWith(PATH_SEPARATOR)) {
  109. throw new IllegalArgumentException("Trying to create a OCFile with a non valid remote path: " + path);
  110. }
  111. remotePath = path;
  112. }
  113. /**
  114. * Reconstruct from parcel
  115. *
  116. * @param source The source parcel
  117. */
  118. private OCFile(Parcel source) {
  119. fileId = source.readLong();
  120. parentId = source.readLong();
  121. fileLength = source.readLong();
  122. creationTimestamp = source.readLong();
  123. modificationTimestamp = source.readLong();
  124. modificationTimestampAtLastSyncForData = source.readLong();
  125. remotePath = source.readString();
  126. decryptedRemotePath = source.readString();
  127. localPath = source.readString();
  128. mimeType = source.readString();
  129. needsUpdatingWhileSaving = source.readInt() == 0;
  130. lastSyncDateForProperties = source.readLong();
  131. lastSyncDateForData = source.readLong();
  132. etag = source.readString();
  133. etagOnServer = source.readString();
  134. sharedViaLink = source.readInt() == 1;
  135. permissions = source.readString();
  136. remoteId = source.readString();
  137. updateThumbnailNeeded = source.readInt() == 1;
  138. downloading = source.readInt() == 1;
  139. etagInConflict = source.readString();
  140. sharedWithSharee = source.readInt() == 1;
  141. favorite = source.readInt() == 1;
  142. encrypted = source.readInt() == 1;
  143. ownerId = source.readString();
  144. ownerDisplayName = source.readString();
  145. mountType = (WebdavEntry.MountType) source.readSerializable();
  146. richWorkspace = source.readString();
  147. previewAvailable = source.readInt() == 1;
  148. }
  149. @Override
  150. public void writeToParcel(Parcel dest, int flags) {
  151. dest.writeLong(fileId);
  152. dest.writeLong(parentId);
  153. dest.writeLong(fileLength);
  154. dest.writeLong(creationTimestamp);
  155. dest.writeLong(modificationTimestamp);
  156. dest.writeLong(modificationTimestampAtLastSyncForData);
  157. dest.writeString(remotePath);
  158. dest.writeString(decryptedRemotePath);
  159. dest.writeString(localPath);
  160. dest.writeString(mimeType);
  161. dest.writeInt(needsUpdatingWhileSaving ? 1 : 0);
  162. dest.writeLong(lastSyncDateForProperties);
  163. dest.writeLong(lastSyncDateForData);
  164. dest.writeString(etag);
  165. dest.writeString(etagOnServer);
  166. dest.writeInt(sharedViaLink ? 1 : 0);
  167. dest.writeString(permissions);
  168. dest.writeString(remoteId);
  169. dest.writeInt(updateThumbnailNeeded ? 1 : 0);
  170. dest.writeInt(downloading ? 1 : 0);
  171. dest.writeString(etagInConflict);
  172. dest.writeInt(sharedWithSharee ? 1 : 0);
  173. dest.writeInt(favorite ? 1 : 0);
  174. dest.writeInt(encrypted ? 1 : 0);
  175. dest.writeString(ownerId);
  176. dest.writeString(ownerDisplayName);
  177. dest.writeSerializable(mountType);
  178. dest.writeString(richWorkspace);
  179. dest.writeInt(previewAvailable ? 1 : 0);
  180. }
  181. public void setDecryptedRemotePath(String path) {
  182. decryptedRemotePath = path;
  183. }
  184. /**
  185. * Use decrypted remote path for every local file operation Use encrypted remote path for every dav related
  186. * operation
  187. */
  188. public String getDecryptedRemotePath() {
  189. // Fallback
  190. // TODO test without, on a new created folder
  191. if (!isEncrypted() && decryptedRemotePath == null) {
  192. decryptedRemotePath = remotePath;
  193. }
  194. if (isFolder()) {
  195. if (decryptedRemotePath.endsWith(PATH_SEPARATOR)) {
  196. return decryptedRemotePath;
  197. } else {
  198. return decryptedRemotePath + PATH_SEPARATOR;
  199. }
  200. } else {
  201. if (decryptedRemotePath == null) {
  202. // last fallback
  203. return remotePath;
  204. } else {
  205. return decryptedRemotePath;
  206. }
  207. }
  208. }
  209. /**
  210. * Returns the remote path of the file on Nextcloud
  211. * (this might be an encrypted file path, if E2E is used)
  212. * <p>
  213. * Use decrypted remote path for every local file operation.
  214. * Use remote path for every dav related operation
  215. *
  216. * @return The remote path to the file
  217. */
  218. public String getRemotePath() {
  219. if (isFolder()) {
  220. if (remotePath.endsWith(PATH_SEPARATOR)) {
  221. return remotePath;
  222. } else {
  223. return remotePath + PATH_SEPARATOR;
  224. }
  225. } else {
  226. return remotePath;
  227. }
  228. }
  229. /**
  230. * Can be used to check, whether or not this file exists in the database
  231. * already
  232. *
  233. * @return true, if the file exists in the database
  234. */
  235. public boolean fileExists() {
  236. return fileId != -1;
  237. }
  238. /**
  239. * Use this to find out if this file is a folder.
  240. *
  241. * @return true if it is a folder
  242. */
  243. public boolean isFolder() {
  244. return MimeType.DIRECTORY.equals(mimeType) || MimeType.WEBDAV_FOLDER.equals(mimeType);
  245. }
  246. /**
  247. * Sets mimetype to folder and returns this file
  248. * Only for testing
  249. *
  250. * @return OCFile this file
  251. */
  252. public OCFile setFolder() {
  253. setMimeType(MimeType.DIRECTORY);
  254. return this;
  255. }
  256. /**
  257. * Use this to check if this file is available locally
  258. *
  259. * @return true if it is
  260. */
  261. public boolean isDown() {
  262. return !isFolder() && existsOnDevice();
  263. }
  264. /**
  265. * Use this to check if this file or folder is available locally
  266. *
  267. * @return true if it is
  268. */
  269. public boolean existsOnDevice() {
  270. if (!TextUtils.isEmpty(localPath)) {
  271. return new File(localPath).exists();
  272. }
  273. return false;
  274. }
  275. /**
  276. * The path, where the file is stored locally
  277. *
  278. * @return The local path to the file
  279. */
  280. public String getStoragePath() {
  281. return localPath;
  282. }
  283. /**
  284. * The URI to the file contents, if stored locally
  285. *
  286. * @return A URI to the local copy of the file, or NULL if not stored in the device
  287. */
  288. public Uri getStorageUri() {
  289. if (TextUtils.isEmpty(localPath)) {
  290. return null;
  291. }
  292. if (localUri == null) {
  293. Uri.Builder builder = new Uri.Builder();
  294. builder.scheme(ContentResolver.SCHEME_FILE);
  295. builder.path(localPath);
  296. localUri = builder.build();
  297. }
  298. return localUri;
  299. }
  300. public Uri getLegacyExposedFileUri() {
  301. if (TextUtils.isEmpty(localPath)) {
  302. return null;
  303. }
  304. if (exposedFileUri == null) {
  305. return Uri.parse(ContentResolver.SCHEME_FILE + "://" + WebdavUtils.encodePath(localPath));
  306. }
  307. return exposedFileUri;
  308. }
  309. /*
  310. Partly disabled because not all apps understand paths that we get via this method for now
  311. */
  312. public Uri getExposedFileUri(Context context) {
  313. if (TextUtils.isEmpty(localPath)) {
  314. return null;
  315. }
  316. if (exposedFileUri == null) {
  317. try {
  318. exposedFileUri = FileProvider.getUriForFile(
  319. context,
  320. context.getString(R.string.file_provider_authority),
  321. new File(localPath));
  322. } catch (IllegalArgumentException ex) {
  323. // Could not share file using FileProvider URI scheme.
  324. // Fall back to legacy URI parsing.
  325. getLegacyExposedFileUri();
  326. }
  327. }
  328. return exposedFileUri;
  329. }
  330. /**
  331. * Can be used to set the path where the file is stored
  332. *
  333. * @param storage_path to set
  334. */
  335. public void setStoragePath(String storage_path) {
  336. if (storage_path == null) {
  337. localPath = null;
  338. } else {
  339. localPath = storage_path.replaceAll("//", "/");
  340. }
  341. localUri = null;
  342. exposedFileUri = null;
  343. }
  344. /**
  345. * Returns the decrypted filename and "/" for the root directory
  346. *
  347. * @return The name of the file
  348. */
  349. public String getFileName() {
  350. return getDecryptedFileName();
  351. }
  352. /**
  353. * Returns the decrypted filename and "/" for the root directory
  354. *
  355. * @return The name of the file
  356. */
  357. public String getDecryptedFileName() {
  358. File f = new File(getDecryptedRemotePath());
  359. return f.getName().length() == 0 ? ROOT_PATH : f.getName();
  360. }
  361. /**
  362. * Returns the encrypted filename and "/" for the root directory
  363. *
  364. * @return The name of the file
  365. */
  366. public String getEncryptedFileName() {
  367. File f = new File(remotePath);
  368. return f.getName().length() == 0 ? ROOT_PATH : f.getName();
  369. }
  370. /**
  371. * Sets the name of the file
  372. * <p/>
  373. * Does nothing if the new name is null, empty or includes "/" ; or if the file is the root
  374. * directory
  375. */
  376. public void setFileName(String name) {
  377. Log_OC.d(TAG, "OCFile name changing from " + remotePath);
  378. if (!TextUtils.isEmpty(name) && !name.contains(PATH_SEPARATOR) && !ROOT_PATH.equals(remotePath)) {
  379. String parent = new File(this.getRemotePath()).getParent();
  380. parent = parent.endsWith(PATH_SEPARATOR) ? parent : parent + PATH_SEPARATOR;
  381. remotePath = parent + name;
  382. if (isFolder()) {
  383. remotePath += PATH_SEPARATOR;
  384. }
  385. Log_OC.d(TAG, "OCFile name changed to " + remotePath);
  386. }
  387. }
  388. /**
  389. * Used internally. Reset all file properties
  390. */
  391. private void resetData() {
  392. fileId = -1;
  393. remotePath = null;
  394. decryptedRemotePath = null;
  395. parentId = 0;
  396. localPath = null;
  397. mimeType = null;
  398. fileLength = 0;
  399. creationTimestamp = 0;
  400. modificationTimestamp = 0;
  401. modificationTimestampAtLastSyncForData = 0;
  402. lastSyncDateForProperties = 0;
  403. lastSyncDateForData = 0;
  404. needsUpdatingWhileSaving = false;
  405. etag = null;
  406. etagOnServer = null;
  407. sharedViaLink = false;
  408. permissions = null;
  409. remoteId = null;
  410. updateThumbnailNeeded = false;
  411. downloading = false;
  412. etagInConflict = null;
  413. sharedWithSharee = false;
  414. favorite = false;
  415. encrypted = false;
  416. mountType = WebdavEntry.MountType.INTERNAL;
  417. richWorkspace = "";
  418. }
  419. /**
  420. * get remote path of parent file
  421. *
  422. * @return remote path
  423. */
  424. public String getParentRemotePath() {
  425. String parentPath = new File(this.getRemotePath()).getParent();
  426. return parentPath.endsWith(PATH_SEPARATOR) ? parentPath : parentPath + PATH_SEPARATOR;
  427. }
  428. @Override
  429. public int describeContents() {
  430. return super.hashCode();
  431. }
  432. @Override
  433. public int compareTo(@NonNull OCFile another) {
  434. if (isFolder() && another.isFolder()) {
  435. return AlphanumComparator.compare(this, another);
  436. } else if (isFolder()) {
  437. return -1;
  438. } else if (another.isFolder()) {
  439. return 1;
  440. }
  441. return AlphanumComparator.compare(this, another);
  442. }
  443. @Override
  444. public boolean equals(Object o) {
  445. if (this == o) {
  446. return true;
  447. }
  448. if (o == null || getClass() != o.getClass()) {
  449. return false;
  450. }
  451. OCFile ocFile = (OCFile) o;
  452. return fileId == ocFile.fileId && parentId == ocFile.parentId;
  453. }
  454. @Override
  455. public int hashCode() {
  456. return 31 * (int) (fileId ^ (fileId >>> 32)) + (int) (parentId ^ (parentId >>> 32));
  457. }
  458. @NonNull
  459. @Override
  460. public String toString() {
  461. String asString = "[id=%s, name=%s, mime=%s, downloaded=%s, local=%s, remote=%s, " +
  462. "parentId=%s, etag=%s, favourite=%s]";
  463. return String.format(asString,
  464. fileId,
  465. getFileName(),
  466. mimeType,
  467. isDown(),
  468. localPath,
  469. remotePath,
  470. parentId,
  471. etag,
  472. favorite);
  473. }
  474. public void setEtag(String etag) {
  475. this.etag = etag != null ? etag : "";
  476. }
  477. public void setEtagOnServer(String etag) {
  478. this.etagOnServer = etag != null ? etag : "";
  479. }
  480. public long getLocalModificationTimestamp() {
  481. if (!TextUtils.isEmpty(localPath)) {
  482. File f = new File(localPath);
  483. return f.lastModified();
  484. }
  485. return 0;
  486. }
  487. /**
  488. * @return 'True' if the file is hidden
  489. */
  490. public boolean isHidden() {
  491. return !TextUtils.isEmpty(getFileName()) && getFileName().charAt(0) == '.';
  492. }
  493. /**
  494. * The unique fileId for the file within the instance
  495. *
  496. * @return file fileId, unique within the instance
  497. */
  498. public String getLocalId() {
  499. return getRemoteId().substring(0, 8).replaceAll("^0*", "");
  500. }
  501. public boolean isInConflict() {
  502. return !TextUtils.isEmpty(etagInConflict);
  503. }
  504. public boolean isSharedWithMe() {
  505. String permissions = getPermissions();
  506. return permissions != null && permissions.contains(PERMISSION_SHARED_WITH_ME);
  507. }
  508. public boolean canReshare() {
  509. String permissions = getPermissions();
  510. return permissions != null && permissions.contains(PERMISSION_CAN_RESHARE);
  511. }
  512. public boolean canWrite() {
  513. String permissions = getPermissions();
  514. return permissions != null && permissions.contains(PERMISSION_CAN_WRITE);
  515. }
  516. public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
  517. @Override
  518. public OCFile createFromParcel(Parcel source) {
  519. return new OCFile(source);
  520. }
  521. @Override
  522. public OCFile[] newArray(int size) {
  523. return new OCFile[size];
  524. }
  525. };
  526. public long getFileId() {
  527. return this.fileId;
  528. }
  529. public long getParentId() {
  530. return this.parentId;
  531. }
  532. public long getFileLength() {
  533. return this.fileLength;
  534. }
  535. public long getCreationTimestamp() {
  536. return this.creationTimestamp;
  537. }
  538. /**
  539. * @return unix timestamp in milliseconds
  540. */
  541. public long getModificationTimestamp() {
  542. return this.modificationTimestamp;
  543. }
  544. public long getUploadTimestamp() {
  545. return this.uploadTimestamp;
  546. }
  547. public long getModificationTimestampAtLastSyncForData() {
  548. return this.modificationTimestampAtLastSyncForData;
  549. }
  550. public String getMimeType() {
  551. return this.mimeType;
  552. }
  553. public boolean isNeedsUpdatingWhileSaving() {
  554. return this.needsUpdatingWhileSaving;
  555. }
  556. public long getLastSyncDateForProperties() {
  557. return this.lastSyncDateForProperties;
  558. }
  559. public long getLastSyncDateForData() {
  560. return this.lastSyncDateForData;
  561. }
  562. public boolean isPreviewAvailable() {
  563. return this.previewAvailable;
  564. }
  565. public String getEtag() {
  566. return this.etag;
  567. }
  568. public String getEtagOnServer() {
  569. return this.etagOnServer;
  570. }
  571. public boolean isSharedViaLink() {
  572. return this.sharedViaLink;
  573. }
  574. public String getPermissions() {
  575. return this.permissions;
  576. }
  577. public String getRemoteId() {
  578. return this.remoteId;
  579. }
  580. public boolean isUpdateThumbnailNeeded() {
  581. return this.updateThumbnailNeeded;
  582. }
  583. public boolean isDownloading() {
  584. return this.downloading;
  585. }
  586. public String getEtagInConflict() {
  587. return this.etagInConflict;
  588. }
  589. public boolean isSharedWithSharee() {
  590. return this.sharedWithSharee;
  591. }
  592. public boolean isFavorite() {
  593. return this.favorite;
  594. }
  595. public boolean isEncrypted() {
  596. return this.encrypted;
  597. }
  598. public WebdavEntry.MountType getMountType() {
  599. return this.mountType;
  600. }
  601. public int getUnreadCommentsCount() {
  602. return this.unreadCommentsCount;
  603. }
  604. public String getOwnerId() {
  605. return this.ownerId;
  606. }
  607. public String getOwnerDisplayName() {
  608. return this.ownerDisplayName;
  609. }
  610. public String getNote() {
  611. return this.note;
  612. }
  613. public List<ShareeUser> getSharees() {
  614. return this.sharees;
  615. }
  616. public String getRichWorkspace() {
  617. return this.richWorkspace;
  618. }
  619. public void setFileId(long fileId) {
  620. this.fileId = fileId;
  621. }
  622. public void setParentId(long parentId) {
  623. this.parentId = parentId;
  624. }
  625. public void setFileLength(long fileLength) {
  626. this.fileLength = fileLength;
  627. }
  628. public void setCreationTimestamp(long creationTimestamp) {
  629. this.creationTimestamp = creationTimestamp;
  630. }
  631. public void setModificationTimestamp(long modificationTimestamp) {
  632. this.modificationTimestamp = modificationTimestamp;
  633. }
  634. public void setModificationTimestampAtLastSyncForData(long modificationTimestampAtLastSyncForData) {
  635. this.modificationTimestampAtLastSyncForData = modificationTimestampAtLastSyncForData;
  636. }
  637. public void setRemotePath(String remotePath) {
  638. this.remotePath = remotePath;
  639. }
  640. public void setMimeType(String mimeType) {
  641. this.mimeType = mimeType;
  642. }
  643. public void setLastSyncDateForProperties(long lastSyncDateForProperties) {
  644. this.lastSyncDateForProperties = lastSyncDateForProperties;
  645. }
  646. public void setLastSyncDateForData(long lastSyncDateForData) {
  647. this.lastSyncDateForData = lastSyncDateForData;
  648. }
  649. public void setPreviewAvailable(boolean previewAvailable) {
  650. this.previewAvailable = previewAvailable;
  651. }
  652. public void setSharedViaLink(boolean sharedViaLink) {
  653. this.sharedViaLink = sharedViaLink;
  654. }
  655. public void setPermissions(String permissions) {
  656. this.permissions = permissions;
  657. }
  658. public void setRemoteId(String remoteId) {
  659. this.remoteId = remoteId;
  660. }
  661. public void setUpdateThumbnailNeeded(boolean updateThumbnailNeeded) {
  662. this.updateThumbnailNeeded = updateThumbnailNeeded;
  663. }
  664. public void setDownloading(boolean downloading) {
  665. this.downloading = downloading;
  666. }
  667. public void setEtagInConflict(String etagInConflict) {
  668. this.etagInConflict = etagInConflict;
  669. }
  670. public void setSharedWithSharee(boolean sharedWithSharee) {
  671. this.sharedWithSharee = sharedWithSharee;
  672. }
  673. public void setFavorite(boolean favorite) {
  674. this.favorite = favorite;
  675. }
  676. public void setEncrypted(boolean encrypted) {
  677. this.encrypted = encrypted;
  678. }
  679. public void setMountType(WebdavEntry.MountType mountType) {
  680. this.mountType = mountType;
  681. }
  682. public void setUnreadCommentsCount(int unreadCommentsCount) {
  683. this.unreadCommentsCount = unreadCommentsCount;
  684. }
  685. public void setOwnerId(String ownerId) {
  686. this.ownerId = ownerId;
  687. }
  688. public void setOwnerDisplayName(String ownerDisplayName) {
  689. this.ownerDisplayName = ownerDisplayName;
  690. }
  691. public void setNote(String note) {
  692. this.note = note;
  693. }
  694. public void setSharees(List<ShareeUser> sharees) {
  695. this.sharees = sharees;
  696. }
  697. public void setRichWorkspace(String richWorkspace) {
  698. this.richWorkspace = richWorkspace;
  699. }
  700. }