//# 0 errors, 145 messages
//#
/*
    //#manageresponsesaction.java:1:1: class: net.sourceforge.pebble.web.action.ManageResponsesAction
 * Copyright (c) 2003-2006, Simon Brown
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 *   - Neither the name of Pebble nor the names of its contributors may
 *     be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package net.sourceforge.pebble.web.action;

import net.sourceforge.pebble.Constants;
import net.sourceforge.pebble.domain.*;
import net.sourceforge.pebble.web.security.RequireSecurityToken;
import net.sourceforge.pebble.web.view.ForwardView;
import net.sourceforge.pebble.web.view.RedirectView;
import net.sourceforge.pebble.web.view.View;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Allows the user to manage recently added responses.
 *
 * @author    Simon Brown
 */
@RequireSecurityToken
public class ManageResponsesAction extends SecureAction {
    //#manageresponsesaction.java:53: method: void net.sourceforge.pebble.web.action.ManageResponsesAction.net.sourceforge.pebble.web.action.ManageResponsesAction()
    //#input(void net.sourceforge.pebble.web.action.ManageResponsesAction()): this
    //#manageresponsesaction.java:53: end of method: void net.sourceforge.pebble.web.action.ManageResponsesAction.net.sourceforge.pebble.web.action.ManageResponsesAction()

