Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../../img/srcFileCovDistChart0.png 48% of files have more coverage
7   41   3   7
4   21   0,43   1
1     3  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  IsBlogPublisherTag       Line # 18 7 0% 3 12 0% 0.0
 
No Tests
 
1    package net.sourceforge.pebble.web.tagext;
2   
3    import net.sourceforge.pebble.domain.AbstractBlog;
4    import net.sourceforge.pebble.domain.Blog;
5    import net.sourceforge.pebble.Constants;
6    import net.sourceforge.pebble.util.SecurityUtils;
7   
8    import javax.servlet.jsp.tagext.TagSupport;
9    import javax.servlet.jsp.JspException;
10    import javax.servlet.http.HttpServletRequest;
11   
12    /**
13    * A custom tag that includes its body content if the current user belongs to
14    * the "blog publisher" role for the blog.
15    *
16    * @author Simon Brown
17    */
 
18    public class IsBlogPublisherTag extends TagSupport {
19   
20    /**
21    * Implementation from the Tag interface - this is called when the opening tag
22    * is encountered.
23    *
24    * @return an integer specifying what to do afterwards
25    * @throws javax.servlet.jsp.JspException if something goes wrong
26    */
 
27  0 toggle public int doStartTag() throws JspException {
28  0 HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
29  0 AbstractBlog abstractBlog = (AbstractBlog)request.getAttribute(Constants.BLOG_KEY);
30   
31  0 if (abstractBlog instanceof Blog) {
32  0 Blog blog = (Blog)abstractBlog;
33  0 if (SecurityUtils.isUserAuthorisedForBlogAsBlogPublisher(blog)) {
34  0 return EVAL_BODY_INCLUDE;
35    }
36    }
37   
38  0 return SKIP_BODY;
39    }
40   
41    }