//# 0 errors, 49 messages
//#
/*
    //#comments.java:1:1: class: net.sourceforge.pebble.web.dwr.Comments
 * 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.dwr;

import net.sourceforge.pebble.domain.Comment;
import net.sourceforge.pebble.domain.Blog;
import net.sourceforge.pebble.domain.BlogManager;
import net.sourceforge.pebble.api.decorator.ContentDecoratorContext;

import java.util.ResourceBundle;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Service interface for DWR.
 *
 * @author    Simon Brown
 */
public class Comments {
    //#comments.java:49: method: void net.sourceforge.pebble.web.dwr.Comments.net.sourceforge.pebble.web.dwr.Comments()
    //#comments.java:49: end of method: void net.sourceforge.pebble.web.dwr.Comments.net.sourceforge.pebble.web.dwr.Comments()

  private static final Log log = LogFactory.getLog(Comments.class);
    //#comments.java:51: method: net.sourceforge.pebble.web.dwr.Comments.net.sourceforge.pebble.web.dwr.Comments__static_init
    //#comments.java:51: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: net.sourceforge.pebble.web.dwr.Comments__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.web.dwr.Comments__static_init): __Descendant_Table[net/sourceforge/pebble/web/dwr/Comments]
    //#output(net.sourceforge.pebble.web.dwr.Comments__static_init): __Dispatch_Table.previewComment(Ljava/lang/String;Lnet/sourceforge/pebble/domain/Comment;)Lnet/sourceforge/pebble/domain/Comment;
    //#output(net.sourceforge.pebble.web.dwr.Comments__static_init): __Dispatch_Table.saveComment(Ljava/lang/String;Lnet/sourceforge/pebble/domain/Comment;)Lnet/sourceforge/pebble/domain/Comment;
    //#output(net.sourceforge.pebble.web.dwr.Comments__static_init): log
    //#post(net.sourceforge.pebble.web.dwr.Comments__static_init): __Descendant_Table[net/sourceforge/pebble/web/dwr/Comments] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.dwr.Comments__static_init): __Dispatch_Table.previewComment(Ljava/lang/String;Lnet/sourceforge/pebble/domain/Comment;)Lnet/sourceforge/pebble/domain/Comment; == &previewComment
    //#post(net.sourceforge.pebble.web.dwr.Comments__static_init): __Dispatch_Table.saveComment(Ljava/lang/String;Lnet/sourceforge/pebble/domain/Comment;)Lnet/sourceforge/pebble/domain/Comment; == &saveComment
    //#post(net.sourceforge.pebble.web.dwr.Comments__static_init): init'ed(log)
    //#comments.java:51: end of method: net.sourceforge.pebble.web.dwr.Comments.net.sourceforge.pebble.web.dwr.Comments__static_init

  public Comment previewComment(String blogId, Comment comment) {
    Blog blog = BlogManager.getInstance().getBlog(blogId);
    //#comments.java:54: method: Comment net.sourceforge.pebble.web.dwr.Comments.previewComment(String, Comment)
    //#comments.java:54: Warning: method not available
    //#    -- call on BlogManager net.sourceforge.pebble.domain.BlogManager:getInstance()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment previewComment(String, Comment)
    //#    unanalyzed callee: BlogManager net.sourceforge.pebble.domain.BlogManager:getInstance()
    //#comments.java:54: Warning: method not available
    //#    -- call on Blog net.sourceforge.pebble.domain.BlogManager:getBlog(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment previewComment(String, Comment)
    //#    unanalyzed callee: Blog net.sourceforge.pebble.domain.BlogManager:getBlog(String)
    //#input(Comment previewComment(String, Comment)): blogId
    //#input(Comment previewComment(String, Comment)): comment
    //#output(Comment previewComment(String, Comment)): return_value
    //#presumption(Comment previewComment(String, Comment)): net.sourceforge.pebble.domain.Blog:getContentDecoratorChain(...)@60 != null
    //#presumption(Comment previewComment(String, Comment)): net.sourceforge.pebble.domain.BlogManager:getBlog(...)@54 != null
    //#presumption(Comment previewComment(String, Comment)): net.sourceforge.pebble.domain.BlogManager:getInstance(...)@54 != null
    //#post(Comment previewComment(String, Comment)): return_value == comment
    //#post(Comment previewComment(String, Comment)): init'ed(return_value)

    ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
    //#comments.java:56: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.api.decorator.ContentDecoratorContext()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment previewComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.api.decorator.ContentDecoratorContext()
    decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
    //#comments.java:57: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setView(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment previewComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setView(int)
    decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);
    //#comments.java:58: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setMedia(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment previewComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setMedia(int)

