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
6   53   2   3
0   28   0,33   2
2     1  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  ViewMessagesAction       Line # 20 6 0% 2 8 0% 0.0
 
No Tests
 
1    package net.sourceforge.pebble.web.action;
2   
3    import net.sourceforge.pebble.Constants;
4    import net.sourceforge.pebble.domain.Blog;
5    import net.sourceforge.pebble.domain.Message;
6    import net.sourceforge.pebble.web.view.View;
7    import net.sourceforge.pebble.web.view.impl.MessagesView;
8   
9    import javax.servlet.ServletException;
10    import javax.servlet.http.HttpServletRequest;
11    import javax.servlet.http.HttpServletResponse;
12    import java.util.Collections;
13    import java.util.List;
14   
15    /**
16    * Allows the user to see all messages for the current blog.
17    *
18    * @author Simon Brown
19    */
 
20    public class ViewMessagesAction extends SecureAction {
21   
22    /**
23    * Peforms the processing associated with this action.
24    *
25    * @param request the HttpServletRequest instance
26    * @param response the HttpServletResponse instance
27    * @return the name of the next view
28    */
 
29  0 toggle public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
30  0 Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
31  0 List<Message> messages = blog.getMessages();
32  0 Collections.reverse(messages);
33  0 getModel().put("messages", messages);
34   
35  0 return new MessagesView();
36    }
37   
38    /**
39    * Gets a list of all roles that are allowed to access this action.
40    *
41    * @return an array of Strings representing role names
42    * @param request
43    */
 
44  0 toggle public String[] getRoles(HttpServletRequest request) {
45  0 return new String[]{
46    Constants.BLOG_ADMIN_ROLE,
47    Constants.BLOG_OWNER_ROLE,
48    Constants.BLOG_PUBLISHER_ROLE,
49    Constants.BLOG_CONTRIBUTOR_ROLE
50    };
51    }
52   
53    }