Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
26   179   13   2
0   65   0,5   13
13     1  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  AuditListener       Line # 48 26 0% 13 0 100% 1.0
 
  (180)
 
1    /*
2    * Copyright (c) 2003-2006, Simon Brown
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * - Redistributions of source code must retain the above copyright
9    * notice, this list of conditions and the following disclaimer.
10    *
11    * - Redistributions in binary form must reproduce the above copyright
12    * notice, this list of conditions and the following disclaimer in
13    * the documentation and/or other materials provided with the
14    * distribution.
15    *
16    * - Neither the name of Pebble nor the names of its contributors may
17    * be used to endorse or promote products derived from this software
18    * without specific prior written permission.
19    *
20    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    * POSSIBILITY OF SUCH DAMAGE.
31    */
32    package net.sourceforge.pebble.event;
33   
34    import net.sourceforge.pebble.api.event.blogentry.BlogEntryListener;
35    import net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent;
36    import net.sourceforge.pebble.api.event.comment.CommentListener;
37    import net.sourceforge.pebble.api.event.comment.CommentEvent;
38    import net.sourceforge.pebble.api.event.trackback.TrackBackListener;
39    import net.sourceforge.pebble.api.event.trackback.TrackBackEvent;
40    import net.sourceforge.pebble.audit.AuditTrail;
41    import net.sourceforge.pebble.domain.BlogEntry;
42    import net.sourceforge.pebble.domain.Comment;
43    import net.sourceforge.pebble.domain.TrackBack;
44   
45    /**
46    * @author Simon Brown
47    */
 
48    public class AuditListener implements BlogEntryListener, CommentListener, TrackBackListener {
49   
50    /**
51    * Called when a blog entry has been added.
52    *
53    * @param event a BlogEntryEvent instance
54    */
 
55  276 toggle public void blogEntryAdded(BlogEntryEvent event) {
56  276 BlogEntry blogEntry = event.getBlogEntry();
57  276 AuditTrail.log("Blog entry \"" + blogEntry.getTitle() + "\" (" + blogEntry.getGuid() + ") added");
58    }
59   
60    /**
61    * Called when a blog entry has been removed.
62    *
63    * @param event a BlogEntryEvent instance
64    */
 
65  18 toggle public void blogEntryRemoved(BlogEntryEvent event) {
66  18 BlogEntry blogEntry = event.getBlogEntry();
67  18 AuditTrail.log("Blog entry \"" + blogEntry.getTitle() + "\" (" + blogEntry.getGuid() + ") removed");
68    }
69   
70    /**
71    * Called when a blog entry has been changed.
72    *
73    * @param event a BlogEntryEvent instance
74    */
 
75  12 toggle public void blogEntryChanged(BlogEntryEvent event) {
76  12 BlogEntry blogEntry = event.getBlogEntry();
77  12 AuditTrail.log("Blog entry \"" + blogEntry.getTitle() + "\" (" + blogEntry.getGuid() + ") changed");
78    }
79   
80    /**
81    * Called when a blog entry has been published.
82    *
83    * @param event a BlogEntryEvent instance
84    */
 
85  14 toggle public void blogEntryPublished(BlogEntryEvent event) {
86  14 BlogEntry blogEntry = event.getBlogEntry();
87  14 AuditTrail.log("Blog entry \"" + blogEntry.getTitle() + "\" (" + blogEntry.getGuid() + ") published");
88    }
89   
90    /**
91    * Called when a blog entry has been unpublished.
92    *
93    * @param event a BlogEntryEvent instance
94    */
 
95  4 toggle public void blogEntryUnpublished(BlogEntryEvent event) {
96  4 BlogEntry blogEntry = event.getBlogEntry();
97  4 AuditTrail.log("Blog entry \"" + blogEntry.getTitle() + "\" (" + blogEntry.getGuid() + ") unpublished");
98    }
99   
100    /**
101    * Called when a comment has been added.
102    *
103    * @param event a CommentEvent instance
104    */
 
105  78 toggle public void commentAdded(CommentEvent event) {
106  78 Comment comment = event.getComment();
107  78 AuditTrail.log("Comment \"" + comment.getTitle() + "\" from " + comment.getAuthor() + " (" + comment.getGuid() + ") added");
108    }
109   
110    /**
111    * Called when a comment has been removed.
112    *
113    * @param event a CommentEvent instance
114    */
 
115  16 toggle public void commentRemoved(CommentEvent event) {
116  16 Comment comment = event.getComment();
117  16 AuditTrail.log("Comment \"" + comment.getTitle() + "\" from " + comment.getAuthor() + " (" + comment.getGuid() + ") removed");
118    }
119   
120    /**
121    * Called when a comment has been approved.
122    *
123    * @param event a CommentEvent instance
124    */
 
125  46 toggle public void commentApproved(CommentEvent event) {
126  46 Comment comment = event.getComment();
127  46 AuditTrail.log("Comment \"" + comment.getTitle() + "\" from " + comment.getAuthor() + " (" + comment.getGuid() + ") approved");
128    }
129   
130    /**
131    * Called when a comment has been rejected.
132    *
133    * @param event a CommentEvent instance
134    */
 
135  2 toggle public void commentRejected(CommentEvent event) {
136  2 Comment comment = event.getComment();
137  2 AuditTrail.log("Comment \"" + comment.getTitle() + "\" from " + comment.getAuthor() + " (" + comment.getGuid() + ") rejected");
138    }
139   
140    /**
141    * Called when a TrackBack has been added.
142    *
143    * @param event a TrackBackEvent instance
144    */
 
145  14 toggle public void trackBackAdded(TrackBackEvent event) {
146  14 TrackBack trackback = event.getTrackBack();
147  14 AuditTrail.log("TrackBack \"" + trackback.getTitle() + "\" from " + trackback.getBlogName() + " (" + trackback.getGuid() + ") added");
148    }
149   
150    /**
151    * Called when a TrackBack has been removed.
152    *
153    * @param event a TrackBackEvent instance
154    */
 
155  8 toggle public void trackBackRemoved(TrackBackEvent event) {
156  8 TrackBack trackback = event.getTrackBack();
157  8 AuditTrail.log("TrackBack \"" + trackback.getTitle() + "\" from " + trackback.getBlogName() + " (" + trackback.getGuid() + ") removed");
158    }
159   
160    /**
161    * Called when a TrackBack has been approved.
162    *
163    * @param event a TrackBackEvent instance
164    */
 
165  2 toggle public void trackBackApproved(TrackBackEvent event) {
166  2 TrackBack trackback = event.getTrackBack();
167  2 AuditTrail.log("TrackBack \"" + trackback.getTitle() + "\" from " + trackback.getBlogName() + " (" + trackback.getGuid() + ") approved");
168    }
169   
170    /**
171    * Called when a TrackBack has been rejected.
172    *
173    * @param event a TrackBackEvent instance
174    */
 
175  2 toggle public void trackBackRejected(TrackBackEvent event) {
176  2 TrackBack trackback = event.getTrackBack();
177  2 AuditTrail.log("TrackBack \"" + trackback.getTitle() + "\" from " + trackback.getBlogName() + " (" + trackback.getGuid() + ") rejected");
178    }
179    }