File Source: resetthemeaction.java

         /* 
    P/P   *  Method: net.sourceforge.pebble.web.action.ResetThemeAction__static_init
          */
     1  package net.sourceforge.pebble.web.action;
     2  
     3  import net.sourceforge.pebble.web.security.RequireSecurityToken;
     4  import net.sourceforge.pebble.web.view.View;
     5  import net.sourceforge.pebble.web.view.ForwardView;
     6  import net.sourceforge.pebble.domain.Blog;
     7  import net.sourceforge.pebble.Constants;
     8  import net.sourceforge.pebble.util.Utilities;
     9  
         /* 
    P/P   *  Method: void net.sourceforge.pebble.web.action.ResetThemeAction()
          */
    10  import javax.servlet.http.HttpServletRequest;
    11  import javax.servlet.http.HttpServletResponse;
    12  import javax.servlet.ServletException;
    13  
    14  /**
    15   * Resets the theme associated with a blog back to "default".
    16   *
    17   * @author    Simon Brown
    18   */
    19  @RequireSecurityToken
    20  public class ResetThemeAction 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    public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
             /* 
    P/P       *  Method: View process(HttpServletRequest, HttpServletResponse)
              * 
              *  Preconditions:
              *    this.model != null
              *    this.model.data != null
              * 
              *  Presumptions:
              *    java.util.HashMap:get(...)@63 != null
              * 
              *  Postconditions:
              *    return_value == &new ForwardView(process#1)
              *    new ForwardView(process#1) num objects == 1
              *    return_value.uri == &".reloadBlog.secureaction"
              */
    30      Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    31      Utilities.resetTheme(blog);
    32      return new ForwardView("/reloadBlog.secureaction");
    33    }
    34  
    35    /**
    36     * Gets a list of all roles that are allowed to access this action.
    37     *
    38     * @return  an array of Strings representing role names
    39     * @param request
    40     */
    41    public String[] getRoles(HttpServletRequest request) {
             /* 
    P/P       *  Method: String[] getRoles(HttpServletRequest)
              * 
              *  Presumptions:
              *    init'ed(net.sourceforge.pebble.Constants.BLOG_ADMIN_ROLE)
              *    init'ed(net.sourceforge.pebble.Constants.BLOG_OWNER_ROLE)
              * 
              *  Postconditions:
              *    return_value == &new String[](getRoles#1)
              *    new String[](getRoles#1) num objects == 1
              *    return_value.length == 2
              *    return_value[0] == net.sourceforge.pebble.Constants.BLOG_OWNER_ROLE
              *    (soft) init'ed(return_value[0])
              *    return_value[1] == net.sourceforge.pebble.Constants.BLOG_ADMIN_ROLE
              *    (soft) init'ed(return_value[1])
              */
    42      return new String[]{Constants.BLOG_OWNER_ROLE, Constants.BLOG_ADMIN_ROLE};
    43    }
    44  
    45  }








SofCheck Inspector Build Version : 2.22510
resetthemeaction.java 2010-Jun-25 19:40:34
resetthemeaction.class 2010-Jul-19 20:23:38