//# 0 errors, 125 messages
//#
/*
    //#publishblogentryaction.java:1:1: class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
 * 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.util.StringUtils;
import net.sourceforge.pebble.web.security.RequireSecurityToken;
import net.sourceforge.pebble.web.view.NotFoundView;
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;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;

/**
 * Allows the user to publish/unpublish a blog entry.
 *
 * @author    Simon Brown
 */
@RequireSecurityToken
public class PublishBlogEntryAction extends SecureAction {
    //#publishblogentryaction.java:57: method: void net.sourceforge.pebble.web.action.PublishBlogEntryAction.net.sourceforge.pebble.web.action.PublishBlogEntryAction()
    //#input(void net.sourceforge.pebble.web.action.PublishBlogEntryAction()): this
    //#publishblogentryaction.java:57: end of method: void net.sourceforge.pebble.web.action.PublishBlogEntryAction.net.sourceforge.pebble.web.action.PublishBlogEntryAction()

  /** the log used by this class */
  private static final Log log = LogFactory.getLog(PublishBlogEntryAction.class);
    //#publishblogentryaction.java:60: method: net.sourceforge.pebble.web.action.PublishBlogEntryAction.net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init
    //#publishblogentryaction.java:60: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Descendant_Table[net/sourceforge/pebble/web/action/PublishBlogEntryAction]
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Dispatch_Table.getLocalizedString(Ljava/lang/String;)Ljava/lang/String;
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Dispatch_Table.getModel()Lnet/sourceforge/pebble/web/model/Model;
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Dispatch_Table.getRoles(Ljavax/servlet/http/HttpServletRequest;)[Ljava/lang/String;
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__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.PublishBlogEntryAction__static_init): __Dispatch_Table.setModel(Lnet/sourceforge/pebble/web/model/Model;)V
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): log
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): net/sourceforge/pebble/web/action/Action.__Descendant_Table[net/sourceforge/pebble/web/action/PublishBlogEntryAction]
    //#output(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): net/sourceforge/pebble/web/action/SecureAction.__Descendant_Table[net/sourceforge/pebble/web/action/PublishBlogEntryAction]
    //#post(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Descendant_Table[net/sourceforge/pebble/web/action/PublishBlogEntryAction] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): net/sourceforge/pebble/web/action/Action.__Descendant_Table[net/sourceforge/pebble/web/action/PublishBlogEntryAction] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): net/sourceforge/pebble/web/action/SecureAction.__Descendant_Table[net/sourceforge/pebble/web/action/PublishBlogEntryAction] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Dispatch_Table.getLocalizedString(Ljava/lang/String;)Ljava/lang/String; == &net/sourceforge/pebble/web/action/Action.getLocalizedString
    //#post(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Dispatch_Table.getModel()Lnet/sourceforge/pebble/web/model/Model; == &net/sourceforge/pebble/web/action/Action.getModel
    //#post(net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init): __Dispatch_Table.getRoles(Ljavax/servlet/http/HttpServletRequest;)[Ljava/lang/String; == &getRoles
    //#post(net.sourceforge.pebble.web.action.PublishBlogEntryAction__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.PublishBlogEntryAction__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.PublishBlogEntryAction__static_init): init'ed(log)
    //#publishblogentryaction.java:60: end of method: net.sourceforge.pebble.web.action.PublishBlogEntryAction.net.sourceforge.pebble.web.action.PublishBlogEntryAction__static_init

  /**
   * 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);
    //#publishblogentryaction.java:70: method: View net.sourceforge.pebble.web.action.PublishBlogEntryAction.process(HttpServletRequest, HttpServletResponse)
    //#input(View process(HttpServletRequest, HttpServletResponse)): __Descendant_Table[net/sourceforge/pebble/web/action/PublishBlogEntryAction]
    //#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 NotFoundView(process#3) num objects
    //#output(View process(HttpServletRequest, HttpServletResponse)): new RedirectView(process#12) num objects
    //#output(View process(HttpServletRequest, HttpServletResponse)): return_value
    //#new obj(View process(HttpServletRequest, HttpServletResponse)): new NotFoundView(process#3)
    //#new obj(View process(HttpServletRequest, HttpServletResponse)): new RedirectView(process#12)
    //#pre[1] (View process(HttpServletRequest, HttpServletResponse)): request != null
    //#pre[3] (View process(HttpServletRequest, HttpServletResponse)): this.__Tag == net/sourceforge/pebble/web/action/PublishBlogEntryAction
    //#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)): java.lang.Object:getClass(...)@101 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): java.text.DateFormat:getDateTimeInstance(...)@88 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): java.text.DateFormat:parse(...)@111 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): java.util.HashMap:get(...)@63 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): javax.servlet.http.HttpServletRequest:getParameter(...)@72 != null
    //#presumption(View process(HttpServletRequest, HttpServletResponse)): org.apache.commons.logging.LogFactory:getLog(...)@60 != null
    //#post(View process(HttpServletRequest, HttpServletResponse)): return_value in Addr_Set{&new RedirectView(process#12),&new NotFoundView(process#3)}
    //#post(View process(HttpServletRequest, HttpServletResponse)): new NotFoundView(process#3) num objects <= 1
    //#post(View process(HttpServletRequest, HttpServletResponse)): new RedirectView(process#12) num objects <= 1
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.util.HashMap:get
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.StringBuffer
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.String:charAt
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.StringBuffer:append
    //#unanalyzed(View process(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.StringBuffer:toString
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:equals(...)@135: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:equals(...)@87: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:equalsIgnoreCase(...)@106: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:equalsIgnoreCase(...)@92: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.lang.String:length(...)@109: {0}, {1..4_294_967_295}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): java.util.Date:after(...)@112: {0}, {1}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): javax.servlet.http.HttpServletRequest:getParameter(...)@108: Addr_Set{null}, Inverse{null}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): javax.servlet.http.HttpServletRequest:getParameter(...)@73: Addr_Set{null}, Inverse{null}
    //#test_vector(View process(HttpServletRequest, HttpServletResponse)): net.sourceforge.pebble.domain.BlogService:getBlogEntry(...)@78: Inverse{null}, Addr_Set{null}
    String id = request.getParameter("entry");
    String submit = request.getParameter("submit");
    String publishDate = request.getParameter("publishDate");

    BlogService service = new BlogService();
    //#publishblogentryaction.java:75: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService()
    BlogEntry blogEntry = null;
    //#publishblogentryaction.java:76: Warning: unused assignment
    //#    unused assignment into blogEntry
    //#    severity: SUPPRESSED
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    Attribs:  Uncertain
    try {
      blogEntry = service.getBlogEntry(blog, id);
    //#publishblogentryaction.java:78: Warning: method not available
    //#    -- call on BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: BlogEntry net.sourceforge.pebble.domain.BlogService:getBlogEntry(Blog, String)
    } catch (BlogServiceException e) {
      throw new ServletException(e);
    }

    if (blogEntry == null) {
      return new NotFoundView();
    //#publishblogentryaction.java:84: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.web.view.NotFoundView()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.web.view.NotFoundView()
    }

    if (submit.equals("Publish")) {
      DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, blog.getLocale());
    //#publishblogentryaction.java:88: Warning: method not available
    //#    -- call on Locale net.sourceforge.pebble.domain.Blog:getLocale()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: Locale net.sourceforge.pebble.domain.Blog:getLocale()
      dateFormat.setTimeZone(blog.getTimeZone());
    //#publishblogentryaction.java:89: Warning: method not available
    //#    -- call on TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: TimeZone net.sourceforge.pebble.domain.Blog:getTimeZone()
      dateFormat.setLenient(false);

      if (publishDate != null && publishDate.equalsIgnoreCase("as-is")) {
        // this is the easiest scenario - just set the blog entry to published
        // TODO: localization
        try {
          blogEntry.setPublished(true);
    //#publishblogentryaction.java:96: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogEntry:setPublished(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogEntry:setPublished(bool)
          service.putBlogEntry(blogEntry);
    //#publishblogentryaction.java:97: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
          blog.info("Blog entry <a href=\"" + blogEntry.getLocalPermalink() + "\">" + blogEntry.getTitle() + "</a> published.");
    //#publishblogentryaction.java:98: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#publishblogentryaction.java:98: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#publishblogentryaction.java:98: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Blog:info(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Blog:info(String)
        } catch (BlogServiceException be) {
          // give feedback to the user that something bad has happened
          blog.error("Error publishing blog entry " + StringUtils.transformHTML(blogEntry.getTitle()) + ": " + be.getClass().getName() + " " + StringUtils.transformHTML(be.getMessage()));
    //#publishblogentryaction.java:101: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#publishblogentryaction.java:101: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogServiceException:getMessage()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogServiceException:getMessage()
    //#publishblogentryaction.java:101: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Blog:error(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Blog:error(String)
          log.error(be);
    //#publishblogentryaction.java:102: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
        }
      } else {
        Date date = new Date();
        if (publishDate != null && publishDate.equalsIgnoreCase("custom")) {
          Date now = new Date();
          String dateAsString = request.getParameter("date");
          if (dateAsString != null && dateAsString.length() > 0) {
            try {
              date = dateFormat.parse(dateAsString);
              if (date.after(now)) {
                date = now;
              }
            } catch (ParseException pe) {
              log.warn(pe);
    //#publishblogentryaction.java:116: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
            }
          }
        }

        // now save the published entry and remove the unpublished version
        try {
          log.info("Removing blog entry dated " + blogEntry.getDate());
    //#publishblogentryaction.java:123: Warning: method not available
    //#    -- call on Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#publishblogentryaction.java:123: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:info(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:info(Object)
          service.removeBlogEntry(blogEntry);
    //#publishblogentryaction.java:124: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService:removeBlogEntry(BlogEntry)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService:removeBlogEntry(BlogEntry)

          blogEntry.setDate(date);
    //#publishblogentryaction.java:126: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogEntry:setDate(Date)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogEntry:setDate(Date)
          blogEntry.setPublished(true);
    //#publishblogentryaction.java:127: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogEntry:setPublished(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogEntry:setPublished(bool)
          log.info("Putting blog entry dated " + blogEntry.getDate());
    //#publishblogentryaction.java:128: Warning: method not available
    //#    -- call on Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: Date net.sourceforge.pebble.domain.BlogEntry:getDate()
    //#publishblogentryaction.java:128: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:info(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:info(Object)
          service.putBlogEntry(blogEntry);
    //#publishblogentryaction.java:129: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
          blog.info("Blog entry <a href=\"" + blogEntry.getLocalPermalink() + "\">" + blogEntry.getTitle() + "</a> published.");
    //#publishblogentryaction.java:130: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#publishblogentryaction.java:130: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#publishblogentryaction.java:130: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Blog:info(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Blog:info(String)
        } catch (BlogServiceException be) {
          log.error(be);
    //#publishblogentryaction.java:132: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
        }
      }
    } else if (submit.equals("Unpublish")) {
      blogEntry.setPublished(false);
    //#publishblogentryaction.java:136: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogEntry:setPublished(bool)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogEntry:setPublished(bool)
      try {
        service.putBlogEntry(blogEntry);
    //#publishblogentryaction.java:138: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.BlogService:putBlogEntry(BlogEntry)
        blog.info("Blog entry <a href=\"" + blogEntry.getLocalPermalink() + "\">" + blogEntry.getTitle() + "</a> unpublished.");
    //#publishblogentryaction.java:139: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#publishblogentryaction.java:139: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getTitle()
    //#publishblogentryaction.java:139: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.domain.Blog:info(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.domain.Blog:info(String)
      } catch (BlogServiceException be) {
        log.error(be);
    //#publishblogentryaction.java:141: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
      }
    }

    return new RedirectView(blogEntry.getLocalPermalink());
    //#publishblogentryaction.java:145: Warning: method not available
    //#    -- call on String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: String net.sourceforge.pebble.domain.BlogEntry:getLocalPermalink()
    //#publishblogentryaction.java:145: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.web.view.RedirectView(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
    //#    method: View process(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void net.sourceforge.pebble.web.view.RedirectView(String)
    //#publishblogentryaction.java:145: end of method: View net.sourceforge.pebble.web.action.PublishBlogEntryAction.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_PUBLISHER_ROLE};
    //#publishblogentryaction.java:155: method: String[] net.sourceforge.pebble.web.action.PublishBlogEntryAction.getRoles(HttpServletRequest)
    //#input(String[] getRoles(HttpServletRequest)): net.sourceforge.pebble.Constants.BLOG_PUBLISHER_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_PUBLISHER_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_PUBLISHER_ROLE
    //#post(String[] getRoles(HttpServletRequest)): (soft) init'ed(return_value[0])
    //#publishblogentryaction.java:155: end of method: String[] net.sourceforge.pebble.web.action.PublishBlogEntryAction.getRoles(HttpServletRequest)
  }

}    //#publishblogentryaction.java:: end of class: net.sourceforge.pebble.web.action.PublishBlogEntryAction
