//# 0 errors, 254 messages
//#
package net.sourceforge.pebble.decorator;
    //#relatedpostsdecorator.java:1:1: class: net.sourceforge.pebble.decorator.RelatedPostsDecorator

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import net.sourceforge.pebble.PluginProperties;
import net.sourceforge.pebble.api.decorator.ContentDecoratorContext;
import net.sourceforge.pebble.domain.Blog;
import net.sourceforge.pebble.domain.BlogEntry;
import net.sourceforge.pebble.domain.Tag;
import net.sourceforge.pebble.util.I18n;
import net.sourceforge.pebble.util.StringUtils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Adds related posts to the current post. The posts are selected by matching
 * tags of the current post to the tags of other posts in the blog. One related
 * post per tag.
 * 
 * Each blog entry can have up to six related posts or none.
 * 
 * @author Alexander Zagniotov
 */
public class RelatedPostsDecorator extends ContentDecoratorSupport {
    //#relatedpostsdecorator.java:27: method: void net.sourceforge.pebble.decorator.RelatedPostsDecorator.net.sourceforge.pebble.decorator.RelatedPostsDecorator()
    //#input(void net.sourceforge.pebble.decorator.RelatedPostsDecorator()): this
    //#relatedpostsdecorator.java:27: end of method: void net.sourceforge.pebble.decorator.RelatedPostsDecorator.net.sourceforge.pebble.decorator.RelatedPostsDecorator()