  /** the log used by this class */
  private static final Log log = LogFactory.getLog(ManageResponsesAction.class);
    //#manageresponsesaction.java:56: method: net.sourceforge.pebble.web.action.ManageResponsesAction.net.sourceforge.pebble.web.action.ManageResponsesAction__static_init
    //#manageresponsesaction.java:56: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: net.sourceforge.pebble.web.action.ManageResponsesAction__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Descendant_Table[net/sourceforge/pebble/web/action/ManageResponsesAction]
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getBlogEntryResponse(Lnet/sourceforge/pebble/domain/Blog;Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Response;
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getLocalizedString(Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getModel()Lnet/sourceforge/pebble/web/model/Model;
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getRoles(Ljavax/servlet/http/HttpServletRequest;)[Ljava/lang/String;
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.process(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Lnet/sourceforge/pebble/web/view/View;
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.setModel(Lnet/sourceforge/pebble/web/model/Model;)V
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): log
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): net/sourceforge/pebble/web/action/Action.__Descendant_Table[net/sourceforge/pebble/web/action/ManageResponsesAction]
    //#output(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): net/sourceforge/pebble/web/action/SecureAction.__Descendant_Table[net/sourceforge/pebble/web/action/ManageResponsesAction]
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Descendant_Table[net/sourceforge/pebble/web/action/ManageResponsesAction] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): net/sourceforge/pebble/web/action/Action.__Descendant_Table[net/sourceforge/pebble/web/action/ManageResponsesAction] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): net/sourceforge/pebble/web/action/SecureAction.__Descendant_Table[net/sourceforge/pebble/web/action/ManageResponsesAction] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getBlogEntryResponse(Lnet/sourceforge/pebble/domain/Blog;Ljava/lang/String;)Lnet/sourceforge/pebble/domain/Response; == &getBlogEntryResponse
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getLocalizedString(Ljava/lang/String;)Ljava/lang/String; == &net/sourceforge/pebble/web/action/Action.getLocalizedString
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getModel()Lnet/sourceforge/pebble/web/model/Model; == &net/sourceforge/pebble/web/action/Action.getModel
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.getRoles(Ljavax/servlet/http/HttpServletRequest;)[Ljava/lang/String; == &getRoles
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.process(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Lnet/sourceforge/pebble/web/view/View; == &process
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): __Dispatch_Table.setModel(Lnet/sourceforge/pebble/web/model/Model;)V == &net/sourceforge/pebble/web/action/Action.setModel
    //#post(net.sourceforge.pebble.web.action.ManageResponsesAction__static_init): init'ed(log)
    //#manageresponsesaction.java:56: end of method: net.sourceforge.pebble.web.action.ManageResponsesAction.net.sourceforge.pebble.web.action.ManageResponsesAction__static_init

  /** constant used to represent a comment */
  private static final String COMMENT = "c";

  /** constant used to represent a TrackBack */
  private static final String TRACKBACK = "t";

  /**
   * Peforms the processing associated with this action.
   *
   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    //#manageresponsesaction.java:72: method: View net.sourceforge.pebble.web.action.ManageResponsesAction.process(HttpServletRequest, HttpServletResponse)
    //#input(View process(HttpServletRequest, HttpServletResponse)): __Descendant_Table[net/sourceforge/pebble/web/action/ManageResponsesAction]
    //#input(View process(HttpServletRequest, HttpServletResponse)): __Descendant_Table[others]
    //#input(View process(HttpServletRequest, HttpServletResponse)): __Dispatch_Table.getModel()Lnet/sourceforge/pebble/web/model/Model;
    //#input(View process(HttpServletRequest, HttpServletResponse)): log
    //#input(View process(HttpServletRequest, HttpServletResponse)): net/sourceforge/pebble/web/model/Model.__Descendant_Table[net/sourceforge/pebble/web/model/Model]
    //#input(View process(HttpServletRequest, HttpServletResponse)): net/sourceforge/pebble/web/model/Model.__Descendant_Table[others]
    //#input(View process(HttpServletRequest, HttpServletResponse)): net/sourceforge/pebble/web/model/Model.__Dispatch_Table.get(Ljava/lang/String;)Ljava/lang/Object;
    //#input(View process(HttpServletRequest, HttpServletResponse)): request
    //#input(View process(HttpServletRequest, HttpServletResponse)): this
    //#input(View process(HttpServletRequest, HttpServletResponse)): this.__Tag
    //#input(View process(HttpServletRequest, HttpServletResponse)): this.model
    //#input(View process(HttpServletRequest, HttpServletResponse)): this.model.__Tag
    //#input(View process(HttpServletRequest, HttpServletResponse)): this.model.data
    //#output(View process(HttpServletRequest, HttpServletResponse)): new ForwardView(process#6) num objects
    //#output(View process(HttpServletRequest, HttpServletResponse)): new ForwardView(process#6).__Tag
    //#output(View process(HttpServletRequest, HttpServletResponse)): new ForwardView(process#6).uri
    //#output(View process(HttpServletRequest, HttpServletResponse)): new RedirectView(process#5) num objects
    //#output(View process(HttpServletRequest, HttpServletResponse)): return_value
    //#new obj(View process(HttpServletRequest, HttpServletResponse)): new ForwardView(process#6)
    //#new obj(View process(HttpServletRequest, HttpServletResponse)): new RedirectView(process#5)
    //#pre[1] (View process(HttpServletRequest, HttpServletResponse)): request != null
    //#pre[3] (View process(HttpServletRequest, HttpServletResponse)): this.__Tag == net/sourceforge/pebble/web/action/ManageResponsesAction
    //#pre[4] (View process(HttpServletRequest, HttpServletResponse)): this.model != null
    //#pre[5] (View process(HttpServletRequest, HttpServletResponse)): this.model.__Tag == net/sourceforge/pebble/web/model/Model
    //#pre[6] (View process(HttpServletRequest, HttpServletResponse)): this.model.data != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): Local_10[Local_8]@73 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): ids.length@73 <= 4_294_967_295
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): java.util.HashMap:get(...)@63 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): net.sourceforge.pebble.domain.Response:getBlogEntry(...)@103 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): org.apache.commons.logging.LogFactory:getLog(...)@56 != null
    //#post(View process(HttpServletRequest, HttpServletResponse)): return_value in Addr_Set{&new RedirectView(process#5),&new ForwardView(process#6)}
    //#post(View process(HttpServletRequest, HttpServletResponse)): new ForwardView(process#6) num objects <= 1
    //#post(View process(HttpServletRequest, HttpServletResponse)): new ForwardView(process#6).__Tag == net/sourceforge/pebble/web/view/ForwardView
    //#post(View process(HttpServletRequest, HttpServletResponse)): new ForwardView(process#6).uri == &".viewResponses.secureaction"
    //#post(View process(HttpServletRequest, HttpServletResponse)): new RedirectView(process#5) num objects <= 1
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.String:lastIndexOf
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:net.sourceforge.pebble.domain.BlogService
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:net.sourceforge.pebble.domain.BlogService:getBlogEntry
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.String:equalsIgnoreCase
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.Long:parseLong
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getComment
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:net.sourceforge.pebble.domain.BlogEntry:getTrackBack
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.apache.commons.logging.Log:warn
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.ServletException
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.util.HashMap:get
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:net.sourceforge.pebble.web.view.View
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:equalsIgnoreCase(...)@101: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:equalsIgnoreCase(...)@85: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:equalsIgnoreCase(...)@93: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:length(...)@115: {0}, {1..4_294_967_295}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): javax.servlet.http.HttpServletRequest:getParameter(...)@114: Addr_Set{null}, Inverse{null}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): javax.servlet.http.HttpServletRequest:getParameter(...)@74: Addr_Set{null}, Inverse{null}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): javax.servlet.http.HttpServletRequest:getParameterValues(...)@73: Addr_Set{null}, Inverse{null}
    String ids[] = request.getParameterValues("response");
    String submit = request.getParameter("submit");
    BlogService service = new BlogService();
    //#manageresponsesaction.java:75: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService()

    if (ids != null && submit != null) {
      for (String id : ids) {
        Response ber = getBlogEntryResponse(blog, id);

        if (ber == null) {
          continue;
        }

        if (submit.equalsIgnoreCase("Approve")) {
          try {
            ber.setApproved();
    //#manageresponsesaction.java:87: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Response:setApproved()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Response:setApproved()
            service.putBlogEntry(ber.getBlogEntry());
    //#manageresponsesaction.java:88: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#manageresponsesaction.java:88: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
            blog.info("Response <a href=\"" + ber.getPermalink() + "\">" + ber.getTitle() + " (" + ber.getSourceName() + ")</a> approved.");
    //#manageresponsesaction.java:89: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Response:getPermalink()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Response:getPermalink()
    //#manageresponsesaction.java:89: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Response:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Response:getTitle()
    //#manageresponsesaction.java:89: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Response:getSourceName()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Response:getSourceName()
    //#manageresponsesaction.java:89: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Blog:info(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Blog:info(String)
          } catch (BlogServiceException be) {
            log.error("Error updating state for response", be);
    //#manageresponsesaction.java:91: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
          }
        } else if (submit.equalsIgnoreCase("Reject")) {
          try {
            ber.setRejected();
    //#manageresponsesaction.java:95: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Response:setRejected()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Response:setRejected()
            service.putBlogEntry(ber.getBlogEntry());
    //#manageresponsesaction.java:96: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#manageresponsesaction.java:96: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
            blog.info("Response \"" + ber.getTitle() + "\" (" + ber.getSourceName() + ") rejected.");
    //#manageresponsesaction.java:97: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Response:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Response:getTitle()
    //#manageresponsesaction.java:97: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Response:getSourceName()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Response:getSourceName()
    //#manageresponsesaction.java:97: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Blog:info(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Blog:info(String)
          } catch (BlogServiceException be) {
            log.error("Error updating state for response", be);
    //#manageresponsesaction.java:99: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
          }
        } else if (submit.equalsIgnoreCase("Remove")) {
          try {
            ber.getBlogEntry().removeResponse(ber);
    //#manageresponsesaction.java:103: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#manageresponsesaction.java:103: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogEntry:removeResponse(Response)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogEntry:removeResponse(Response)
            service.putBlogEntry(ber.getBlogEntry());
    //#manageresponsesaction.java:104: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.Response:getBlogEntry()
    //#manageresponsesaction.java:104: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
            blog.info("Response \"" + ber.getTitle() + "\" (" + ber.getSourceName() + ") removed.");
    //#manageresponsesaction.java:105: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Response:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Response:getTitle()
    //#manageresponsesaction.java:105: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.Response:getSourceName()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.Response:getSourceName()
    //#manageresponsesaction.java:105: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Blog:info(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Blog:info(String)
          } catch (BlogServiceException be) {
            log.error("Error updating state for response", be);
    //#manageresponsesaction.java:107: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
          }
        }

      }
    }

    String redirectUrl = request.getParameter("redirectUrl");
    if (redirectUrl != null && redirectUrl.trim().length() > 0) {
      return new RedirectView(redirectUrl);
    //#manageresponsesaction.java:116: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.web.view.RedirectView(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.web.view.RedirectView(String)
    } else {
      return new ForwardView("/viewResponses.secureaction");
    //#manageresponsesaction.java:118: end of method: View net.sourceforge.pebble.web.action.ManageResponsesAction.process(HttpServletRequest, HttpServletResponse)
    }
  }

  /**
   * Gets a list of all roles that are allowed to access this action.
   *
   * @return  an array of Strings representing role names
   * @param request
   */
  public String[] getRoles(HttpServletRequest request) {
    return new String[]{Constants.BLOG_CONTRIBUTOR_ROLE};
    //#manageresponsesaction.java:129: method: String[] net.sourceforge.pebble.web.action.ManageResponsesAction.getRoles(HttpServletRequest)
    //#input(String[] getRoles(HttpServletRequest)): net.sourceforge.pebble.Constants.BLOG_CONTRIBUTOR_ROLE
    //#output(String[] getRoles(HttpServletRequest)): new String[](getRoles#1) num objects
    //#output(String[] getRoles(HttpServletRequest)): return_value.length
    //#output(String[] getRoles(HttpServletRequest)): return_value[0]
    //#output(String[] getRoles(HttpServletRequest)): return_value
    //#new obj(String[] getRoles(HttpServletRequest)): new String[](getRoles#1)
    //#presumption(String[] getRoles(HttpServletRequest)): init'ed(net.sourceforge.pebble.Constants.BLOG_CONTRIBUTOR_ROLE)
    //#post(String[] getRoles(HttpServletRequest)): return_value == &new String[](getRoles#1)
    //#post(String[] getRoles(HttpServletRequest)): new String[](getRoles#1) num objects == 1
    //#post(String[] getRoles(HttpServletRequest)): return_value.length == 1
    //#post(String[] getRoles(HttpServletRequest)): return_value[0] == net.sourceforge.pebble.Constants.BLOG_CONTRIBUTOR_ROLE
    //#post(String[] getRoles(HttpServletRequest)): (soft) init'ed(return_value[0])
    //#manageresponsesaction.java:129: end of method: String[] net.sourceforge.pebble.web.action.ManageResponsesAction.getRoles(HttpServletRequest)
  }

  private Response getBlogEntryResponse(Blog blog, String guid) throws ServletException {
    // response key is of the form type/blogEntryId/responseId
    String type = guid.substring(0, 1);
    //#manageresponsesaction.java:134: method: Response net.sourceforge.pebble.web.action.ManageResponsesAction.getBlogEntryResponse(Blog, String)
    //#input(Response getBlogEntryResponse(Blog, String)): blog
    //#input(Response getBlogEntryResponse(Blog, String)): guid
    //#input(Response getBlogEntryResponse(Blog, String)): log
    //#output(Response getBlogEntryResponse(Blog, String)): return_value
    //#pre[2] (Response getBlogEntryResponse(Blog, String)): guid != null
    //#presumption(Response getBlogEntryResponse(Blog, String)): java.lang.String:lastIndexOf(...)@136 <= 4_294_967_294
    //#presumption(Response getBlogEntryResponse(Blog, String)): org.apache.commons.logging.LogFactory:getLog(...)@56 != null
    //#post(Response getBlogEntryResponse(Blog, String)): init'ed(return_value)
    //#test_vector(Response getBlogEntryResponse(Blog, String)): java.lang.String:equalsIgnoreCase(...)@150: {0}, {1}
    //#test_vector(Response getBlogEntryResponse(Blog, String)): java.lang.String:equalsIgnoreCase(...)@152: {0}, {1}
    //#test_vector(Response getBlogEntryResponse(Blog, String)): net.sourceforge.pebble.domain.BlogService:getBlogEntry(...)@141: Inverse{null}, Addr_Set{null}
    String blogEntryId = guid.substring(2, guid.indexOf("/", 2));
    String responseId = guid.substring(guid.lastIndexOf("/")+1);

    BlogService service = new BlogService();
    //#manageresponsesaction.java:138: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService()
    BlogEntry blogEntry = null;
    //#manageresponsesaction.java:139: Warning: unused assignment
    //#    unused assignment into blogEntry
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    Attribs:  Uncertain
    try {
      blogEntry = service.getBlogEntry(blog, blogEntryId);
    //#manageresponsesaction.java:141: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    } catch (BlogServiceException e) {
      throw new ServletException(e);
    }
    if (blogEntry == null) {
      return null;
    }

    try {
      if (type != null && type.equalsIgnoreCase(COMMENT)) {
    //#manageresponsesaction.java:150: Warning: test always goes same way
    //#    test predetermined because type != null
    //#    severity: LOW
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    from bb: bb_7
    //#    live edge: bb_7-->bb_8
    //#    tested vn: java.lang.String:substring(...)@134 == null
    //#    tested vn values: {0}
        return blogEntry.getComment(Long.parseLong(responseId));
    //#manageresponsesaction.java:151: Warning: method not available
    //#    -- call on Comment net.sourceforge.pebble.domain.BlogEntry:getComment(long)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    unanalyzed callee: Comment net.sourceforge.pebble.domain.BlogEntry:getComment(long)
      } else if (type != null && type.equalsIgnoreCase(TRACKBACK)) {
    //#manageresponsesaction.java:152: Warning: test always goes same way
    //#    test predetermined because type != null
    //#    severity: LOW
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    from bb: bb_11
    //#    live edge: bb_11-->bb_12
    //#    tested vn: java.lang.String:substring(...)@134 == null
    //#    tested vn values: {0}
        return blogEntry.getTrackBack(Long.parseLong(responseId));
    //#manageresponsesaction.java:153: Warning: method not available
    //#    -- call on TrackBack net.sourceforge.pebble.domain.BlogEntry:getTrackBack(long)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    unanalyzed callee: TrackBack net.sourceforge.pebble.domain.BlogEntry:getTrackBack(long)
      }
    } catch (NumberFormatException e) {
      log.warn(e);
    //#manageresponsesaction.java:156: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.ManageResponsesAction
    //#    method: Response getBlogEntryResponse(Blog, String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
    }

    return null;
    //#manageresponsesaction.java:159: end of method: Response net.sourceforge.pebble.web.action.ManageResponsesAction.getBlogEntryResponse(Blog, String)
  }

}    //#manageresponsesaction.java:: end of class: net.sourceforge.pebble.web.action.ManageResponsesAction
