Clover coverage report - Prayer Portlets - 0.1-rc4-SNAPSHOT
Coverage timestamp: Thu Aug 19 2004 18:34:34 EDT
file stats: LOC: 154   Methods: 15
NCLOC: 74   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
UserContract.java 90% 88.5% 80% 86.3%
coverage coverage
 1   
 /*
 2   
  * Created on Jul 26, 2004
 3   
  */
 4   
 package org.marketchangers.prayer;
 5   
 
 6   
 import java.util.Date;
 7   
 
 8   
 /**
 9   
  * @author Jason Williams
 10   
  * @author <a href="mailto:ypak@wc-group.com">Yong Pak</a>
 11   
  * @author Jianshuo Niu
 12   
  * @hibernate.class table="Contracts"
 13   
  */
 14   
 public class UserContract extends PersistentObject {
 15   
 
 16   
     /**
 17   
      * In the case of prayer requests, contracts are initiated
 18   
      * by the requestor, and accepted by the intercessor.
 19   
      * When the requestor withdraws the request, the contract
 20   
      * is immediately removed from the system, without the
 21   
      * intercessor's interaction.
 22   
      */
 23   
 
 24   
     // status constants
 25   
     public static final String INITIATED = "initiated";
 26   
     public static final String ACCEPTED = "accepted";
 27   
     public static final String DECLINED = "declined";
 28   
     public static final String CANCELLED = "cancelled";
 29   
 
 30   
     private String status;
 31   
     private String requestorUserId;
 32   
     private String requesteeUserId;
 33   
     private Date date;
 34   
     private String type;
 35   
 
 36   
     /**
 37   
      * @hibernate.property
 38   
      * @return
 39   
      */
 40  0
     public Date getDate() {
 41  0
         return date;
 42   
     }
 43   
 
 44   
     /**
 45   
      * @hibernate.property
 46   
      * @return
 47   
      */
 48  2
     public String getStatus() {
 49  2
         return status;
 50   
     }
 51   
 
 52   
     /**
 53   
      * @hibernate.property
 54   
      * @deprecated Does not seem to be used anywhere? Undeprecate and add a 
 55   
      * comment explaining this field here if I'm wrong. -- MT
 56   
      * @return
 57   
      */
 58  0
     public String getType() {
 59  0
         return type;
 60   
     }
 61   
 
 62   
     /**
 63   
      * @param date
 64   
      */
 65  8
     public void setDate(Date date) {
 66  8
         this.date = date;
 67   
     }
 68   
 
 69   
     /**
 70   
      * @param string
 71   
      */
 72  8
     public void setStatus(String string) {
 73  8
         status = string;
 74   
     }
 75   
 
 76   
     /**
 77   
      * @deprecated Does not seem to be used anywhere? Undeprecate and add a 
 78   
      * comment explaining this field here if I'm wrong. -- MT
 79   
      * @param string
 80   
      */
 81  0
     public void setType(String string) {
 82  0
         type = string;
 83   
     }
 84   
     /**
 85   
      * @hibernate.property
 86   
      * @return
 87   
      */
 88  10
     public String getRequesteeUserId() {
 89  10
         return requesteeUserId;
 90   
     }
 91   
 
 92   
     /**
 93   
      * @hibernate.property
 94   
      * @return
 95   
      */
 96  16
     public String getRequestorUserId() {
 97  16
         return requestorUserId;
 98   
     }
 99   
 
 100   
     /**
 101   
      * @param string
 102   
      */
 103  28
     public void setRequesteeUserId(String string) {
 104  28
         requesteeUserId = string;
 105   
     }
 106   
 
 107   
     /**
 108   
      * @param string
 109   
      */
 110  28
     public void setRequestorUserId(String string) {
 111  28
         requestorUserId = string;
 112   
     }
 113   
 
 114  20
     public boolean equals(Object o) {
 115  20
         if (this == o) {
 116  10
             return true;
 117   
         }
 118   
 
 119  10
         if (!(o instanceof UserContract)) {
 120  2
             return false;
 121   
         }
 122   
 
 123  8
         UserContract other = (UserContract)o;
 124  8
         return equals(this.requesteeUserId, other.requesteeUserId)
 125   
             && equals(this.requestorUserId, other.requestorUserId)
 126   
             && equals(this.date, other.date);
 127   
     }
 128   
 
 129  24
     private boolean equals(Object lhs, Object rhs) {
 130  24
         return lhs == null ? rhs == null : lhs.equals(rhs);
 131   
     }
 132   
 
 133  2
     public int hashCode() {
 134  2
         int result = 11;
 135  2
         result = result * 37 + hashCode(requesteeUserId);
 136  2
         result = result * 37 + hashCode(requestorUserId);
 137  2
         result = result * 37 + hashCode(date);
 138  2
         return result;
 139   
     }
 140   
 
 141  6
     private int hashCode(Object o) {
 142  6
         return o == null ? 0 : o.hashCode();
 143   
     }
 144   
 
 145   
     //Validate() is used to determine if contract has valid parameters 
 146   
     //For now, that means not null
 147  8
     public boolean validate() {
 148  8
         if ((requesteeUserId == null) || (requestorUserId == null)) {
 149  2
             return false;
 150   
         }
 151  6
         return true;
 152   
     }
 153   
 }
 154