File Source: UserRole.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 java.io.Serializable;
    22  import org.apache.commons.lang.builder.EqualsBuilder;
    23  import org.apache.commons.lang.builder.HashCodeBuilder;
    24  import org.apache.roller.util.UUIDGenerator;
    25  
    26  
    27  /**
    28   * Role bean.
    29   */
    30  public class UserRole implements Serializable {
    31      
    32      public static final long serialVersionUID = -4254083071697970972L;
    33      
    34      private String id = UUIDGenerator.generateUUID();
    35      private String userName;
    36      private User user;
    37      private String role;
    38      
    39      
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.pojos.UserRole()
              * 
              *  Postconditions:
              *    init'ed(this.id)
              */
    40      public UserRole() {
    41      }
    42      
             /* 
    P/P       *  Method: void org.apache.roller.weblogger.pojos.UserRole(String, User, String)
              * 
              *  Preconditions:
              *    user != null
              *    init'ed(user.pcStateManager)
              *    init'ed(user.userName)
              *    (soft) org/apache/roller/weblogger/pojos/User.pcInheritedFieldCount <= 232-13
              * 
              *  Postconditions:
              *    init'ed(this.id)
              *    this.role == role
              *    init'ed(this.role)
              *    this.user == user
              *    this.user != null
              *    this.userName == user.userName
              *    init'ed(this.userName)
              */
    43      public UserRole(String id, User user, String role) {
    44          //this.id = id;
    45          this.userName = user.getUserName();
    46          this.user = user;
    47          this.role = role;
    48      }
    49      
    50      
    51      public String getId() {
                 /* 
    P/P           *  Method: String pcgetId()
                  * 
                  *  Preconditions:
                  *    init'ed(this.id)
                  * 
                  *  Postconditions:
                  *    return_value == this.id
                  *    init'ed(return_value)
                  */
    52          return this.id;
    53      }
    54      
    55      public void setId( String id ) {
                 /* 
    P/P           *  Method: void pcsetId(String)
                  * 
                  *  Postconditions:
                  *    this.id == Param_1
                  *    init'ed(this.id)
                  */
    56          this.id = id;
    57      }
    58      
    59      
    60      public String getUserName() {
                 /* 
    P/P           *  Method: String pcgetUserName()
                  * 
                  *  Preconditions:
                  *    init'ed(this.userName)
                  * 
                  *  Postconditions:
                  *    return_value == this.userName
                  *    init'ed(return_value)
                  */
    61          return this.userName;
    62      }
    63      
    64      public void setUserName( String userName ) {
                 /* 
    P/P           *  Method: void pcsetUserName(String)
                  * 
                  *  Postconditions:
                  *    this.userName == Param_1
                  *    init'ed(this.userName)
                  */
    65          this.userName = userName;
    66      }
    67      
    68      
    69      public User getUser() {
                 /* 
    P/P           *  Method: User pcgetUser()
                  * 
                  *  Preconditions:
                  *    init'ed(this.user)
                  * 
                  *  Postconditions:
                  *    return_value == this.user
                  *    init'ed(return_value)
                  */
    70          return this.user;
    71      }
    72      
    73      public void setUser( User user ) {
                 /* 
    P/P           *  Method: void pcsetUser(User)
                  * 
                  *  Postconditions:
                  *    this.user == Param_1
                  *    init'ed(this.user)
                  */
    74          this.user = user;
    75      }
    76      
    77      
    78      public String getRole() {
                 /* 
    P/P           *  Method: String pcgetRole()
                  * 
                  *  Preconditions:
                  *    init'ed(this.role)
                  * 
                  *  Postconditions:
                  *    return_value == this.role
                  *    init'ed(return_value)
                  */
    79          return this.role;
    80      }
    81      
    82      public void setRole( String role ) {
                 /* 
    P/P           *  Method: void pcsetRole(String)
                  * 
                  *  Postconditions:
                  *    this.role == Param_1
                  *    init'ed(this.role)
                  */
    83          this.role = role;
    84      }
    85      
    86      
    87      //------------------------------------------------------- Good citizenship
    88      
    89      public String toString() {
                 /* 
    P/P           *  Method: String toString()
                  * 
                  *  Preconditions:
                  *    init'ed(this.id)
                  *    init'ed(this.role)
                  *    init'ed(this.userName)
                  * 
                  *  Postconditions:
                  *    java.lang.StringBuffer:toString(...)._tainted == this.role._tainted | this.id._tainted | this.userName._tainted
                  *    init'ed(java.lang.StringBuffer:toString(...)._tainted)
                  *    return_value == &java.lang.StringBuffer:toString(...)
                  */
    90          StringBuffer buf = new StringBuffer();
    91          buf.append("{");
    92          buf.append(this.id);
    93          buf.append(", ").append(this.userName);
    94          buf.append(", ").append(this.role);
    95          buf.append("}");
    96          return buf.toString();
    97      }
    98      
    99      public boolean equals(Object other) {
                 /* 
    P/P           *  Method: bool equals(Object)
                  * 
                  *  Preconditions:
                  *    (soft) init'ed(other.pcStateManager)
                  *    (soft) init'ed(other.role)
                  *    (soft) init'ed(other.userName)
                  *    (soft) pcInheritedFieldCount <= 232-4
                  *    (soft) init'ed(this.pcStateManager)
                  *    (soft) init'ed(this.role)
                  *    (soft) init'ed(this.userName)
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.EqualsBuilder:append(...)@103 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  * 
                  *  Test Vectors:
                  *    other == this: {0}, {1}
                  */
   100          if (other == this) return true;
   101          if (other instanceof UserRole != true) return false;
   102          UserRole o = (UserRole)other;
   103          return new EqualsBuilder()
   104          .append(getRole(), o.getRole())
   105          .append(getUserName(), o.getUserName())
   106          .isEquals();
   107      }
   108      
   109      public int hashCode() {
                 /* 
    P/P           *  Method: int hashCode()
                  * 
                  *  Preconditions:
                  *    init'ed(this.pcStateManager)
                  *    init'ed(this.role)
                  *    init'ed(this.userName)
                  *    (soft) pcInheritedFieldCount <= 232-4
                  * 
                  *  Presumptions:
                  *    org.apache.commons.lang.builder.HashCodeBuilder:append(...)@110 != null
                  * 
                  *  Postconditions:
                  *    init'ed(return_value)
                  */
   110          return new HashCodeBuilder().append(getUserName()).append(getRole()).toHashCode();
   111      }
   112      
   113  }
+  114  Other Messages








SofCheck Inspector Build Version : 2.18479
UserRole.java 2009-Jan-02 14:24:56
UserRole.class 2009-Sep-04 03:12:38