OCFile.java 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  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.FileLockType;
  34. import com.owncloud.android.lib.resources.files.model.ServerFileInterface;
  35. import com.owncloud.android.lib.resources.shares.ShareeUser;
  36. import com.owncloud.android.utils.MimeType;
  37. import java.io.File;
  38. import java.util.List;
  39. import androidx.annotation.NonNull;
  40. import androidx.annotation.Nullable;
  41. import androidx.annotation.VisibleForTesting;
  42. import androidx.core.content.FileProvider;
  43. import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
  44. import third_parties.daveKoeller.AlphanumComparator;
  45. public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterface {
  46. private final static String PERMISSION_SHARED_WITH_ME = "S";
  47. @VisibleForTesting
  48. public final static String PERMISSION_CAN_RESHARE = "R";
  49. private final static String PERMISSION_CAN_WRITE = "CK";
  50. private final static String PERMISSION_GROUPFOLDER = "M";
  51. public static final String PATH_SEPARATOR = "/";
  52. public static final String ROOT_PATH = PATH_SEPARATOR;
  53. private static final String TAG = OCFile.class.getSimpleName();
  54. private long fileId; // android internal ID of the file
  55. private long parentId;
  56. private long fileLength;
  57. private long creationTimestamp; // UNIX timestamp of the time the file was created
  58. private long modificationTimestamp; // UNIX timestamp of the file modification time
  59. private long uploadTimestamp;
  60. /**
  61. * UNIX timestamp of the modification time, corresponding to the value returned by the server in the last
  62. * synchronization of THE CONTENTS of this file.
  63. */
  64. private long modificationTimestampAtLastSyncForData;
  65. private long firstShareTimestamp; // UNIX timestamp of the first share time
  66. private String remotePath;
  67. private String decryptedRemotePath;
  68. private String localPath;
  69. private String mimeType;
  70. private boolean needsUpdatingWhileSaving;
  71. private long lastSyncDateForProperties;
  72. private long lastSyncDateForData;
  73. private boolean previewAvailable;
  74. private String etag;
  75. private String etagOnServer;
  76. private boolean sharedViaLink;
  77. private String permissions;
  78. private long localId; // unique fileId for the file within the instance
  79. private String remoteId; // The fileid namespaced by the instance fileId, globally unique
  80. private boolean updateThumbnailNeeded;
  81. private boolean downloading;
  82. private String etagInConflict; // Only saves file etag in the server, when there is a conflict
  83. private boolean sharedWithSharee;
  84. private boolean favorite;
  85. private boolean encrypted;
  86. private WebdavEntry.MountType mountType;
  87. private int unreadCommentsCount;
  88. private String ownerId;
  89. private String ownerDisplayName;
  90. String note;
  91. private List<ShareeUser> sharees;
  92. private String richWorkspace;
  93. private boolean locked;
  94. @Nullable
  95. private FileLockType lockType;
  96. @Nullable
  97. private String lockOwnerId;
  98. @Nullable
  99. private String lockOwnerDisplayName;
  100. @Nullable
  101. private String lockOwnerEditor;
  102. private long lockTimestamp;
  103. private long lockTimeout;
  104. @Nullable
  105. private String lockToken;
  106. @Nullable
  107. private ImageDimension imageDimension;
  108. /**
  109. * URI to the local path of the file contents, if stored in the device; cached after first call to {@link
  110. * #getStorageUri()}
  111. */
  112. private Uri localUri;
  113. /**
  114. * Exportable URI to the local path of the file contents, if stored in the device.
  115. * <p>
  116. * Cached after first call, until changed.
  117. */
  118. private Uri exposedFileUri;
  119. /**
  120. * Create new {@link OCFile} with given path.
  121. * <p>
  122. * The path received must be URL-decoded. Path separator must be OCFile.PATH_SEPARATOR, and it must be the first character in 'path'.
  123. *
  124. * @param path The remote path of the file.
  125. */
  126. public OCFile(String path) {
  127. resetData();
  128. needsUpdatingWhileSaving = false;
  129. if (TextUtils.isEmpty(path) || !path.startsWith(PATH_SEPARATOR)) {
  130. throw new IllegalArgumentException("Trying to create a OCFile with a non valid remote path: " + path);
  131. }
  132. remotePath = path;
  133. }
  134. /**
  135. * Reconstruct from parcel
  136. *
  137. * @param source The source parcel
  138. */
  139. private OCFile(Parcel source) {
  140. fileId = source.readLong();
  141. parentId = source.readLong();
  142. fileLength = source.readLong();
  143. creationTimestamp = source.readLong();
  144. modificationTimestamp = source.readLong();
  145. modificationTimestampAtLastSyncForData = source.readLong();
  146. remotePath = source.readString();
  147. decryptedRemotePath = source.readString();
  148. localPath = source.readString();
  149. mimeType = source.readString();
  150. needsUpdatingWhileSaving = source.readInt() == 0;
  151. lastSyncDateForProperties = source.readLong();
  152. lastSyncDateForData = source.readLong();
  153. etag = source.readString();
  154. etagOnServer = source.readString();
  155. sharedViaLink = source.readInt() == 1;
  156. permissions = source.readString();
  157. localId = source.readLong();
  158. remoteId = source.readString();
  159. updateThumbnailNeeded = source.readInt() == 1;
  160. downloading = source.readInt() == 1;
  161. etagInConflict = source.readString();
  162. sharedWithSharee = source.readInt() == 1;
  163. favorite = source.readInt() == 1;
  164. encrypted = source.readInt() == 1;
  165. ownerId = source.readString();
  166. ownerDisplayName = source.readString();
  167. mountType = (WebdavEntry.MountType) source.readSerializable();
  168. richWorkspace = source.readString();
  169. previewAvailable = source.readInt() == 1;
  170. firstShareTimestamp = source.readLong();
  171. locked = source.readInt() == 1;
  172. lockType = FileLockType.fromValue(source.readInt());
  173. lockOwnerId = source.readString();
  174. lockOwnerDisplayName = source.readString();
  175. lockOwnerEditor = source.readString();
  176. lockTimestamp = source.readLong();
  177. lockTimeout = source.readLong();
  178. lockToken = source.readString();
  179. }
  180. @Override
  181. public void writeToParcel(Parcel dest, int flags) {
  182. dest.writeLong(fileId);
  183. dest.writeLong(parentId);
  184. dest.writeLong(fileLength);
  185. dest.writeLong(creationTimestamp);
  186. dest.writeLong(modificationTimestamp);
  187. dest.writeLong(modificationTimestampAtLastSyncForData);
  188. dest.writeString(remotePath);
  189. dest.writeString(decryptedRemotePath);
  190. dest.writeString(localPath);
  191. dest.writeString(mimeType);
  192. dest.writeInt(needsUpdatingWhileSaving ? 1 : 0);
  193. dest.writeLong(lastSyncDateForProperties);
  194. dest.writeLong(lastSyncDateForData);
  195. dest.writeString(etag);
  196. dest.writeString(etagOnServer);
  197. dest.writeInt(sharedViaLink ? 1 : 0);
  198. dest.writeString(permissions);
  199. dest.writeLong(localId);
  200. dest.writeString(remoteId);
  201. dest.writeInt(updateThumbnailNeeded ? 1 : 0);
  202. dest.writeInt(downloading ? 1 : 0);
  203. dest.writeString(etagInConflict);
  204. dest.writeInt(sharedWithSharee ? 1 : 0);
  205. dest.writeInt(favorite ? 1 : 0);
  206. dest.writeInt(encrypted ? 1 : 0);
  207. dest.writeString(ownerId);
  208. dest.writeString(ownerDisplayName);
  209. dest.writeSerializable(mountType);
  210. dest.writeString(richWorkspace);
  211. dest.writeInt(previewAvailable ? 1 : 0);
  212. dest.writeLong(firstShareTimestamp);
  213. dest.writeInt(locked ? 1 : 0);
  214. dest.writeInt(lockType != null ? lockType.getValue() : -1);
  215. dest.writeString(lockOwnerId);
  216. dest.writeString(lockOwnerDisplayName);
  217. dest.writeString(lockOwnerEditor);
  218. dest.writeLong(lockTimestamp);
  219. dest.writeLong(lockTimeout);
  220. dest.writeString(lockToken);
  221. }
  222. public void setDecryptedRemotePath(String path) {
  223. decryptedRemotePath = path;
  224. }
  225. /**
  226. * Use decrypted remote path for every local file operation Use encrypted remote path for every dav related
  227. * operation
  228. */
  229. public String getDecryptedRemotePath() {
  230. // Fallback
  231. // TODO test without, on a new created folder
  232. if (!isEncrypted() && decryptedRemotePath == null) {
  233. decryptedRemotePath = remotePath;
  234. }
  235. if (isFolder()) {
  236. if (decryptedRemotePath.endsWith(PATH_SEPARATOR)) {
  237. return decryptedRemotePath;
  238. } else {
  239. return decryptedRemotePath + PATH_SEPARATOR;
  240. }
  241. } else {
  242. if (decryptedRemotePath == null) {
  243. // last fallback
  244. return remotePath;
  245. } else {
  246. return decryptedRemotePath;
  247. }
  248. }
  249. }
  250. /**
  251. * Returns the remote path of the file on Nextcloud
  252. * (this might be an encrypted file path, if E2E is used)
  253. * <p>
  254. * Use decrypted remote path for every local file operation.
  255. * Use remote path for every dav related operation
  256. *
  257. * @return The remote path to the file
  258. */
  259. public String getRemotePath() {
  260. if (isFolder()) {
  261. if (remotePath.endsWith(PATH_SEPARATOR)) {
  262. return remotePath;
  263. } else {
  264. return remotePath + PATH_SEPARATOR;
  265. }
  266. } else {
  267. return remotePath;
  268. }
  269. }
  270. /**
  271. * Can be used to check, whether or not this file exists in the database already
  272. *
  273. * @return true, if the file exists in the database
  274. */
  275. public boolean fileExists() {
  276. return fileId != -1;
  277. }
  278. /**
  279. * Use this to find out if this file is a folder.
  280. *
  281. * @return true if it is a folder
  282. */
  283. public boolean isFolder() {
  284. return MimeType.DIRECTORY.equals(mimeType) || MimeType.WEBDAV_FOLDER.equals(mimeType);
  285. }
  286. /**
  287. * Sets mimetype to folder and returns this file
  288. * Only for testing
  289. *
  290. * @return OCFile this file
  291. */
  292. public OCFile setFolder() {
  293. setMimeType(MimeType.DIRECTORY);
  294. return this;
  295. }
  296. /**
  297. * Use this to check if this file is available locally
  298. *
  299. * @return true if it is
  300. */
  301. public boolean isDown() {
  302. return !isFolder() && existsOnDevice();
  303. }
  304. /**
  305. * Use this to check if this file or folder is available locally
  306. *
  307. * @return true if it is
  308. */
  309. public boolean existsOnDevice() {
  310. if (!TextUtils.isEmpty(localPath)) {
  311. return new File(localPath).exists();
  312. }
  313. return false;
  314. }
  315. /**
  316. * The path, where the file is stored locally
  317. *
  318. * @return The local path to the file
  319. */
  320. public String getStoragePath() {
  321. return localPath;
  322. }
  323. /**
  324. * The URI to the file contents, if stored locally
  325. *
  326. * @return A URI to the local copy of the file, or NULL if not stored in the device
  327. */
  328. public Uri getStorageUri() {
  329. if (TextUtils.isEmpty(localPath)) {
  330. return null;
  331. }
  332. if (localUri == null) {
  333. Uri.Builder builder = new Uri.Builder();
  334. builder.scheme(ContentResolver.SCHEME_FILE);
  335. builder.path(localPath);
  336. localUri = builder.build();
  337. }
  338. return localUri;
  339. }
  340. public Uri getLegacyExposedFileUri() {
  341. if (TextUtils.isEmpty(localPath)) {
  342. return null;
  343. }
  344. if (exposedFileUri == null) {
  345. return Uri.parse(ContentResolver.SCHEME_FILE + "://" + WebdavUtils.encodePath(localPath));
  346. }
  347. return exposedFileUri;
  348. }
  349. /*
  350. Partly disabled because not all apps understand paths that we get via this method for now
  351. */
  352. public Uri getExposedFileUri(Context context) {
  353. if (TextUtils.isEmpty(localPath)) {
  354. return null;
  355. }
  356. if (exposedFileUri == null) {
  357. try {
  358. exposedFileUri = FileProvider.getUriForFile(
  359. context,
  360. context.getString(R.string.file_provider_authority),
  361. new File(localPath));
  362. } catch (IllegalArgumentException ex) {
  363. // Could not share file using FileProvider URI scheme.
  364. // Fall back to legacy URI parsing.
  365. getLegacyExposedFileUri();
  366. }
  367. }
  368. return exposedFileUri;
  369. }
  370. /**
  371. * Can be used to set the path where the file is stored
  372. *
  373. * @param storage_path to set
  374. */
  375. public void setStoragePath(String storage_path) {
  376. if (storage_path == null) {
  377. localPath = null;
  378. } else {
  379. localPath = storage_path.replaceAll("//", "/");
  380. if (isFolder() && !localPath.endsWith("/")) {
  381. localPath = localPath + "/";
  382. }
  383. }
  384. localUri = null;
  385. exposedFileUri = null;
  386. }
  387. /**
  388. * Returns the decrypted filename and "/" for the root directory
  389. *
  390. * @return The name of the file
  391. */
  392. public String getFileName() {
  393. return getDecryptedFileName();
  394. }
  395. /**
  396. * Returns the decrypted filename and "/" for the root directory
  397. *
  398. * @return The name of the file
  399. */
  400. public String getDecryptedFileName() {
  401. File f = new File(getDecryptedRemotePath());
  402. return f.getName().length() == 0 ? ROOT_PATH : f.getName();
  403. }
  404. /**
  405. * Returns the encrypted filename and "/" for the root directory
  406. *
  407. * @return The name of the file
  408. */
  409. public String getEncryptedFileName() {
  410. File f = new File(remotePath);
  411. return f.getName().length() == 0 ? ROOT_PATH : f.getName();
  412. }
  413. /**
  414. * Sets the name of the file
  415. * <p/>
  416. * Does nothing if the new name is null, empty or includes "/" ; or if the file is the root
  417. * directory
  418. */
  419. public void setFileName(String name) {
  420. Log_OC.d(TAG, "OCFile name changing from " + remotePath);
  421. if (!TextUtils.isEmpty(name) && !name.contains(PATH_SEPARATOR) && !ROOT_PATH.equals(remotePath)) {
  422. String parent = new File(this.getRemotePath()).getParent();
  423. parent = parent.endsWith(PATH_SEPARATOR) ? parent : parent + PATH_SEPARATOR;
  424. remotePath = parent + name;
  425. if (isFolder()) {
  426. remotePath += PATH_SEPARATOR;
  427. }
  428. Log_OC.d(TAG, "OCFile name changed to " + remotePath);
  429. }
  430. }
  431. /**
  432. * Used internally. Reset all file properties
  433. */
  434. private void resetData() {
  435. fileId = -1;
  436. remotePath = null;
  437. decryptedRemotePath = null;
  438. parentId = 0;
  439. localPath = null;
  440. mimeType = null;
  441. fileLength = 0;
  442. creationTimestamp = 0;
  443. modificationTimestamp = 0;
  444. modificationTimestampAtLastSyncForData = 0;
  445. lastSyncDateForProperties = 0;
  446. lastSyncDateForData = 0;
  447. needsUpdatingWhileSaving = false;
  448. etag = null;
  449. etagOnServer = null;
  450. sharedViaLink = false;
  451. permissions = null;
  452. localId = -1;
  453. remoteId = null;
  454. updateThumbnailNeeded = false;
  455. downloading = false;
  456. etagInConflict = null;
  457. sharedWithSharee = false;
  458. favorite = false;
  459. encrypted = false;
  460. mountType = WebdavEntry.MountType.INTERNAL;
  461. richWorkspace = "";
  462. firstShareTimestamp = 0;
  463. locked = false;
  464. lockType = null;
  465. lockOwnerId = null;
  466. lockOwnerDisplayName = null;
  467. lockOwnerEditor = null;
  468. lockTimestamp = 0;
  469. lockTimeout = 0;
  470. lockToken = null;
  471. imageDimension = null;
  472. }
  473. /**
  474. * get remote path of parent file
  475. *
  476. * @return remote path
  477. */
  478. public String getParentRemotePath() {
  479. String parentPath = new File(this.getRemotePath()).getParent();
  480. return parentPath.endsWith(PATH_SEPARATOR) ? parentPath : parentPath + PATH_SEPARATOR;
  481. }
  482. @Override
  483. public int describeContents() {
  484. return super.hashCode();
  485. }
  486. @Override
  487. public int compareTo(@NonNull OCFile another) {
  488. if (isFolder() && another.isFolder()) {
  489. return AlphanumComparator.compare(this, another);
  490. } else if (isFolder()) {
  491. return -1;
  492. } else if (another.isFolder()) {
  493. return 1;
  494. }
  495. return AlphanumComparator.compare(this, another);
  496. }
  497. @Override
  498. public boolean equals(Object o) {
  499. if (this == o) {
  500. return true;
  501. }
  502. if (o == null || getClass() != o.getClass()) {
  503. return false;
  504. }
  505. OCFile ocFile = (OCFile) o;
  506. return fileId == ocFile.fileId && parentId == ocFile.parentId;
  507. }
  508. @Override
  509. public int hashCode() {
  510. return 31 * (int) (fileId ^ (fileId >>> 32)) + (int) (parentId ^ (parentId >>> 32));
  511. }
  512. @NonNull
  513. @Override
  514. public String toString() {
  515. String asString = "[id=%s, name=%s, mime=%s, downloaded=%s, local=%s, remote=%s, " +
  516. "parentId=%s, etag=%s, favourite=%s]";
  517. return String.format(asString,
  518. fileId,
  519. getFileName(),
  520. mimeType,
  521. isDown(),
  522. localPath,
  523. remotePath,
  524. parentId,
  525. etag,
  526. favorite);
  527. }
  528. public void setEtag(String etag) {
  529. this.etag = etag != null ? etag : "";
  530. }
  531. public void setEtagOnServer(String etag) {
  532. this.etagOnServer = etag != null ? etag : "";
  533. }
  534. public long getLocalModificationTimestamp() {
  535. if (!TextUtils.isEmpty(localPath)) {
  536. File f = new File(localPath);
  537. return f.lastModified();
  538. }
  539. return 0;
  540. }
  541. /**
  542. * @return 'True' if the file is hidden
  543. */
  544. public boolean isHidden() {
  545. return !TextUtils.isEmpty(getFileName()) && getFileName().charAt(0) == '.';
  546. }
  547. @SuppressFBWarnings("STT")
  548. public long getLocalId() {
  549. if (localId > 0) {
  550. return localId;
  551. } else if (remoteId != null) {
  552. return Long.parseLong(remoteId.substring(0, 8).replaceAll("^0*", ""));
  553. } else {
  554. return -1;
  555. }
  556. }
  557. public boolean isInConflict() {
  558. return !TextUtils.isEmpty(etagInConflict);
  559. }
  560. public boolean isSharedWithMe() {
  561. String permissions = getPermissions();
  562. return permissions != null && permissions.contains(PERMISSION_SHARED_WITH_ME);
  563. }
  564. public boolean canReshare() {
  565. String permissions = getPermissions();
  566. return permissions != null && permissions.contains(PERMISSION_CAN_RESHARE);
  567. }
  568. public boolean canWrite() {
  569. String permissions = getPermissions();
  570. return permissions != null && permissions.contains(PERMISSION_CAN_WRITE);
  571. }
  572. public boolean isGroupFolder() {
  573. String permissions = getPermissions();
  574. return permissions != null && permissions.contains(PERMISSION_GROUPFOLDER);
  575. }
  576. public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
  577. @Override
  578. public OCFile createFromParcel(Parcel source) {
  579. return new OCFile(source);
  580. }
  581. @Override
  582. public OCFile[] newArray(int size) {
  583. return new OCFile[size];
  584. }
  585. };
  586. public long getFileId() {
  587. return this.fileId;
  588. }
  589. public long getParentId() {
  590. return this.parentId;
  591. }
  592. public long getFileLength() {
  593. return this.fileLength;
  594. }
  595. public long getCreationTimestamp() {
  596. return this.creationTimestamp;
  597. }
  598. /**
  599. * @return unix timestamp in milliseconds
  600. */
  601. public long getModificationTimestamp() {
  602. return this.modificationTimestamp;
  603. }
  604. public long getUploadTimestamp() {
  605. return this.uploadTimestamp;
  606. }
  607. public long getModificationTimestampAtLastSyncForData() {
  608. return this.modificationTimestampAtLastSyncForData;
  609. }
  610. public String getMimeType() {
  611. return this.mimeType;
  612. }
  613. public boolean isNeedsUpdatingWhileSaving() {
  614. return this.needsUpdatingWhileSaving;
  615. }
  616. public long getLastSyncDateForProperties() {
  617. return this.lastSyncDateForProperties;
  618. }
  619. public long getLastSyncDateForData() {
  620. return this.lastSyncDateForData;
  621. }
  622. public boolean isPreviewAvailable() {
  623. return this.previewAvailable;
  624. }
  625. public String getEtag() {
  626. return this.etag;
  627. }
  628. public String getEtagOnServer() {
  629. return this.etagOnServer;
  630. }
  631. public boolean isSharedViaLink() {
  632. return this.sharedViaLink;
  633. }
  634. public String getPermissions() {
  635. return this.permissions;
  636. }
  637. public String getRemoteId() {
  638. return this.remoteId;
  639. }
  640. public boolean isUpdateThumbnailNeeded() {
  641. return this.updateThumbnailNeeded;
  642. }
  643. public boolean isDownloading() {
  644. return this.downloading;
  645. }
  646. public String getEtagInConflict() {
  647. return this.etagInConflict;
  648. }
  649. public boolean isSharedWithSharee() {
  650. return this.sharedWithSharee;
  651. }
  652. public boolean isFavorite() {
  653. return this.favorite;
  654. }
  655. public boolean isEncrypted() {
  656. return this.encrypted;
  657. }
  658. public WebdavEntry.MountType getMountType() {
  659. return this.mountType;
  660. }
  661. public int getUnreadCommentsCount() {
  662. return this.unreadCommentsCount;
  663. }
  664. public String getOwnerId() {
  665. return this.ownerId;
  666. }
  667. public String getOwnerDisplayName() {
  668. return this.ownerDisplayName;
  669. }
  670. public String getNote() {
  671. return this.note;
  672. }
  673. public List<ShareeUser> getSharees() {
  674. return this.sharees;
  675. }
  676. public String getRichWorkspace() {
  677. return this.richWorkspace;
  678. }
  679. public void setFileId(long fileId) {
  680. this.fileId = fileId;
  681. }
  682. public void setLocalId(long localId) {
  683. this.localId = localId;
  684. }
  685. public void setParentId(long parentId) {
  686. this.parentId = parentId;
  687. }
  688. public void setFileLength(long fileLength) {
  689. this.fileLength = fileLength;
  690. }
  691. public void setCreationTimestamp(long creationTimestamp) {
  692. this.creationTimestamp = creationTimestamp;
  693. }
  694. public void setModificationTimestamp(long modificationTimestamp) {
  695. this.modificationTimestamp = modificationTimestamp;
  696. }
  697. public void setModificationTimestampAtLastSyncForData(long modificationTimestampAtLastSyncForData) {
  698. this.modificationTimestampAtLastSyncForData = modificationTimestampAtLastSyncForData;
  699. }
  700. public void setRemotePath(String remotePath) {
  701. this.remotePath = remotePath;
  702. }
  703. public void setMimeType(String mimeType) {
  704. this.mimeType = mimeType;
  705. }
  706. public void setLastSyncDateForProperties(long lastSyncDateForProperties) {
  707. this.lastSyncDateForProperties = lastSyncDateForProperties;
  708. }
  709. public void setLastSyncDateForData(long lastSyncDateForData) {
  710. this.lastSyncDateForData = lastSyncDateForData;
  711. }
  712. public void setPreviewAvailable(boolean previewAvailable) {
  713. this.previewAvailable = previewAvailable;
  714. }
  715. public void setSharedViaLink(boolean sharedViaLink) {
  716. this.sharedViaLink = sharedViaLink;
  717. }
  718. public void setPermissions(String permissions) {
  719. this.permissions = permissions;
  720. }
  721. public void setRemoteId(String remoteId) {
  722. this.remoteId = remoteId;
  723. }
  724. public void setUpdateThumbnailNeeded(boolean updateThumbnailNeeded) {
  725. this.updateThumbnailNeeded = updateThumbnailNeeded;
  726. }
  727. public void setDownloading(boolean downloading) {
  728. this.downloading = downloading;
  729. }
  730. public void setEtagInConflict(String etagInConflict) {
  731. this.etagInConflict = etagInConflict;
  732. }
  733. public void setSharedWithSharee(boolean sharedWithSharee) {
  734. this.sharedWithSharee = sharedWithSharee;
  735. }
  736. public void setFavorite(boolean favorite) {
  737. this.favorite = favorite;
  738. }
  739. public void setEncrypted(boolean encrypted) {
  740. this.encrypted = encrypted;
  741. }
  742. public void setMountType(WebdavEntry.MountType mountType) {
  743. this.mountType = mountType;
  744. }
  745. public void setUnreadCommentsCount(int unreadCommentsCount) {
  746. this.unreadCommentsCount = unreadCommentsCount;
  747. }
  748. public void setOwnerId(String ownerId) {
  749. this.ownerId = ownerId;
  750. }
  751. public void setOwnerDisplayName(String ownerDisplayName) {
  752. this.ownerDisplayName = ownerDisplayName;
  753. }
  754. public void setNote(String note) {
  755. this.note = note;
  756. }
  757. public void setSharees(List<ShareeUser> sharees) {
  758. this.sharees = sharees;
  759. }
  760. public void setRichWorkspace(String richWorkspace) {
  761. this.richWorkspace = richWorkspace;
  762. }
  763. public long getFirstShareTimestamp() {
  764. return firstShareTimestamp;
  765. }
  766. public void setFirstShareTimestamp(long firstShareTimestamp) {
  767. this.firstShareTimestamp = firstShareTimestamp;
  768. }
  769. public boolean isLocked() {
  770. return locked;
  771. }
  772. public void setLocked(boolean locked) {
  773. this.locked = locked;
  774. }
  775. @Nullable
  776. public FileLockType getLockType() {
  777. return lockType;
  778. }
  779. public void setLockType(@Nullable FileLockType lockType) {
  780. this.lockType = lockType;
  781. }
  782. @Nullable
  783. public String getLockOwnerId() {
  784. return lockOwnerId;
  785. }
  786. public void setLockOwnerId(@Nullable String lockOwnerId) {
  787. this.lockOwnerId = lockOwnerId;
  788. }
  789. @Nullable
  790. public String getLockOwnerDisplayName() {
  791. return lockOwnerDisplayName;
  792. }
  793. public void setLockOwnerDisplayName(@Nullable String lockOwnerDisplayName) {
  794. this.lockOwnerDisplayName = lockOwnerDisplayName;
  795. }
  796. @Nullable
  797. public String getLockOwnerEditor() {
  798. return lockOwnerEditor;
  799. }
  800. public void setLockOwnerEditor(@Nullable String lockOwnerEditor) {
  801. this.lockOwnerEditor = lockOwnerEditor;
  802. }
  803. public long getLockTimestamp() {
  804. return lockTimestamp;
  805. }
  806. public void setLockTimestamp(long lockTimestamp) {
  807. this.lockTimestamp = lockTimestamp;
  808. }
  809. public long getLockTimeout() {
  810. return lockTimeout;
  811. }
  812. public void setLockTimeout(long lockTimeout) {
  813. this.lockTimeout = lockTimeout;
  814. }
  815. @Nullable
  816. public String getLockToken() {
  817. return lockToken;
  818. }
  819. public void setLockToken(@Nullable String lockToken) {
  820. this.lockToken = lockToken;
  821. }
  822. public void setImageDimension(@Nullable ImageDimension imageDimension) {
  823. this.imageDimension = imageDimension;
  824. }
  825. @Nullable
  826. public ImageDimension getImageDimension() {
  827. return imageDimension;
  828. }
  829. }