Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
AbstractAnnotationEvent | 32 | 5 | 0% | 4 | 4 |
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.annotation.event; | |
21 | ||
22 | import org.xwiki.bridge.event.AbstractDocumentEvent; | |
23 | import org.xwiki.observation.event.filter.EventFilter; | |
24 | import org.xwiki.observation.event.filter.FixedNameEventFilter; | |
25 | ||
26 | /** | |
27 | * Base class for all annotation {@link org.xwiki.observation.event.Event}. | |
28 | * | |
29 | * @version $Id: b45d90c9a03b28511b1bfc826aecc4d7828f1a7f $ | |
30 | * @since 2.6RC2 | |
31 | */ | |
32 | public abstract class AbstractAnnotationEvent extends AbstractDocumentEvent implements AnnotationEvent | |
33 | { | |
34 | /** | |
35 | * The version identifier for this Serializable class. Increment only if the <i>serialized</i> form of the class | |
36 | * changes. | |
37 | */ | |
38 | private static final long serialVersionUID = 1L; | |
39 | ||
40 | /** | |
41 | * The annotation identifier used in events. | |
42 | */ | |
43 | private String identifier; | |
44 | ||
45 | /** | |
46 | * Constructor initializing the event filter with an | |
47 | * {@link org.xwiki.observation.event.filter.AlwaysMatchingEventFilter}, meaning that this event will match any | |
48 | * other annotation event (add, update, delete). | |
49 | */ | |
50 | 3 | public AbstractAnnotationEvent() |
51 | { | |
52 | 3 | super(); |
53 | } | |
54 | ||
55 | /** | |
56 | * Constructor initializing the event filter with a {@link org.xwiki.observation.event.filter.FixedNameEventFilter}, | |
57 | * meaning that this event will match only comment events affecting the document matching the passed document name. | |
58 | * | |
59 | * @param documentName the name of the updated document to match | |
60 | * @param identifier the identifier of the annotation added/updated/deleted | |
61 | */ | |
62 | 8 | public AbstractAnnotationEvent(String documentName, String identifier) |
63 | { | |
64 | // TODO refactor annotation event to take a document reference as constructor and depreciate this constructor | |
65 | 8 | super(new FixedNameEventFilter(documentName)); |
66 | 8 | this.identifier = identifier; |
67 | } | |
68 | ||
69 | /** | |
70 | * Constructor using a custom {@link EventFilter}. | |
71 | * | |
72 | * @param eventFilter the filter to use for matching events | |
73 | */ | |
74 | 0 | public AbstractAnnotationEvent(EventFilter eventFilter) |
75 | { | |
76 | 0 | super(eventFilter); |
77 | } | |
78 | ||
79 | 0 | @Override |
80 | public String getIdentifier() | |
81 | { | |
82 | 0 | return identifier; |
83 | } | |
84 | } |