auditlistener.java

### File Source: auditlistener.java

             /*
        P/P   *  Method: net.sourceforge.pebble.event.AuditListener__static_init
              */
         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   */
             /*
        P/P   *  Method: void net.sourceforge.pebble.event.AuditListener()
              */
        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    public void blogEntryAdded(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryAdded(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@56 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  */
        56      BlogEntry blogEntry = event.getBlogEntry();
        57      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    public void blogEntryRemoved(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryRemoved(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@66 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  */
        66      BlogEntry blogEntry = event.getBlogEntry();
        67      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    public void blogEntryChanged(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryChanged(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@76 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  */
        76      BlogEntry blogEntry = event.getBlogEntry();
        77      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    public void blogEntryPublished(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryPublished(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@86 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  */
        86      BlogEntry blogEntry = event.getBlogEntry();
        87      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    public void blogEntryUnpublished(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryUnpublished(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@96 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  */
        96      BlogEntry blogEntry = event.getBlogEntry();
        97      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    public void commentAdded(CommentEvent event) {
                 /*
        P/P       *  Method: void commentAdded(CommentEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    comment.blogEntry@106 != null
                  *    comment.date@106 != null
                  *    net.sourceforge.pebble.api.event.comment.CommentEvent:getSource(...)@72 != null
                  */
       106      Comment comment = event.getComment();
       107      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    public void commentRemoved(CommentEvent event) {
                 /*
        P/P       *  Method: void commentRemoved(CommentEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    comment.blogEntry@116 != null
                  *    comment.date@116 != null
                  *    net.sourceforge.pebble.api.event.comment.CommentEvent:getSource(...)@72 != null
                  */
       116      Comment comment = event.getComment();
       117      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    public void commentApproved(CommentEvent event) {
                 /*
        P/P       *  Method: void commentApproved(CommentEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    comment.blogEntry@126 != null
                  *    comment.date@126 != null
                  *    net.sourceforge.pebble.api.event.comment.CommentEvent:getSource(...)@72 != null
                  */
       126      Comment comment = event.getComment();
       127      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    public void commentRejected(CommentEvent event) {
                 /*
        P/P       *  Method: void commentRejected(CommentEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    comment.blogEntry@136 != null
                  *    comment.date@136 != null
                  *    net.sourceforge.pebble.api.event.comment.CommentEvent:getSource(...)@72 != null
                  */
       136      Comment comment = event.getComment();
       137      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    public void trackBackAdded(TrackBackEvent event) {
                 /*
        P/P       *  Method: void trackBackAdded(TrackBackEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    net.sourceforge.pebble.api.event.trackback.TrackBackEvent:getSource(...)@72 != null
                  *    trackback.blogEntry@147 != null
                  *    trackback.date@147 != null
                  */
       146      TrackBack trackback = event.getTrackBack();
       147      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    public void trackBackRemoved(TrackBackEvent event) {
                 /*
        P/P       *  Method: void trackBackRemoved(TrackBackEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    net.sourceforge.pebble.api.event.trackback.TrackBackEvent:getSource(...)@72 != null
                  *    trackback.blogEntry@157 != null
                  *    trackback.date@157 != null
                  */
       156      TrackBack trackback = event.getTrackBack();
       157      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    public void trackBackApproved(TrackBackEvent event) {
                 /*
        P/P       *  Method: void trackBackApproved(TrackBackEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    net.sourceforge.pebble.api.event.trackback.TrackBackEvent:getSource(...)@72 != null
                  *    trackback.blogEntry@167 != null
                  *    trackback.date@167 != null
                  */
       166      TrackBack trackback = event.getTrackBack();
       167      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    public void trackBackRejected(TrackBackEvent event) {
                 /*
        P/P       *  Method: void trackBackRejected(TrackBackEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    net/sourceforge/pebble/audit/AuditTrail.log != null
                  *
                  *  Presumptions:
                  *    net.sourceforge.pebble.api.event.trackback.TrackBackEvent:getSource(...)@72 != null
                  *    trackback.blogEntry@177 != null
                  *    trackback.date@177 != null
                  */
       176      TrackBack trackback = event.getTrackBack();
       177      AuditTrail.log("TrackBack \"" + trackback.getTitle() + "\" from " + trackback.getBlogName() + " (" + trackback.getGuid() + ") rejected");
       178    }
       179  }

SofCheck Inspector Build Version : 2.22510

auditlistener.java | 2010-Jun-25 19:40:32
auditlistener.class | 2010-Jul-19 20:23:40