You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IEventMerger.php 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OCP\Activity;
  24. /**
  25. * Interface EventMerger
  26. *
  27. * @package OCP\Activity
  28. * @since 11.0
  29. */
  30. interface IEventMerger {
  31. /**
  32. * Combines two events when possible to have grouping:
  33. *
  34. * Example1: Two events with subject '{user} created {file}' and
  35. * $mergeParameter file with different file and same user will be merged
  36. * to '{user} created {file1} and {file2}' and the childEvent on the return
  37. * will be set, if the events have been merged.
  38. *
  39. * Example2: Two events with subject '{user} created {file}' and
  40. * $mergeParameter file with same file and same user will be merged to
  41. * '{user} created {file1}' and the childEvent on the return will be set, if
  42. * the events have been merged.
  43. *
  44. * The following requirements have to be met, in order to be merged:
  45. * - Both events need to have the same `getApp()`
  46. * - Both events must not have a message `getMessage()`
  47. * - Both events need to have the same subject `getSubject()`
  48. * - Both events need to have the same object type `getObjectType()`
  49. * - The time difference between both events must not be bigger then 3 hours
  50. * - Only up to 5 events can be merged.
  51. * - All parameters apart from such starting with $mergeParameter must be
  52. * the same for both events.
  53. *
  54. * @param string $mergeParameter
  55. * @param IEvent $event
  56. * @param IEvent|null $previousEvent
  57. * @return IEvent
  58. * @since 11.0
  59. */
  60. public function mergeEvents($mergeParameter, IEvent $event, IEvent $previousEvent = null);
  61. }