    blog.getContentDecoratorChain().decorate(decoratorContext, comment);
    //#comments.java:60: Warning: method not available
    //#    -- call on ContentDecoratorChain net.sourceforge.pebble.domain.Blog:getContentDecoratorChain()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment previewComment(String, Comment)
    //#    unanalyzed callee: ContentDecoratorChain net.sourceforge.pebble.domain.Blog:getContentDecoratorChain()
    //#comments.java:60: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.decorator.ContentDecoratorChain:decorate(ContentDecoratorContext, Comment)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment previewComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.decorator.ContentDecoratorChain:decorate(ContentDecoratorContext, Comment)

    return comment;
    //#comments.java:62: end of method: Comment net.sourceforge.pebble.web.dwr.Comments.previewComment(String, Comment)
  }

  public Comment saveComment(String blogId, Comment comment) {
    Blog blog = BlogManager.getInstance().getBlog(blogId);
    //#comments.java:66: method: Comment net.sourceforge.pebble.web.dwr.Comments.saveComment(String, Comment)
    //#comments.java:66: Warning: method not available
    //#    -- call on BlogManager net.sourceforge.pebble.domain.BlogManager:getInstance()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment saveComment(String, Comment)
    //#    unanalyzed callee: BlogManager net.sourceforge.pebble.domain.BlogManager:getInstance()
    //#comments.java:66: Warning: method not available
    //#    -- call on Blog net.sourceforge.pebble.domain.BlogManager:getBlog(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment saveComment(String, Comment)
    //#    unanalyzed callee: Blog net.sourceforge.pebble.domain.BlogManager:getBlog(String)
    //#input(Comment saveComment(String, Comment)): blogId
    //#input(Comment saveComment(String, Comment)): comment
    //#output(Comment saveComment(String, Comment)): return_value
    //#presumption(Comment saveComment(String, Comment)): net.sourceforge.pebble.domain.Blog:getContentDecoratorChain(...)@72 != null
    //#presumption(Comment saveComment(String, Comment)): net.sourceforge.pebble.domain.BlogManager:getBlog(...)@66 != null
    //#presumption(Comment saveComment(String, Comment)): net.sourceforge.pebble.domain.BlogManager:getInstance(...)@66 != null
    //#post(Comment saveComment(String, Comment)): return_value == comment
    //#post(Comment saveComment(String, Comment)): init'ed(return_value)

    ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
    //#comments.java:68: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.api.decorator.ContentDecoratorContext()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment saveComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.api.decorator.ContentDecoratorContext()
    decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
    //#comments.java:69: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setView(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment saveComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setView(int)
    decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);
    //#comments.java:70: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setMedia(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment saveComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.api.decorator.ContentDecoratorContext:setMedia(int)

    blog.getContentDecoratorChain().decorate(decoratorContext, comment);
    //#comments.java:72: Warning: method not available
    //#    -- call on ContentDecoratorChain net.sourceforge.pebble.domain.Blog:getContentDecoratorChain()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment saveComment(String, Comment)
    //#    unanalyzed callee: ContentDecoratorChain net.sourceforge.pebble.domain.Blog:getContentDecoratorChain()
    //#comments.java:72: Warning: method not available
    //#    -- call on void net.sourceforge.pebble.decorator.ContentDecoratorChain:decorate(ContentDecoratorContext, Comment)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.dwr.Comments
    //#    method: Comment saveComment(String, Comment)
    //#    unanalyzed callee: void net.sourceforge.pebble.decorator.ContentDecoratorChain:decorate(ContentDecoratorContext, Comment)

    return comment;
    //#comments.java:74: end of method: Comment net.sourceforge.pebble.web.dwr.Comments.saveComment(String, Comment)
  }

}
    //#comments.java:: end of class: net.sourceforge.pebble.web.dwr.Comments
