blogentryindexlistener.java

### File Source: blogentryindexlistener.java

             /*
        P/P   *  Method: net.sourceforge.pebble.index.BlogEntryIndexListener__static_init
              */
         1  package net.sourceforge.pebble.index;
         2
         3  import net.sourceforge.pebble.domain.BlogEntry;
         4  import net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent;
         5  import net.sourceforge.pebble.api.event.blogentry.BlogEntryListener;
         6
         7  /**
         8   * Listens to blog entry events and keeps the blog entry index up to date.
         9   *
        10   * @author    Simon Brown
        11   */
             /*
        P/P   *  Method: void net.sourceforge.pebble.index.BlogEntryIndexListener()
              */
        12  public class BlogEntryIndexListener implements BlogEntryListener {
        13
        14    /**
        15     * Called when a blog entry has been added.
        16     *
        17     * @param event a BlogEntryEvent instance
        18     */
        19    public void blogEntryAdded(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryAdded(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    (soft) net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).name != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@20 != null
                  *    blogEntry.state@20 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  *    getBlog(...).blogEntryIndex@20 != null
                  *    getBlogEntryIndex(...).blog.properties@20 != null
                  *    ...
                  */
        20      BlogEntry blogEntry = event.getBlogEntry();
        21      blogEntry.getBlog().getBlogEntryIndex().index(blogEntry);
        22    }
        23
        24    /**
        25     * Called when a blog entry has been removed.
        26     *
        27     * @param event a BlogEntryEvent instance
        28     */
        29    public void blogEntryRemoved(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryRemoved(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@30 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  *    getBlog(...).blogEntryIndex@30 != null
                  *    getBlogEntryIndex(...).blog.properties@30 != null
                  *    getBlogEntryIndex(...).blog.years@30 != null
                  *    ...
                  */
        30      BlogEntry blogEntry = event.getBlogEntry();
        31      blogEntry.getBlog().getBlogEntryIndex().unindex(blogEntry);
        32    }
        33
        34    /**
        35     * Called when a blog entry has been changed.
        36     *
        37     * @param event a BlogEntryEvent instance
        38     */
        39    public void blogEntryChanged(BlogEntryEvent event) {
               /*
        P/P     *  Method: void blogEntryChanged(BlogEntryEvent)
                */
        40    }
        41
        42    /**
        43     * Called when a blog entry has been published.
        44     *
        45     * @param event a BlogEntryEvent instance
        46     */
        47    public void blogEntryPublished(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryPublished(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    (soft) net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).name != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@48 != null
                  *    blogEntry.blog@49 != null
                  *    blogEntry.state@49 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  *    getBlog(...).blogEntryIndex@48 != null
                  *    ...
                  */
        48      BlogEntry blogEntry = event.getBlogEntry();
        49      blogEntry.getBlog().getBlogEntryIndex().unindex(blogEntry);
        50      blogEntry.getBlog().getBlogEntryIndex().index(blogEntry);
        51    }
        52
        53    /**
        54     * Called when a blog entry has been unpublished.
        55     *
        56     * @param event a BlogEntryEvent instance
        57     */
        58    public void blogEntryUnpublished(BlogEntryEvent event) {
                 /*
        P/P       *  Method: void blogEntryUnpublished(BlogEntryEvent)
                  *
                  *  Preconditions:
                  *    event != null
                  *    (soft) net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#5).name != null
                  *
                  *  Presumptions:
                  *    blogEntry.blog@59 != null
                  *    blogEntry.blog@60 != null
                  *    blogEntry.state@60 != null
                  *    net.sourceforge.pebble.api.event.blogentry.BlogEntryEvent:getSource(...)@91 != null
                  *    getBlog(...).blogEntryIndex@59 != null
                  *    ...
                  */
        59      BlogEntry blogEntry = event.getBlogEntry();
        60      blogEntry.getBlog().getBlogEntryIndex().unindex(blogEntry);
        61      blogEntry.getBlog().getBlogEntryIndex().index(blogEntry);
        62    }
        63
        64  }

SofCheck Inspector Build Version : 2.22510

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