File Source: WeblogBookmark.java

         /* 
    P/P   *  Method: void readObject(ObjectInputStream)
          * 
          *  Preconditions:
          *    Param_1 != null
          * 
          *  Presumptions:
          *    init'ed(org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED)
          * 
          *  Postconditions:
          *    Param_0.pcDetachedState == org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED
          *    (soft) init'ed(Param_0.pcDetachedState)
          */
     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.pojos;
    20  
    21  import org.apache.roller.weblogger.business.BookmarkManager;
    22  
    23  import java.io.Serializable;
    24  import org.apache.commons.lang.builder.EqualsBuilder;
    25  import org.apache.commons.lang.builder.HashCodeBuilder;
    26  import org.apache.roller.util.UUIDGenerator;
    27  
    28  
    29  /**
    30   * <p>Represents a single URL in a user's favorite web-bookmarks collection.
    31   * Don't construct one of these yourself, instead use the create method in
    32   * the your BookmarkManager implementation.</p>
    33   */
    34  public class WeblogBookmark implements Serializable, Comparable {
    35      
    36      public static final long serialVersionUID = 2315131256728236003L;
    37      
    38      private WeblogBookmarkFolder folder;
    39      
    40      private String id = UUIDGenerator.generateUUID();
    41      private String name;
    42      private String description;
    43      private String url;
    44      private Integer weight;
    45      private Integer priority;
    46      private String image;
    47      private String feedUrl;
    48      
    49      //----------------------------------------------------------- Constructors
    50      
    51      /** Default constructor, for use in form beans only. */
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.pojos.WeblogBookmark()
              * 
              *  Postconditions:
              *    this.bookmarkComparator == &new BookmarkComparator(WeblogBookmark#1)
              *    init'ed(this.id)
              *    new BookmarkComparator(WeblogBookmark#1) num objects == 1
              */
    52      public WeblogBookmark() {
    53      }
    54      
    55      public WeblogBookmark(
    56              WeblogBookmarkFolder parent,
    57              String name,
    58              String desc,
    59              String url,
    60              String feedUrl,
    61              Integer weight,
    62              Integer priority,
                     /* 
    P/P               *  Method: void org.apache.roller.weblogger.pojos.WeblogBookmark(WeblogBookmarkFolder, String, String, String, String, Integer, Integer, String)
                      * 
                      *  Postconditions:
                      *    this.bookmarkComparator == &new BookmarkComparator(WeblogBookmark#1)
                      *    this.description == desc
                      *    init'ed(this.description)
                      *    this.feedUrl == feedUrl
                      *    init'ed(this.feedUrl)
                      *    this.folder == parent
                      *    init'ed(this.folder)
                      *    init'ed(this.id)
                      *    this.image == image
                      *    init'ed(this.image)
                      *    ...
                      */
    63              String image) {
    64          this.folder = parent;
    65          this.name = name;
    66          this.description = desc;
    67          this.url = url;
    68          this.feedUrl = feedUrl;
    69          this.weight = weight;
    70          this.priority = priority;
    71          this.image = image;
    72      }
    73      
    74      //------------------------------------------------------------- Attributes
    75      
    76      /**
    77       * @roller.wrapPojoMethod type="simple"
    78       *
    79       * @ejb:persistent-field
    80       *
    81       * @hibernate.id column="id"
    82       *     generator-class="assigned"
    83       */
    84      public String getId() {
                 /* 
    P/P           *  Method: String pcgetId()
                  * 
                  *  Preconditions:
                  *    init'ed(this.id)
                  * 
                  *  Postconditions:
                  *    return_value == this.id
                  *    init'ed(return_value)
                  */
    85          return this.id;
    86      }
    87      
    88      /** @ejb:persistent-field */
    89      public void setId(String id) {
                 /* 
    P/P           *  Method: void pcsetId(String)
                  * 
                  *  Postconditions:
                  *    this.id == Param_1
                  *    init'ed(this.id)
                  */
    90          this.id = id;
    91      }
    92      
    93      /**
    94       * Name of bookmark.
    95       *
    96       * @roller.wrapPojoMethod type="simple"
    97       *
    98       * @struts.validator type="required" msgkey="errors.required"
    99       * @struts.validator-args arg0resource="bookmarkForm.name"
   100       *
   101       * @ejb:persistent-field
   102       *
   103       * @hibernate.property column="name" non-null="true" unique="false"
   104       */
   105      public String getName() {
                 /* 
    P/P           *  Method: String pcgetName()
                  * 
                  *  Preconditions:
                  *    init'ed(this.name)
                  * 
                  *  Postconditions:
                  *    return_value == this.name
                  *    init'ed(return_value)
                  */
   106          return this.name;
   107      }
   108      
   109      /** @ejb:persistent-field */
   110      public void setName(String name) {
                 /* 
    P/P           *  Method: void pcsetName(String)
                  * 
                  *  Postconditions:
                  *    this.name == Param_1
                  *    init'ed(this.name)
                  */
   111          this.name = name;
   112      }
   113      
   114      /**
   115       * Description of bookmark.
   116       *
   117       * @roller.wrapPojoMethod type="simple"
   118       *
   119       * @ejb:persistent-field
   120       *
   121       * @hibernate.property column="description" non-null="true" unique="false"
   122       */
   123      public String getDescription() {
                 /* 
    P/P           *  Method: String pcgetDescription()
                  * 
                  *  Preconditions:
                  *    init'ed(this.description)
                  * 
                  *  Postconditions:
                  *    return_value == this.description
                  *    init'ed(return_value)
                  */
   124          return this.description;
   125      }
   126      
   127      /** @ejb:persistent-field */
   128      public void setDescription(String description) {
                 /* 
    P/P           *  Method: void pcsetDescription(String)
                  * 
                  *  Postconditions:
                  *    this.description == Param_1
                  *    init'ed(this.description)
                  */
   129          this.description = description;
   130      }
   131      
   132      /**
   133       * URL of bookmark.
   134       *
   135       * @roller.wrapPojoMethod type="simple"
   136       *
   137       * @ejb:persistent-field
   138       *
   139       * @hibernate.property column="url" non-null="true" unique="false"
   140       */
   141      public String getUrl() {
                 /* 
    P/P           *  Method: String pcgetUrl()
                  * 
                  *  Preconditions:
                  *    init'ed(this.url)
                  * 
                  *  Postconditions:
                  *    return_value == this.url
                  *    init'ed(return_value)
                  */
   142          return this.url;
   143      }
   144      
   145      /** @ejb:persistent-field */
   146      public void setUrl(String url) {
                 /* 
    P/P           *  Method: void pcsetUrl(String)
                  * 
                  *  Postconditions:
                  *    this.url == Param_1
                  *    init'ed(this.url)
                  */
   147          this.url = url;
   148      }
   149      
   150      /**
   151       * Weight indicates prominence of link
   152       *
   153       * @roller.wrapPojoMethod type="simple"
   154       *
   155       * @struts.validator type="required" msgkey="errors.required"
   156       * @struts.validator type="integer" msgkey="errors.integer"
   157       * @struts.validator-args arg0resource="bookmarkForm.weight"
   158       *
   159       * @ejb:persistent-field
   160       *
   161       * @hibernate.property column="weight" non-null="true" unique="false"
   162       */
   163      public java.lang.Integer getWeight() {
                 /* 
    P/P           *  Method: Integer pcgetWeight()
                  * 
                  *  Preconditions:
                  *    init'ed(this.weight)
                  * 
                  *  Postconditions:
                  *    return_value == this.weight
                  *    init'ed(return_value)
                  */
   164          return this.weight;
   165      }
   166      
   167      /** @ejb:persistent-field */
   168      public void setWeight(java.lang.Integer weight) {
                 /* 
    P/P           *  Method: void pcsetWeight(Integer)
                  * 
                  *  Postconditions:
                  *    this.weight == Param_1
                  *    init'ed(this.weight)
                  */
   169          this.weight = weight;
   170      }
   171      
   172      /**
   173       * Priority determines order of display
   174       *
   175       * @roller.wrapPojoMethod type="simple"
   176       *
   177       * @struts.validator type="required" msgkey="errors.required"
   178       * @struts.validator type="integer" msgkey="errors.integer"
   179       * @struts.validator-args arg0resource="bookmarkForm.priority"
   180       *
   181       * @ejb:persistent-field
   182       *
   183       * @hibernate.property column="priority" non-null="true" unique="false"
   184       */
   185      public java.lang.Integer getPriority() {
                 /* 
    P/P           *  Method: Integer pcgetPriority()
                  * 
                  *  Preconditions:
                  *    init'ed(this.priority)
                  * 
                  *  Postconditions:
                  *    return_value == this.priority
                  *    init'ed(return_value)
                  */
   186          return this.priority;
   187      }
   188      
   189      /** @ejb:persistent-field */
   190      public void setPriority(java.lang.Integer priority) {
                 /* 
    P/P           *  Method: void pcsetPriority(Integer)
                  * 
                  *  Postconditions:
                  *    this.priority == Param_1
                  *    init'ed(this.priority)
                  */
   191          this.priority = priority;
   192      }
   193      
   194      /**
   195       * @ejb:persistent-field
   196       *
   197       * @roller.wrapPojoMethod type="simple"
   198       *
   199       * @hibernate.property column="image" non-null="true" unique="false"
   200       */
   201      public String getImage() {
                 /* 
    P/P           *  Method: String pcgetImage()
                  * 
                  *  Preconditions:
                  *    init'ed(this.image)
                  * 
                  *  Postconditions:
                  *    return_value == this.image
                  *    init'ed(return_value)
                  */
   202          return this.image;
   203      }
   204      
   205      /** @ejb:persistent-field */
   206      public void setImage(String image) {
                 /* 
    P/P           *  Method: void pcsetImage(String)
                  * 
                  *  Postconditions:
                  *    this.image == Param_1
                  *    init'ed(this.image)
                  */
   207          this.image = image;
   208      }
   209      
   210      /**
   211       * @ejb:persistent-field
   212       *
   213       * @roller.wrapPojoMethod type="simple"
   214       *
   215       * @hibernate.property column="feedurl" non-null="true" unique="false"
   216       */
   217      public String getFeedUrl() {
                 /* 
    P/P           *  Method: String pcgetFeedUrl()
                  * 
                  *  Preconditions:
                  *    init'ed(this.feedUrl)
                  * 
                  *  Postconditions:
                  *    return_value == this.feedUrl
                  *    init'ed(return_value)
                  */
   218          return this.feedUrl;
   219      }
   220      
   221      /** @ejb:persistent-field */
   222      public void setFeedUrl(String feedUrl) {
                 /* 
    P/P           *  Method: void pcsetFeedUrl(String)
                  * 
                  *  Postconditions:
                  *    this.feedUrl == Param_1
                  *    init'ed(this.feedUrl)
                  */
   223          this.feedUrl = feedUrl;
   224      }
   225      
   226      //---------------------------------------------------------- Relationships
   227      
   228      /**
   229       * @roller.wrapPojoMethod type="pojo"
   230       * @ejb:persistent-field
   231       * @hibernate.many-to-one column="folderid" cascade="none" not-null="true"
   232       */
   233      public org.apache.roller.weblogger.pojos.WeblogBookmarkFolder getFolder() {
                 /* 
    P/P           *  Method: WeblogBookmarkFolder pcgetFolder()
                  * 
                  *  Preconditions:
                  *    init'ed(this.folder)
                  * 
                  *  Postconditions:
                  *    return_value == this.folder
                  *    init'ed(return_value)
                  */
   234          return this.folder;
   235      }
   236      
   237      /** @ejb:persistent-field */
   238      public void setFolder(org.apache.roller.weblogger.pojos.WeblogBookmarkFolder folder) {
                 /* 
    P/P           *  Method: void pcsetFolder(WeblogBookmarkFolder)
                  * 
                  *  Postconditions:
                  *    this.folder == Param_1
                  *    init'ed(this.folder)
                  */
   239          this.folder = folder;
   240      }
   241      
   242      //------------------------------------------------------- Good citizenship
   243      
   244      public String toString() {
                 /* 
    P/P           *  Method: String toString()
                  * 
                  *  Preconditions:
                  *    init'ed(this.id)
                  *    init'ed(this.url)
                  * 
                  *  Postconditions:
                  *    java.lang.StringBuffer:toString(...)._tainted == this.id._tainted | this.url._tainted
                  *    init'ed(java.lang.StringBuffer:toString(...)._tainted)
                  *    return_value == &java.lang.StringBuffer:toString(...)
                  */
   245          StringBuffer buf = new StringBuffer();
   246          buf.append("{");
   247          buf.append(this.id);
   248          buf.append(", ").append(this.url);
   249          buf.append("}");
   250          return buf.toString();
   251      }
   252      
   253      public boolean equals(Object other) {
                 /* 
    P/P           *  Method: bool equals(Object)
                  * 
                  *  Preconditions:
                  *    (soft) init'ed(other.folder)
                  *    (soft) init'ed(other.name)
                  *    (soft) init'ed(other.pcStateManager)
                  *    (soft) pcInheritedFieldCount <= 232-6
                  *    (soft) init'ed(this.folder)
                  *    (soft) init'ed(this.name)
                  *    (soft) init'ed(this.pcStateManager)
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.EqualsBuilder:append(...)@257 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  * 
                  *  Test Vectors:
                  *    other == this: {0}, {1}
                  */
   254          if (other == this) return true;
   255          if (other instanceof WeblogBookmark != true) return false;
   256          WeblogBookmark o = (WeblogBookmark)other;
   257          return new EqualsBuilder()
   258          .append(getName(), o.getName())
   259          .append(getFolder(), o.getFolder())
   260          .isEquals();
   261      }
   262      
   263      public int hashCode() {
                 /* 
    P/P           *  Method: int hashCode()
                  * 
                  *  Preconditions:
                  *    init'ed(this.folder)
                  *    init'ed(this.name)
                  *    init'ed(this.pcStateManager)
                  *    (soft) pcInheritedFieldCount <= 232-6
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.HashCodeBuilder:append(...)@264 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
   264          return new HashCodeBuilder()
   265          .append(getName())
   266          .append(getFolder())
   267          .toHashCode();
   268      }
   269      
   270      
   271      /**
   272       * @see java.lang.Comparable#compareTo(java.lang.Object)
   273       */
   274      public int compareTo(Object o) {
                 /* 
    P/P           *  Method: int compareTo(Object)
                  * 
                  *  Preconditions:
                  *    this.bookmarkComparator != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
   275          return bookmarkComparator.compare(this, o);
   276      }
   277      
   278      private BookmarkComparator bookmarkComparator = new BookmarkComparator();
   279      
   280      public Weblog getWebsite() {
                 /* 
    P/P           *  Method: Weblog getWebsite()
                  * 
                  *  Preconditions:
                  *    this.folder != null
                  *    init'ed(this.folder.pcStateManager)
                  *    init'ed(this.folder.website)
                  *    (soft) org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.pcInheritedFieldCount <= 232-8
                  * 
                  *  Postconditions:
                  *    return_value == this.folder.website
                  *    init'ed(return_value)
                  */
   281          return this.folder.getWebsite();
   282      }
   283      
   284  }
+  285  Other Messages








SofCheck Inspector Build Version : 2.18479
WeblogBookmark.java 2009-Jan-02 14:25:46
WeblogBookmark.class 2009-Sep-04 03:12:38