File Source: WeblogEntryCommentForm.java

         /* 
    P/P   *  Method: org.apache.roller.weblogger.ui.rendering.util.WeblogEntryCommentForm__static_init
          */
     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one or more
     3   *  contributor license agreements.  The ASF licenses this file to You
     4   * under the Apache License, Version 2.0 (the "License"); you may not
     5   * use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.  For additional information regarding
    15   * copyright in this work, please see the NOTICE file in the top level
    16   * directory of this distribution.
    17   */
    18  
    19  package org.apache.roller.weblogger.ui.rendering.util;
    20  
    21  import org.apache.commons.lang.StringEscapeUtils;
    22  import org.apache.roller.weblogger.pojos.WeblogEntryComment;
    23  import org.apache.roller.weblogger.pojos.wrapper.WeblogEntryCommentWrapper;
    24  
    25  
    26  /**
    27   * A simple class to represent the comment form displayed on a weblog entry
    28   * permalink page.  We use this class to manage the interaction with that form.
    29   */
    30  public class WeblogEntryCommentForm {
    31      
    32      private boolean error = false;
    33      private String message = null;
    34      
    35      private String name = "";
    36      private String email = "";
    37      private String url = "";
    38      private String content = "";
    39      private boolean notify = false;
    40      
    41      private WeblogEntryComment previewComment = null;
    42      
    43      
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.ui.rendering.util.WeblogEntryCommentForm()
              * 
              *  Postconditions:
              *    this.content == &""
              *    this.email == &""
              *    this.name == &""
              *    this.url == &""
              *    this.error == 0
              *    this.notify == 0
              *    this.message == null
              *    this.previewComment == null
              */
    44      public WeblogEntryCommentForm() {}
    45      
    46      
    47      public void setPreview(WeblogEntryComment preview) {
                 /* 
    P/P           *  Method: void setPreview(WeblogEntryComment)
                  * 
                  *  Preconditions:
                  *    preview != null
                  * 
                  *  Postconditions:
                  *    init'ed(this.content)
                  *    init'ed(this.email)
                  *    init'ed(this.name)
                  *    init'ed(this.notify)
                  *    this.previewComment == preview
                  *    this.previewComment != null
                  *    init'ed(this.url)
                  */
    48          this.previewComment = preview;
    49          setData(preview);
    50      }
    51      
    52      public void setData(WeblogEntryComment comment) {
                 /* 
    P/P           *  Method: void setData(WeblogEntryComment)
                  * 
                  *  Preconditions:
                  *    comment != null
                  * 
                  *  Presumptions:
                  *    org.apache.roller.weblogger.pojos.WeblogEntryComment:getNotify(...)@57 != null
                  * 
                  *  Postconditions:
                  *    init'ed(this.content)
                  *    init'ed(this.email)
                  *    init'ed(this.name)
                  *    init'ed(this.notify)
                  *    init'ed(this.url)
                  */
    53          this.name = comment.getName();
    54          this.email = comment.getEmail();
    55          this.url = comment.getUrl();
    56          this.content = comment.getContent();
    57          this.notify = comment.getNotify().booleanValue();
    58      }
    59      
    60      public void setError(String errorMessage) {
                 /* 
    P/P           *  Method: void setError(String)
                  * 
                  *  Postconditions:
                  *    this.error == 1
                  *    this.message == errorMessage
                  *    init'ed(this.message)
                  */
    61          this.error = true;
    62          this.message = errorMessage;
    63      }
    64      
    65      public WeblogEntryCommentWrapper getPreviewComment() {
    66          // NOTE: no need for url strategy when wrapping preview comment
                 /* 
    P/P           *  Method: WeblogEntryCommentWrapper getPreviewComment()
                  * 
                  *  Preconditions:
                  *    init'ed(this.previewComment)
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    67          return WeblogEntryCommentWrapper.wrap(previewComment, null);
    68      }
    69      
    70      public boolean isPreview() {
                 /* 
    P/P           *  Method: bool isPreview()
                  * 
                  *  Preconditions:
                  *    init'ed(this.previewComment)
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    71          return (this.previewComment != null);
    72      }
    73      
    74      public String getName() {
                 /* 
    P/P           *  Method: String getName()
                  * 
                  *  Preconditions:
                  *    init'ed(this.name)
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    75          return StringEscapeUtils.escapeHtml(name);
    76      }
    77  
    78      public void setName(String name) {
                 /* 
    P/P           *  Method: void setName(String)
                  * 
                  *  Postconditions:
                  *    this.name == name
                  *    init'ed(this.name)
                  */
    79          this.name = name;
    80      }
    81  
    82      public String getEmail() {
                 /* 
    P/P           *  Method: String getEmail()
                  * 
                  *  Preconditions:
                  *    init'ed(this.email)
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    83          return StringEscapeUtils.escapeHtml(email);
    84      }
    85  
    86      public void setEmail(String email) {
                 /* 
    P/P           *  Method: void setEmail(String)
                  * 
                  *  Postconditions:
                  *    this.email == email
                  *    init'ed(this.email)
                  */
    87          this.email = email;
    88      }
    89  
    90      public String getUrl() {
                 /* 
    P/P           *  Method: String getUrl()
                  * 
                  *  Preconditions:
                  *    init'ed(this.url)
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    91          return StringEscapeUtils.escapeHtml(url);
    92      }
    93  
    94      public void setUrl(String url) {
                 /* 
    P/P           *  Method: void setUrl(String)
                  * 
                  *  Postconditions:
                  *    this.url == url
                  *    init'ed(this.url)
                  */
    95          this.url = url;
    96      }
    97  
    98      public String getContent() {
                 /* 
    P/P           *  Method: String getContent()
                  * 
                  *  Preconditions:
                  *    init'ed(this.content)
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
    99          return StringEscapeUtils.escapeHtml(content);
   100      }
   101  
   102      public void setContent(String content) {
                 /* 
    P/P           *  Method: void setContent(String)
                  * 
                  *  Postconditions:
                  *    this.content == content
                  *    init'ed(this.content)
                  */
   103          this.content = content;
   104      }
   105  
   106      public boolean isNotify() {
                 /* 
    P/P           *  Method: bool isNotify()
                  * 
                  *  Preconditions:
                  *    init'ed(this.notify)
                  * 
                  *  Postconditions:
                  *    return_value == this.notify
                  *    init'ed(return_value)
                  */
   107          return notify;
   108      }
   109  
   110      public void setNotify(boolean notify) {
                 /* 
    P/P           *  Method: void setNotify(bool)
                  * 
                  *  Postconditions:
                  *    this.notify == notify
                  *    init'ed(this.notify)
                  */
   111          this.notify = notify;
   112      }
   113  
   114      public boolean isError() {
                 /* 
    P/P           *  Method: bool isError()
                  * 
                  *  Preconditions:
                  *    init'ed(this.error)
                  * 
                  *  Postconditions:
                  *    return_value == this.error
                  *    init'ed(return_value)
                  */
   115          return error;
   116      }
   117  
   118      public void setError(boolean error) {
                 /* 
    P/P           *  Method: void setError(bool)
                  * 
                  *  Postconditions:
                  *    this.error == error
                  *    init'ed(this.error)
                  */
   119          this.error = error;
   120      }
   121  
   122      public String getMessage() {
                 /* 
    P/P           *  Method: String getMessage()
                  * 
                  *  Preconditions:
                  *    init'ed(this.message)
                  * 
                  *  Postconditions:
                  *    return_value == this.message
                  *    init'ed(return_value)
                  */
   123          return message;
   124      }
   125  
   126      public void setMessage(String message) {
                 /* 
    P/P           *  Method: void setMessage(String)
                  * 
                  *  Postconditions:
                  *    this.message == message
                  *    init'ed(this.message)
                  */
   127          this.message = message;
   128      }
   129      
   130  }








SofCheck Inspector Build Version : 2.18479
WeblogEntryCommentForm.java 2009-Jan-02 14:24:54
WeblogEntryCommentForm.class 2009-Sep-04 03:12:44