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