//# 0 errors, 112 messages
//#
package net.sourceforge.pebble.decorator;
    //#blogcategoriesdecorator.java:1:1: class: net.sourceforge.pebble.decorator.BlogCategoriesDecorator
    //#blogcategoriesdecorator.java:1:1: method: net.sourceforge.pebble.decorator.BlogCategoriesDecorator.net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init

import java.util.Iterator;

import net.sourceforge.pebble.api.decorator.ContentDecoratorContext;
import net.sourceforge.pebble.domain.BlogEntry;
import net.sourceforge.pebble.domain.Category;
import net.sourceforge.pebble.util.I18n;

/**
 * Generates category links for inclusion in the body of blog entries,
 * when rendered as HTML.
 * 
 * @author Simon Brown
 */
public class BlogCategoriesDecorator extends ContentDecoratorSupport {
    //#blogcategoriesdecorator.java:16: method: void net.sourceforge.pebble.decorator.BlogCategoriesDecorator.net.sourceforge.pebble.decorator.BlogCategoriesDecorator()
    //#input(void net.sourceforge.pebble.decorator.BlogCategoriesDecorator()): this
    //#blogcategoriesdecorator.java:16: end of method: void net.sourceforge.pebble.decorator.BlogCategoriesDecorator.net.sourceforge.pebble.decorator.BlogCategoriesDecorator()

