| 1 |  |  | 
            
  
    | 2 |  |  | 
            
  
    | 3 |  |  | 
            
  
    | 4 |  |  | 
            
  
    | 5 |  |  | 
            
  
    | 6 |  |  | 
            
  
    | 7 |  |  | 
            
  
    | 8 |  |  | 
            
  
    | 9 |  |  | 
            
  
    | 10 |  |  | 
            
  
    | 11 |  |  | 
            
  
    | 12 |  |  | 
            
  
    | 13 |  |  | 
            
  
    | 14 |  |  | 
            
  
    | 15 |  |  | 
            
  
    | 16 |  |  | 
            
  
    | 17 |  |  | 
            
  
    | 18 |  |  | 
            
  
    | 19 |  |  | 
            
  
    | 20 |  |  | 
            
  
    | 21 |  |  | 
            
  
    | 22 |  |  | 
            
  
    | 23 |  |  | 
            
  
    | 24 |  |  | 
            
  
    | 25 |  |  | 
            
  
    | 26 |  |  | 
            
  
    | 27 |  |  | 
            
  
    | 28 |  |  | 
            
  
    | 29 |  |  | 
            
  
    | 30 |  |  | 
            
  
    | 31 |  |  | 
            
  
    | 32 |  | package net.sourceforge.pebble.web.action; | 
            
  
    | 33 |  |  | 
            
  
    | 34 |  | import net.sourceforge.pebble.Constants; | 
            
  
    | 35 |  | import net.sourceforge.pebble.comparator.BlogEntryComparator; | 
            
  
    | 36 |  | import net.sourceforge.pebble.domain.Blog; | 
            
  
    | 37 |  | import net.sourceforge.pebble.web.view.ForwardView; | 
            
  
    | 38 |  | import net.sourceforge.pebble.web.view.View; | 
            
  
    | 39 |  | import net.sourceforge.pebble.web.view.impl.AtomView; | 
            
  
    | 40 |  | import net.sourceforge.pebble.web.view.impl.RdfView; | 
            
  
    | 41 |  | import net.sourceforge.pebble.web.view.impl.RssView; | 
            
  
    | 42 |  |  | 
            
  
    | 43 |  | import javax.servlet.ServletException; | 
            
  
    | 44 |  | import javax.servlet.http.HttpServletRequest; | 
            
  
    | 45 |  | import javax.servlet.http.HttpServletResponse; | 
            
  
    | 46 |  | import java.util.Collections; | 
            
  
    | 47 |  | import java.util.List; | 
            
  
    | 48 |  | import java.util.Locale; | 
            
  
    | 49 |  |  | 
            
  
    | 50 |  |  | 
            
  
    | 51 |  |  | 
            
  
    | 52 |  |  | 
            
  
    | 53 |  | @author | 
            
  
    | 54 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 23 (23) | Complexity: 8 | Complexity Density: 0,53 |  | 
  
  
    | 55 |  | public class ExportBlogAction extends SecureAction { | 
            
  
    | 56 |  |  | 
            
  
    | 57 |  |  | 
            
  
    | 58 |  |  | 
            
  
    | 59 |  |  | 
            
  
    | 60 |  | @param | 
            
  
    | 61 |  | @param | 
            
  
    | 62 |  | @return | 
            
  
    | 63 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 20 (20) | Complexity: 7 | Complexity Density: 0,5 |  | 
  
  
    | 64 | 0 |  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {... | 
            
  
    | 65 | 0 | String flavor = request.getParameter("flavor"); | 
            
  
    | 66 |  |  | 
            
  
    | 67 | 0 | if (flavor != null && flavor.equalsIgnoreCase("zip")) { | 
            
  
    | 68 | 0 | return new ForwardView("/zipDirectory.secureaction?type=blogData"); | 
            
  
    | 69 |  | } | 
            
  
    | 70 |  |  | 
            
  
    | 71 | 0 | Blog blog = (Blog)getModel().get(Constants.BLOG_KEY); | 
            
  
    | 72 |  |  | 
            
  
    | 73 | 0 | response.setContentType("application/xml; charset=" + blog.getCharacterEncoding()); | 
            
  
    | 74 |  |  | 
            
  
    | 75 | 0 | List blogEntries = blog.getBlogEntries(); | 
            
  
    | 76 | 0 | Collections.sort(blogEntries, new BlogEntryComparator()); | 
            
  
    | 77 | 0 | getModel().put(Constants.BLOG_ENTRIES, blogEntries); | 
            
  
    | 78 |  |  | 
            
  
    | 79 |  |  | 
            
  
    | 80 | 0 | javax.servlet.jsp.jstl.core.Config.set( | 
            
  
    | 81 |  | request, | 
            
  
    | 82 |  | javax.servlet.jsp.jstl.core.Config.FMT_LOCALE, | 
            
  
    | 83 |  | Locale.ENGLISH); | 
            
  
    | 84 |  |  | 
            
  
    | 85 | 0 | if (flavor != null && flavor.equalsIgnoreCase("atom")) { | 
            
  
    | 86 | 0 | return new AtomView(); | 
            
  
    | 87 | 0 | } else if (flavor != null && flavor.equalsIgnoreCase("rdf")) { | 
            
  
    | 88 | 0 | return new RdfView(); | 
            
  
    | 89 |  | } else { | 
            
  
    | 90 | 0 | return new RssView(); | 
            
  
    | 91 |  | } | 
            
  
    | 92 |  | } | 
            
  
    | 93 |  |  | 
            
  
    | 94 |  |  | 
            
  
    | 95 |  |  | 
            
  
    | 96 |  |  | 
            
  
    | 97 |  | @return | 
            
  
    | 98 |  | @param | 
            
  
    | 99 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 100 | 0 |  public String[] getRoles(HttpServletRequest request) {... | 
            
  
    | 101 | 0 | return new String[]{Constants.BLOG_ADMIN_ROLE, Constants.BLOG_OWNER_ROLE}; | 
            
  
    | 102 |  | } | 
            
  
    | 103 |  |  | 
            
  
    | 104 |  | } |