//# 0 errors, 121 messages
//#
package net.sourceforge.pebble.decorator;
    //#hideunapprovedresponsesdecorator.java:1:1: class: net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator
    //#hideunapprovedresponsesdecorator.java:1:1: method: net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator.net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init

import net.sourceforge.pebble.domain.BlogEntry;
import net.sourceforge.pebble.domain.Comment;
import net.sourceforge.pebble.domain.TrackBack;
import net.sourceforge.pebble.util.SecurityUtils;
import net.sourceforge.pebble.api.decorator.ContentDecoratorContext;

import java.util.List;

/**
 * Hides unapproved responses (comments and TrackBacks) if the current user is
 * not a blog contributor.
 * 
 * @author Simon Brown
 */
public class HideUnapprovedResponsesDecorator extends ContentDecoratorSupport {
    //#hideunapprovedresponsesdecorator.java:17: method: void net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator.net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator()
    //#input(void net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator()): this
    //#hideunapprovedresponsesdecorator.java:17: end of method: void net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator.net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator()

  /**
   * 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 (!SecurityUtils.isUserAuthorisedForBlogAsBlogContributor(blogEntry.getBlog())) {
    //#hideunapprovedresponsesdecorator.java:26: method: void net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator.decorate(ContentDecoratorContext, BlogEntry)
    //#hideunapprovedresponsesdecorator.java:26: Warning: method not available
    //#    -- call on bool net.sourceforge.pebble.util.SecurityUtils:isUserAuthorisedForBlogAsBlogContributor(Blog)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator
    //#    method: void decorate(ContentDecoratorContext, BlogEntry)
    //#    unanalyzed callee: bool net.sourceforge.pebble.util.SecurityUtils:isUserAuthorisedForBlogAsBlogContributor(Blog)
    //#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.comments
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.events
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.eventsEnabled
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): blogEntry.trackBacks
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#1).__Tag
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#1).name
    //#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.addEvent(Lnet/sourceforge/pebble/api/event/PebbleEvent;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.areEventsEnabled()Z
    //#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.getComment(J)Lnet/sourceforge/pebble/domain/Comment;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getComments()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getTrackBack(J)Lnet/sourceforge/pebble/domain/TrackBack;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.getTrackBacks()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.removeComment(J)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.__Dispatch_Table.removeTrackBack(J)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/BlogEntry.log
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Descendant_Table[net/sourceforge/pebble/domain/Comment]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.areEventsEnabled()Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getBlogEntry()Lnet/sourceforge/pebble/domain/BlogEntry;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getComments()Ljava/util/List;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getId()J
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getParent()Lnet/sourceforge/pebble/domain/Comment;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.isApproved()Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.removeComment(Lnet/sourceforge/pebble/domain/Comment;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Comment.__Dispatch_Table.setParent(Lnet/sourceforge/pebble/domain/Comment;)V
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Response.__Descendant_Table[net/sourceforge/pebble/domain/Comment]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Response.__Descendant_Table[net/sourceforge/pebble/domain/Response]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Response.__Descendant_Table[net/sourceforge/pebble/domain/TrackBack]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Response.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/Response.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/State.APPROVED
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/State.__Descendant_Table[net/sourceforge/pebble/domain/State]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/State.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/State.__Dispatch_Table.equals(Ljava/lang/Object;)Z
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/State.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/TrackBack.__Descendant_Table[net/sourceforge/pebble/domain/TrackBack]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/TrackBack.__Descendant_Table[others]
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.getId()J
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.getState()Lnet/sourceforge/pebble/domain/State;
    //#input(void decorate(ContentDecoratorContext, BlogEntry)): net/sourceforge/pebble/domain/TrackBack.__Dispatch_Table.isApproved()Z
    //#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)): init'ed(blogEntry.blog)
    //#pre[4] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.comments != null
    //#pre[5] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.events != null
    //#pre[6] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) init'ed(blogEntry.eventsEnabled)
    //#pre[7] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) blogEntry.trackBacks != null
    //#pre[8] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) net.sourceforge.pebble.domain.State__static_init.new State(State__static_init#1).name != null
    //#pre[9] (void decorate(ContentDecoratorContext, BlogEntry)): (soft) net/sourceforge/pebble/domain/BlogEntry.log != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): comment.date@30 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): comment.state.__Tag@29 == net/sourceforge/pebble/domain/State
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): comment.state@29 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.List:get(...).__Tag@29 == net/sourceforge/pebble/domain/Comment
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.List:get(...).__Tag@37 == net/sourceforge/pebble/domain/TrackBack
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.List:get(...)@29 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.List:get(...)@37 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.List:size(...)@28 >= -2_147_483_647
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): java.util.List:size(...)@36 >= -2_147_483_647
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): trackBack.date@38 != null
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): trackBack.state.__Tag@37 == net/sourceforge/pebble/domain/State
    //#presumption(void decorate(ContentDecoratorContext, BlogEntry)): trackBack.state@37 != null
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getComments
    //#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.ArrayList
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:addAll
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getState
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.Date:getTime
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:areEventsEnabled
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.api.event.PebbleEvent
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getBlogEntry
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.EventObject
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:addEvent
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getComment
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:contains
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:java.util.List:remove
    //#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:org.apache.commons.logging.Log:warn
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:removeComment
    //#unanalyzed(void decorate(ContentDecoratorContext, BlogEntry)): Effects-of-calling:getTrackBack
    //#test_vector(void decorate(ContentDecoratorContext, BlogEntry)): net.sourceforge.pebble.util.SecurityUtils:isUserAuthorisedForBlogAsBlogContributor(...)@26: {1}, {0}
      List comments = blogEntry.getComments();
      for (int i = comments.size()-1; i >= 0; i--) {
        Comment comment = (Comment)comments.get(i);
        if (!comment.isApproved()) {
          blogEntry.removeComment(comment.getId());
        }
      }

      List trackBacks = blogEntry.getTrackBacks();
      for (int i = trackBacks.size()-1; i >= 0; i--) {
        TrackBack trackBack = (TrackBack)trackBacks.get(i);
        if (!trackBack.isApproved()) {
          blogEntry.removeTrackBack(trackBack.getId());
        }
      }
    }
  }
    //#hideunapprovedresponsesdecorator.java:43: end of method: void net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator.decorate(ContentDecoratorContext, BlogEntry)

}
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Descendant_Table[net/sourceforge/pebble/decorator/HideUnapprovedResponsesDecorator]
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/BlogEntry;)V
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/Comment;)V
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/StaticPage;)V
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/TrackBack;)V
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog;
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): net/sourceforge/pebble/api/decorator/ContentDecorator.__Descendant_Table[net/sourceforge/pebble/decorator/HideUnapprovedResponsesDecorator]
    //#output(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): net/sourceforge/pebble/decorator/ContentDecoratorSupport.__Descendant_Table[net/sourceforge/pebble/decorator/HideUnapprovedResponsesDecorator]
    //#post(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Descendant_Table[net/sourceforge/pebble/decorator/HideUnapprovedResponsesDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): net/sourceforge/pebble/api/decorator/ContentDecorator.__Descendant_Table[net/sourceforge/pebble/decorator/HideUnapprovedResponsesDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): net/sourceforge/pebble/decorator/ContentDecoratorSupport.__Descendant_Table[net/sourceforge/pebble/decorator/HideUnapprovedResponsesDecorator] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.decorate(Lnet/sourceforge/pebble/api/decorator/ContentDecoratorContext;Lnet/sourceforge/pebble/domain/BlogEntry;)V == &decorate
    //#post(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__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.HideUnapprovedResponsesDecorator__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.HideUnapprovedResponsesDecorator__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.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.getBlog()Lnet/sourceforge/pebble/domain/Blog; == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.getBlog
    //#post(net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init): __Dispatch_Table.setBlog(Lnet/sourceforge/pebble/domain/Blog;)V == &net/sourceforge/pebble/decorator/ContentDecoratorSupport.setBlog
    //#hideunapprovedresponsesdecorator.java:: end of method: net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator.net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator__static_init
    //#hideunapprovedresponsesdecorator.java:: end of class: net.sourceforge.pebble.decorator.HideUnapprovedResponsesDecorator
