View Javadoc
1 package org.argosfields.persistence; 2 3 import java.util.Date; 4 5 import net.sf.hibernate.CallbackException; 6 import net.sf.hibernate.Session; 7 8 import org.apache.commons.lang.builder.EqualsBuilder; 9 import org.apache.commons.lang.builder.HashCodeBuilder; 10 import org.apache.commons.lang.builder.ToStringBuilder; 11 12 /*** 13 * GameLog.java 14 * 15 * @author Xavier Cho 16 * @version $Revision: 1.1 $ $Date: 2004/04/15 05:43:55 $ 17 * 18 * @hibernate.class table = "AF_GAMELOG" 19 */ 20 public class GameLog extends PersistentEntity { 21 private long id; 22 private Date date; 23 private Account opponent; 24 private GameResult result; 25 26 /*** 27 * @return 28 * @hibernate.property 29 * column = "game_date" 30 * not-null = "true" 31 */ 32 public Date getDate() { 33 return date; 34 } 35 36 /*** 37 * @return 38 * @hibernate.id 39 * column = "game_id" 40 * length = "20" 41 * generator-class = "native" 42 */ 43 public long getId() { 44 return id; 45 } 46 47 /*** 48 * @return 49 */ 50 public Account getOpponent() { 51 return opponent; 52 } 53 54 /*** 55 * @return 56 * @hibernate.property 57 * column = "result" 58 * length = "1" 59 * not-null = "true" 60 * type = "org.argosfields.persistence.GameResult" 61 */ 62 public GameResult getResult() { 63 return result; 64 } 65 66 /*** 67 * @param date 68 */ 69 public void setDate(final Date date) { 70 this.date = date; 71 } 72 73 /*** 74 * @param l 75 */ 76 public void setId(final long l) { 77 id = l; 78 } 79 80 /*** 81 * @param account 82 */ 83 public void setOpponent(final Account account) { 84 opponent = account; 85 } 86 87 /*** 88 * @param result 89 */ 90 public void setResult(final GameResult result) { 91 this.result = result; 92 } 93 94 /*** 95 * @see net.sf.hibernate.Lifecycle#onSave(net.sf.hibernate.Session) 96 */ 97 public boolean onSave(final Session session) throws CallbackException { 98 this.date = new Date(System.currentTimeMillis()); 99 100 return super.onSave(session); 101 } 102 103 /*** 104 * @see java.lang.Object#equals(java.lang.Object) 105 */ 106 public boolean equals(final Object obj) { 107 if (obj instanceof GameLog) { 108 GameLog log = (GameLog) obj; 109 EqualsBuilder builder = new EqualsBuilder(); 110 builder.append(id, log.id); 111 112 return builder.isEquals(); 113 } 114 115 return false; 116 } 117 118 /*** 119 * @see java.lang.Object#hashCode() 120 */ 121 public int hashCode() { 122 HashCodeBuilder builder = new HashCodeBuilder(); 123 builder.append(id); 124 125 return builder.hashCode(); 126 } 127 128 /*** 129 * @see java.lang.Object#toString() 130 */ 131 public String toString() { 132 ToStringBuilder builder = new ToStringBuilder(this); 133 builder.append("id", id); 134 builder.append("date", date); 135 builder.append("opponent", opponent); 136 builder.append("result", result); 137 138 return builder.toString(); 139 } 140 }

This page was automatically generated by Maven