AFilesDocument.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018
  5. *
  6. * @author Maxence Lange <maxence@artificial-owl.com>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\Files_FullTextSearch\Model;
  25. use OC\FullTextSearch\Model\IndexDocument;
  26. use OCP\FullTextSearch\Model\IIndexDocument;
  27. /**
  28. * Abstract Class AFilesDocument
  29. *
  30. * This is mostly used by 3rd party apps that want to complete the IIndexDocument
  31. * with more information about a file before its index:
  32. *
  33. * \OC::$server->getEventDispatcher()->addListener(
  34. * '\OCA\Files_FullTextSearch::onFileIndexing',
  35. * function(GenericEvent $e) {
  36. * //@var \OCP\Files\Node $file
  37. * $file = $e->getArgument('file');
  38. *
  39. * // @var \OCP\Files_FullTextSearch\Model\AFilesDocument $document
  40. * $document = $e->getArgument('document');
  41. * }
  42. * );
  43. *
  44. * @since 15.0.0
  45. *
  46. */
  47. abstract class AFilesDocument extends IndexDocument {
  48. /**
  49. * Returns the owner of the document/file.
  50. *
  51. * @since 15.0.0
  52. *
  53. * @return string
  54. */
  55. abstract public function getOwnerId(): string;
  56. /**
  57. * Returns the current viewer of the document/file.
  58. *
  59. * @since 15.0.0
  60. *
  61. * @return string
  62. */
  63. abstract public function getViewerId(): string;
  64. /**
  65. * Returns the type of the document/file.
  66. *
  67. * @since 15.0.0
  68. *
  69. * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
  70. */
  71. abstract public function getType(): string;
  72. /**
  73. * Returns the mimetype of the document/file.
  74. *
  75. * @since 15.0.0
  76. *
  77. * @return string
  78. */
  79. abstract public function getMimetype(): string;
  80. /**
  81. * Returns the path of the document/file.
  82. *
  83. * @since 15.0.0
  84. *
  85. * @return string
  86. */
  87. abstract public function getPath(): string;
  88. }