1
0

IEntity.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\WorkflowEngine;
  8. use OCP\EventDispatcher\Event;
  9. /**
  10. * Interface IEntity
  11. *
  12. * This interface represents an entity that supports events the workflow engine
  13. * can listen to. For example a file with the create, update, etc. events.
  14. *
  15. * Ensure to listen to 'OCP/WorkflowEngine::loadEntities' for registering your
  16. * entities.
  17. *
  18. * @since 18.0.0
  19. */
  20. interface IEntity {
  21. /**
  22. * returns a translated name to be presented in the web interface.
  23. *
  24. * Example: "File" (en), "Dosiero" (eo)
  25. *
  26. * @since 18.0.0
  27. */
  28. public function getName(): string;
  29. /**
  30. * returns the URL to the icon of the entity for display in the web interface.
  31. *
  32. * Usually, the implementation would utilize the `imagePath()` method of the
  33. * `\OCP\IURLGenerator` instance and simply return its result.
  34. *
  35. * Example implementation: return $this->urlGenerator->imagePath('myApp', 'cat.svg');
  36. *
  37. * @since 18.0.0
  38. */
  39. public function getIcon(): string;
  40. /**
  41. * returns a list of supported events
  42. *
  43. * @return IEntityEvent[]
  44. * @since 18.0.0
  45. */
  46. public function getEvents(): array;
  47. /**
  48. * @since 18.0.0
  49. */
  50. public function prepareRuleMatcher(IRuleMatcher $ruleMatcher, string $eventName, Event $event): void;
  51. /**
  52. * returns whether the provided user id is allowed to run a flow against
  53. * the known context
  54. *
  55. * @since 18.0.0
  56. */
  57. public function isLegitimatedForUserId(string $userId): bool;
  58. }