1
0

AFilesDocument.php 2.6 KB

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