1
0

IEntity.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
  5. *
  6. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  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\WorkflowEngine;
  25. use OCP\EventDispatcher\Event;
  26. /**
  27. * Interface IEntity
  28. *
  29. * This interface represents an entity that supports events the workflow engine
  30. * can listen to. For example a file with the create, update, etc. events.
  31. *
  32. * Ensure to listen to 'OCP/WorkflowEngine::loadEntities' for registering your
  33. * entities.
  34. *
  35. * @package OCP\WorkflowEngine
  36. * @since 18.0.0
  37. */
  38. interface IEntity {
  39. /**
  40. * returns a translated name to be presented in the web interface.
  41. *
  42. * Example: "File" (en), "Dosiero" (eo)
  43. *
  44. * @since 18.0.0
  45. */
  46. public function getName(): string;
  47. /**
  48. * returns the URL to the icon of the entity for display in the web interface.
  49. *
  50. * Usually, the implementation would utilize the `imagePath()` method of the
  51. * `\OCP\IURLGenerator` instance and simply return its result.
  52. *
  53. * Example implementation: return $this->urlGenerator->imagePath('myApp', 'cat.svg');
  54. *
  55. * @since 18.0.0
  56. */
  57. public function getIcon(): string;
  58. /**
  59. * returns a list of supported events
  60. *
  61. * @return IEntityEvent[]
  62. * @since 18.0.0
  63. */
  64. public function getEvents(): array;
  65. /**
  66. * @since 18.0.0
  67. */
  68. public function prepareRuleMatcher(IRuleMatcher $ruleMatcher, string $eventName, Event $event): void;
  69. /**
  70. * returns whether the provided user id is allowed to run a flow against
  71. * the known context
  72. *
  73. * @since 18.0.0
  74. */
  75. public function isLegitimatedForUserId(string $userId): bool;
  76. }