  /**
   * Decorates the specified blog entry.
   *
   * @param context   the context in which the decoration is running
   * @param blogEntry the blog entry to be decorated
   */
  public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
  if (context.getMedia() == ContentDecoratorContext.HTML_PAGE) {
    //#blogcategoriesdecorator.java:25: method: void net.sourceforge.pebble.decorator.BlogCategoriesDecorator.decorate(ContentDecoratorContext, BlogEntry)
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.__Tag
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.body
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.categories
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.excerpt
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.propertyChangeSupport
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): context
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): context.__Tag
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): context.media
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/Configuration.__Descendant_Table[net/sourceforge/pebble/Configuration]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/Configuration.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/Configuration.__Dispatch_Table.getUrl()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/Configuration.__Dispatch_Table.isVirtualHostingEnabled()Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/api/decorator/ContentDecoratorContext.__Descendant_Table[net/sourceforge/pebble/api/decorator/ContentDecoratorContext]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/api/decorator/ContentDecoratorContext.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/api/decorator/ContentDecoratorContext.__Dispatch_Table.getMedia()I
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[net/sourceforge/pebble/domain/Blog]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getId()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getUrl()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getBody()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getCategories()Ljava/util/Set;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getExcerpt()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setBody(Ljava/lang/String;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.setExcerpt(Ljava/lang/String;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogManager.__Descendant_Table[net/sourceforge/pebble/domain/BlogManager]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogManager.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogManager.__Dispatch_Table.isMultiBlog()Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogManager.instance
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogManager.instance.__Tag
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogManager.instance.multiBlog
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Category.__Descendant_Table[net/sourceforge/pebble/domain/Category]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Category.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.isRootCategory()Z
    //#output(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.body
    //#output(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.excerpt
    //#pre[6] (void decorate(ContentDecoratorContext, BlogEntry)): context != null
    //#pre[7] (void decorate(ContentDecoratorContext, BlogEntry)): context.__Tag == net/sourceforge/pebble/api/decorator/ContentDecoratorContext
    //#pre[8] (void decorate(ContentDecoratorContext, BlogEntry)): init'ed(context.media)
    //#pre[1] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry != null
    //#pre[2] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.blog)
    //#pre[4] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.categories)
    //#pre[5] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.propertyChangeSupport != null
    //#pre[9] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) net/sourceforge/pebble/domain/BlogManager.instance != null
    //#pre[10] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) net/sourceforge/pebble/domain/BlogManager.instance.__Tag == net/sourceforge/pebble/domain/BlogManager
    //#pre[11] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(net/sourceforge/pebble/domain/BlogManager.instance.multiBlog)
    //#pre[12] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.body)
    //#pre[13] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.excerpt)
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): category.blog.__Tag@35 == net/sourceforge/pebble/domain/Blog
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): category.blog@35 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): category.id@35 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:next(...).__Tag@35 == net/sourceforge/pebble/domain/Category
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:next(...)@35 != null
    //#post(void decorate(ContentDecoratorContext, BlogEntry)): init'ed(blogEntry.body)
    //#post(void decorate(ContentDecoratorContext, BlogEntry)): init'ed(blogEntry.excerpt)
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.HashSet
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getUrl
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:valueOf
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.beans.PropertyChangeSupport:firePropertyChange
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.PebbleContext:getInstance
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.PebbleContext:getConfiguration
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:substring
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): context.media: {-2_147_483_648..-1, 1..4_294_967_295}, {0}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.body: Addr_Set{null}, Inverse{null}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.excerpt: Addr_Set{null}, Inverse{null}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.lang.String:length(...)@50: {0}, {1..4_294_967_295}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.lang.String:length(...)@55: {0}, {1..4_294_967_295}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:hasNext(...)@28: {0}, {1}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:hasNext(...)@34: {1}, {0}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:hasNext(...)@42: {0}, {1}
      Iterator categories = blogEntry.getCategories().iterator();

      if (categories.hasNext()) {
        StringBuffer buf = new StringBuffer();

        buf.append("<div class=\"categories\"><span>");
        buf.append(I18n.getMessage(blogEntry.getBlog(), "category.categories"));
    //#blogcategoriesdecorator.java:32: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.util.I18n:getMessage(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.BlogCategoriesDecorator
    //#    method: void decorate(ContentDecoratorContext, BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.util.I18n:getMessage(Blog, String)
        buf.append(" : </span>");
        while (categories.hasNext()) {
          Category category = (Category)categories.next();
          buf.append("<a href=\"");
          buf.append(category.getPermalink());
          buf.append("\">");
          buf.append(category.getName());
          buf.append("</a>");

          if (categories.hasNext()) {
            buf.append(", ");
          }
        }
        buf.append("</div>");

        // now add the HTML to the body and excerpt, if they aren't empty
        String body = blogEntry.getBody();
        if (body != null && body.trim().length() > 0) {
          blogEntry.setBody(body + buf.toString());
        }

        String excerpt = blogEntry.getExcerpt();
        if (excerpt != null && excerpt.trim().length() > 0) {
          blogEntry.setExcerpt(excerpt + buf.toString());
        }
      }
    }
  }
    //#blogcategoriesdecorator.java:60: end of method: void net.sourceforge.pebble.decorator.BlogCategoriesDecorator.decorate(ContentDecoratorContext, BlogEntry)

}
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Descendant_Table[net/sourceforge/pebble/decorator/BlogCategoriesDecorator]
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/BlogEntry;)V
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/Comment;)V
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/StaticPage;)V
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/TrackBack;)V
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): net/sourceforge/pebble/api/decorator/ContentDecorator.__Descendant_Table[net/sourceforge/pebble/decorator/BlogCategoriesDecorator]
    //#output(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): net/sourceforge/pebble/decorator/ContentDecoratorSupport.__Descendant_Table[net/sourceforge/pebble/decorator/BlogCategoriesDecorator]
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Descendant_Table[net/sourceforge/pebble/decorator/BlogCategoriesDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): net/sourceforge/pebble/api/decorator/ContentDecorator.__Descendant_Table[net/sourceforge/pebble/decorator/BlogCategoriesDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): net/sourceforge/pebble/decorator/ContentDecoratorSupport.__Descendant_Table[net/sourceforge/pebble/decorator/BlogCategoriesDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/BlogEntry;)V == &decorate
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/Comment;)V == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.decorate
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/StaticPage;)V == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.decorate
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/TrackBack;)V == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.decorate
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog; == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.getBlog
    //#post(net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.setBlog
    //#blogcategoriesdecorator.java:: end of method: net.sourceforge.pebble.decorator.BlogCategoriesDecorator.net.sourceforge.pebble.decorator.BlogCategoriesDecorator__static_init
    //#blogcategoriesdecorator.java:: end of class: net.sourceforge.pebble.decorator.BlogCategoriesDecorator
