コード例 #1
0
 @Override
 public boolean isEventSkipped(WatchListEvent event) {
   // We exclude watchlist jobs from notifications since they are modified each time they are
   // fired,
   // producing useless noise.
   Collection<String> possibleIntervals = store.getIntervals();
   return possibleIntervals.contains(event.getFullName());
 }
コード例 #2
0
  @Override
  public boolean isEventMatching(WatchListEvent event, String subscriber) {
    boolean isWatched = false;

    try {
      // The subscriber's watched users, since each event can be a composite event.
      Collection<String> watchedUsers =
          store.getWatchedElements(subscriber, WatchedElementType.USER);

      isWatched |= store.isWatched(event.getWiki(), subscriber, WatchedElementType.WIKI);
      isWatched |= store.isWatched(event.getPrefixedSpace(), subscriber, WatchedElementType.SPACE);
      isWatched |=
          store.isWatched(event.getPrefixedFullName(), subscriber, WatchedElementType.DOCUMENT);
      isWatched |= CollectionUtils.intersection(watchedUsers, event.getAuthors()).size() > 0;
    } catch (Exception e) {
      logger.error(
          "Failed to determine if an event for the document [{}] is interesting to [{}]",
          event.getDocumentReference(),
          subscriber,
          e);
    }

    return isWatched;
  }