Clover Coverage Report - Pebble 2.5-SNAPSHOT
Coverage timestamp: Sat Jun 12 2010 09:39:29 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
8   48   6   4
4   20   0,75   2
2     3  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  BlogTagsDecorator       Line # 13 8 0% 6 0 100% 1.0
 
  (20)
 
1    package net.sourceforge.pebble.decorator;
2   
3    import net.sourceforge.pebble.domain.BlogEntry;
4    import net.sourceforge.pebble.domain.PageBasedContent;
5    import net.sourceforge.pebble.api.decorator.ContentDecoratorContext;
6   
7    /**
8    * Generates tag links for inclusion in the body of blog entries,
9    * when rendered as HTML and newsfeeds.
10    *
11    * @author Simon Brown
12    */
 
13    public class BlogTagsDecorator extends AbstractTagsDecorator {
14   
15    /**
16    * Decorates the specified blog entry.
17    *
18    * @param context the context in which the decoration is running
19    * @param blogEntry the blog entry to be decorated
20    * if something goes wrong when running the decorator
21    */
 
22  20 toggle @Override
23    public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
24  20 String html = generateDecorationHtml(context, blogEntry);
25   
26    // now add the tags to the body and excerpt, if they aren't empty
27  20 String body = blogEntry.getBody();
28  20 if (body != null && body.trim().length() > 0) {
29  14 blogEntry.setBody(body + html);
30    }
31   
32  20 String excerpt = blogEntry.getExcerpt();
33  20 if (excerpt != null && excerpt.trim().length() > 0) {
34  8 blogEntry.setExcerpt(excerpt + html);
35    }
36    }
37   
38    /**
39    * Gets the base URL for tag links, complete with trailing slash.
40    *
41    * @param content the owning content
42    * @return a URL as a String
43    */
 
44  4 toggle public String getBaseUrl(PageBasedContent content) {
45  4 return content.getBlog().getUrl() + "tags/";
46    }
47   
48    }