  private static final Log log = LogFactory.getLog(RelatedPostsDecorator.class);
    //#relatedpostsdecorator.java:29: method: net.sourceforge.pebble.decorator.RelatedPostsDecorator.net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init
    //#relatedpostsdecorator.java:29: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.RelatedPostsDecorator
    //#    method: net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Descendant_Table[net/sourceforge/pebble/decorator/RelatedPostsDecorator]
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/BlogEntry;)V
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/Comment;)V
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/StaticPage;)V
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/TrackBack;)V
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): log
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): net/sourceforge/pebble/api/decorator/ContentDecorator.__Descendant_Table[net/sourceforge/pebble/decorator/RelatedPostsDecorator]
    //#output(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): net/sourceforge/pebble/decorator/ContentDecoratorSupport.__Descendant_Table[net/sourceforge/pebble/decorator/RelatedPostsDecorator]
    //#post(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Descendant_Table[net/sourceforge/pebble/decorator/RelatedPostsDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): net/sourceforge/pebble/api/decorator/ContentDecorator.__Descendant_Table[net/sourceforge/pebble/decorator/RelatedPostsDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): net/sourceforge/pebble/decorator/ContentDecoratorSupport.__Descendant_Table[net/sourceforge/pebble/decorator/RelatedPostsDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/BlogEntry;)V == &decorate
    //#post(net.sourceforge.pebble.decorator.RelatedPostsDecorator__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.RelatedPostsDecorator__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.RelatedPostsDecorator__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.RelatedPostsDecorator__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog; == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.getBlog
    //#post(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.setBlog
    //#post(net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init): init'ed(log)
    //#relatedpostsdecorator.java:29: end of method: net.sourceforge.pebble.decorator.RelatedPostsDecorator.net.sourceforge.pebble.decorator.RelatedPostsDecorator__static_init

  /** the name of the max number of posts property */
  public static final String MAX_POSTS = "RelatedPostsDecorator.maxPosts";

  /**
   * 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) {

    PluginProperties props = blogEntry.getBlog().getPluginProperties();
    //#relatedpostsdecorator.java:44: method: void net.sourceforge.pebble.decorator.RelatedPostsDecorator.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.blog.__Tag
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.pluginProperties
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.rootCategory
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.rootCategory...__Tag
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.rootCategory...parent
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.rootCategory...tagsAsList
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.rootCategory.__Tag
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.rootCategory.parent
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.rootCategory.tagsAsList
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.years
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.body
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.categories
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.propertyChangeSupport
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.tagsAsList
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.title
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): log
    //#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/permalink/PermalinkProvider.__Descendant_Table[net/sourceforge/pebble/api/permalink/PermalinkProvider]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/api/permalink/PermalinkProvider.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/api/permalink/PermalinkProvider.__Dispatch_Table.getPermalink(Lnet/sourceforge/pebble/domain/BlogEntry;)Ljava/lang/String;
    //#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.getBlogEntries()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getBlogForMonth(II)Lnet/sourceforge/pebble/domain/Month;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getBlogForYear(I)Lnet/sourceforge/pebble/domain/Year;
    //#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.getPermalinkProvider()Lnet/sourceforge/pebble/api/permalink/PermalinkProvider;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getPluginProperties()Lnet/sourceforge/pebble/PluginProperties;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Blog.__Dispatch_Table.getRootCategory()Lnet/sourceforge/pebble/domain/Category;
    //#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/Blog.log
    //#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.getAllTags()Ljava/util/List;
    //#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.getLocalPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getOriginalPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getTagsAsList()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getTitle()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.hasTag(Ljava/lang/String;)Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.isAggregated()Z
    //#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/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/BlogService.__Descendant_Table[net/sourceforge/pebble/domain/BlogService]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogService.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogService.__Dispatch_Table.getBlogEntries(Lnet/sourceforge/pebble/domain/Blog;II)Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogService.__Dispatch_Table.getBlogEntry(Lnet/sourceforge/pebble/domain/Blog;Ljava/lang/String;)Lnet/sourceforge/pebble/domain/BlogEntry;
    //#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.getAllTags()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getParent()Lnet/sourceforge/pebble/domain/Category;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Category.__Dispatch_Table.getTagsAsList()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Day.__Descendant_Table[net/sourceforge/pebble/domain/Day]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Day.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Day.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Day.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Day.__Dispatch_Table.getDay()I
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Day.__Dispatch_Table.getMonth()Lnet/sourceforge/pebble/domain/Month;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Day.__Dispatch_Table.setDate(Ljava/util/Date;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Descendant_Table[net/sourceforge/pebble/domain/Month]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.getAllDays()[Lnet/sourceforge/pebble/domain/Day;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.getBlogEntries()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.getBlogForDay(I)Lnet/sourceforge/pebble/domain/Day;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.getDate()Ljava/util/Date;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.getMonth()I
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.getYear()Lnet/sourceforge/pebble/domain/Year;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Month.__Dispatch_Table.setDate(Ljava/util/Date;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/BlogEntry]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/PageBasedContent]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[net/sourceforge/pebble/domain/StaticPage]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Dispatch_Table.getLocalPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Dispatch_Table.getOriginalPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/PageBasedContent.__Dispatch_Table.isAggregated()Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/StaticPage.__Descendant_Table[net/sourceforge/pebble/domain/StaticPage]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/StaticPage.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/StaticPage.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/StaticPage.__Dispatch_Table.getLocalPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/StaticPage.__Dispatch_Table.getOriginalPermalink()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/StaticPage.__Dispatch_Table.isAggregated()Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/domain/Tag]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[net/sourceforge/pebble/index/IndexedTag]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Tag.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Tag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Year.__Descendant_Table[net/sourceforge/pebble/domain/Year]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Year.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Year.__Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Year.__Dispatch_Table.getBlogForMonth(I)Lnet/sourceforge/pebble/domain/Month;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Year.__Dispatch_Table.getMonths()[Lnet/sourceforge/pebble/domain/Month;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Year.__Dispatch_Table.getYear()I
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Year.__Dispatch_Table.setDate(Ljava/util/Date;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/index/IndexedTag.__Dispatch_Table.setName(Ljava/lang/String;)V
    //#output(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.body
    //#pre[1] (void decorate(ContentDecoratorContext, BlogEntry)): blogEntry != null
    //#pre[2] (void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.__Tag == net/sourceforge/pebble/domain/BlogEntry
    //#pre[3] (void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog != null
    //#pre[4] (void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.__Tag == net/sourceforge/pebble/domain/Blog
    //#pre[5] (void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.blog.pluginProperties != null
    //#pre[21] (void decorate(ContentDecoratorContext, BlogEntry)): init'ed(blogEntry.body)
    //#pre[6] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.blog.rootCategory != null
    //#pre[7] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.blog.rootCategory...__Tag == net/sourceforge/pebble/domain/Category
    //#pre[8] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory...parent)
    //#pre[9] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory...tagsAsList)
    //#pre[10] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.blog.rootCategory.__Tag == net/sourceforge/pebble/domain/Category
    //#pre[11] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory.parent)
    //#pre[12] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.blog.rootCategory.tagsAsList)
    //#pre[13] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.blog.years != null
    //#pre[14] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.categories)
    //#pre[15] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.propertyChangeSupport != null
    //#pre[16] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.tagsAsList != null
    //#pre[17] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.title)
    //#pre[18] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) net/sourceforge/pebble/domain/BlogManager.instance != null
    //#pre[19] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) net/sourceforge/pebble/domain/BlogManager.instance.__Tag == net/sourceforge/pebble/domain/BlogManager
    //#pre[20] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(net/sourceforge/pebble/domain/BlogManager.instance.multiBlog)
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.__Tag@85 == net/sourceforge/pebble/domain/BlogEntry
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.blog.__Tag@85 == net/sourceforge/pebble/domain/Blog
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.blog.__Tag@90 == net/sourceforge/pebble/domain/Blog
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.blog.rootCategory...__Tag@77 == net/sourceforge/pebble/domain/Category
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.blog.rootCategory.__Tag@85 == net/sourceforge/pebble/domain/Category
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.blog.rootCategory@77 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.blog@77 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.blog@90 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.tagsAsList@77 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): entry.title@77 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:next(...).__Tag@77 == net/sourceforge/pebble/domain/BlogEntry
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:next(...).__Tag@85 in {net/sourceforge/pebble/domain/Tag, net/sourceforge/pebble/index/IndexedTag}
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:next(...)@77 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:next(...)@85 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): org.apache.commons.logging.LogFactory:getLog(...)@29 != null
    //#post(void decorate(ContentDecoratorContext, BlogEntry)): init'ed(blogEntry.body)
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getBlog
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.HashSet
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Set:iterator
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:contains
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Set:size
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:addAll
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Collections:reverse
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getRootCategory
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Collections:sort
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:size
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:get
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getConfiguredFactory
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getBlogEntryDAO
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getId
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getCompositeKeyForBlogEntry
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:valueOf
    //#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:setPersistent
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:setEventsEnabled
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.BlogServiceException
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sf.ehcache.Cache:get
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sf.ehcache.Element:getValue
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:loadBlogEntry
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sf.ehcache.Element
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sf.ehcache.Cache:put
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:clone
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getBlogEntry
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getBlogForMonth
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.IllegalArgumentException
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getBlogEntries
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getLocalPermalink
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getUrl
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.beans.PropertyChangeSupport:firePropertyChange
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.Blog:getCalendar
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Calendar:set
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Calendar:getTime
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:setDate
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.Month
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.TimePeriod
    //#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
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getPermalinkProvider
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getPermalink
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getMonth
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Calendar:setTime
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Calendar:getActualMaximum
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getYear
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.Month:getBlog
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.body: Addr_Set{null}, Inverse{null}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.lang.String:equals(...)@80: {0}, {1}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.lang.String:length(...)@60: {0}, {1..4_294_967_295}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:hasNext(...)@77: {1}, {0}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Iterator:hasNext(...)@85: {1}, {0}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Set:add(...)@90: {0}, {1}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): java.util.Set:size(...)@103: {-2_147_483_648..-1, 1..4_294_967_295}, {0}
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): net.sourceforge.pebble.PluginProperties:hasProperty(...)@47: {0}, {1}
    int maxPosts = StringUtils.MAX_NUM_OF_POSTS;

    if (props.hasProperty(RelatedPostsDecorator.MAX_POSTS)) {
    //#relatedpostsdecorator.java:47: Warning: method not available
    //#    -- call on bool net.sourceforge.pebble.PluginProperties:hasProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.RelatedPostsDecorator
    //#    method: void decorate(ContentDecoratorContext, BlogEntry)
    //#    unanalyzed callee: bool net.sourceforge.pebble.PluginProperties:hasProperty(String)
      try {
        maxPosts = Integer.parseInt(props.getProperty(MAX_POSTS));
    //#relatedpostsdecorator.java:49: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.PluginProperties:getProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.RelatedPostsDecorator
    //#    method: void decorate(ContentDecoratorContext, BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.PluginProperties:getProperty(String)
      }
      catch (NumberFormatException nfe) {
        log.error(nfe.getMessage());
    //#relatedpostsdecorator.java:52: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.RelatedPostsDecorator
    //#    method: void decorate(ContentDecoratorContext, BlogEntry)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
        // do nothing, the value has already been defaulted
      }
    }

    Blog blog = blogEntry.getBlog();
    String body = blogEntry.getBody();

    if (body != null && body.trim().length() > 0) {

      StringBuffer buf = new StringBuffer();
      buf.append(body);
      buf.append("<p><b>" + I18n.getMessage(blog, "common.relatedPosts") + "</b><br />");
    //#relatedpostsdecorator.java:64: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.util.I18n:getMessage(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.RelatedPostsDecorator
    //#    method: void decorate(ContentDecoratorContext, BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.util.I18n:getMessage(Blog, String)

      // tags of the current entry
      List<Tag> currentEntryTags = blogEntry.getAllTags();

      // all blog entries of the current blog
      List<BlogEntry> allBlogEntries = (List<BlogEntry>) blog.getBlogEntries();

      // temporary holder for accumulated unique related posts.
      // using hash set assures that we wont have same related post twice for
      // different tags.
      Set<BlogEntry> relatedEntries = new HashSet<BlogEntry>();

      for (BlogEntry entry : allBlogEntries) {

        // don't add current entry as a related post of it self, skip it
        if (entry.getTitle().equals(blogEntry.getTitle()))
          continue;

        // loop through each of the current entry tags, and try to find related
        // post by matching current tag to the posts tags
        for (Tag currentTag : currentEntryTags) {
          if (entry.hasTag(currentTag.getName())) {
            // if we successfully selected related post - create hyperlink for
            // it
            // TODO: Missing escaping -- XSS vulnerabilities here :(
            if (relatedEntries.add(entry))
              buf.append("<a href=\"" + entry.getPermalink() + "\" rel=\"bookmark\" title=\"" + entry.getTitle()
                  + "\">" + entry.getTitle() + "</a><br />");
          }
        }

        // do not allow more than default amount of posts or
        // amount set through the RelatedPostsDecorator.maxPosts property
        if (relatedEntries.size() == maxPosts) {
          break;
        }
      }

      if (relatedEntries.size() == 0)
        buf.append("<i>" + I18n.getMessage(blog, "common.noRelatedPosts") + "</i>");
    //#relatedpostsdecorator.java:104: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.util.I18n:getMessage(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.RelatedPostsDecorator
    //#    method: void decorate(ContentDecoratorContext, BlogEntry)
    //#    unanalyzed callee: String net.sourceforge.pebble.util.I18n:getMessage(Blog, String)

      buf.append("</p><br />");
      blogEntry.setBody(buf.toString());
    }
  }
    //#relatedpostsdecorator.java:109: end of method: void net.sourceforge.pebble.decorator.RelatedPostsDecorator.decorate(ContentDecoratorContext, BlogEntry)
}
    //#relatedpostsdecorator.java:: end of class: net.sourceforge.pebble.decorator.RelatedPostsDecorator
