1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.watchlist.internal

File WatchListEventMatcher.java

 

Code metrics

0
0
0
1
83
14
0
-
-
0
-

Classes

Class Line # Actions
WatchListEventMatcher 35 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.watchlist.internal;
21   
22    import java.util.Date;
23    import java.util.List;
24   
25    import org.xwiki.component.annotation.Role;
26    import org.xwiki.watchlist.internal.api.WatchListEvent;
27   
28    /**
29    * Matcher for WatchList events. It can also retrieve all the events fired during a given interval. It also allows to
30    * perform a match between events and the elements watched by a user.
31    *
32    * @version $Id: 25f41b088d23925a30a3aba64a082491b344806c $
33    */
34    @Role
 
35    public interface WatchListEventMatcher
36    {
37    /**
38    * Gets all the events fired during the interval between the given date and the current date.
39    *
40    * @param start start date to use for document matching
41    * @return the list of events after the given start date
42    */
43    List<WatchListEvent> getEventsSince(Date start);
44   
45    /**
46    * @param events the events to filter
47    * @param subscriber the subscriber whose watched elements to check against
48    * @return a sublist of events matching the given user's watched elements and that occurred on documents that are
49    * visible to the given user
50    */
51    List<WatchListEvent> getMatchingVisibleEvents(List<WatchListEvent> events, String subscriber);
52   
53    /**
54    * Checks if an event matches a subscriber's watched elements.
55    *
56    * @param event the event to check
57    * @param subscriber the subscriber to check
58    * @return true if the given event matches the given subscriber's watched elements, false otherwise. In addition,
59    * view rights of the subscriber on the event's documents are checked and events on certain internal
60    * documents (e.g. watchlist scheduler jobs) are also skipped to avoid noise.
61    */
62    boolean isEventMatching(WatchListEvent event, String subscriber);
63   
64    /**
65    * Checks if an event should be skipped for various reasons (performance, security, etc.).
66    * <p>
67    * Example: Watchlist job documents that are updated on each trigger should be skipped.
68    *
69    * @param event the event to check
70    * @return true if the event should be skipped, false otherwise
71    */
72    boolean isEventSkipped(WatchListEvent event);
73   
74    /**
75    * Checks if the document of an event is viewable by a given subscriber. If it is not, then we can also say that the
76    * event is not visible to the subscriber.
77    *
78    * @param event the event to check
79    * @param subscriber the subscriber to check
80    * @return true if the event is visible, false otherwise
81    */
82    boolean isEventViewable(WatchListEvent event, String subscriber);
83    }