1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.internal.event

File AbstractCommentEvent.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart6.png
69% of files have more coverage

Code metrics

0
5
4
1
89
26
4
0.8
1.25
4
1

Classes

Class Line # Actions
AbstractCommentEvent 32 5 0% 4 4
0.555555655.6%
 

Contributing tests

This file is covered by 3 tests. .

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 com.xpn.xwiki.internal.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 comment {@link org.xwiki.observation.event.Event events}.
28    *
29    * @version $Id: ca61f4eb0cffecd6b9055367eec4bb649f59ebca $
30    * @since 2.6RC2
31    */
 
32    public abstract class AbstractCommentEvent extends AbstractDocumentEvent
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 comment that is 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 comment event (add, update, delete).
49    */
 
50  3 toggle public AbstractCommentEvent()
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 comment added/updated/deleted
61    */
 
62  19 toggle public AbstractCommentEvent(String documentName, String identifier)
63    {
64    // TODO: depreciate this constructor and add a constructor taking a document reference instead
65  19 super(new FixedNameEventFilter(documentName));
66  19 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 toggle public AbstractCommentEvent(EventFilter eventFilter)
75    {
76  0 super(eventFilter);
77    }
78   
79    /**
80    * Retrieves the content of the comment added/updated/deleted in the event.
81    *
82    * @return comment identifier
83    */
 
84  0 toggle public String getIdentifier()
85    {
86  0 return this.identifier;
87    }
88   
89    }