View Javadoc

1   package org.gnomekr.potron.data;
2   
3   import java.io.Serializable;
4   import java.util.Date;
5   
6   import org.apache.commons.lang.builder.EqualsBuilder;
7   import org.apache.commons.lang.builder.HashCodeBuilder;
8   import org.apache.commons.lang.builder.ToStringBuilder;
9   
10  /***
11   * EntryLog.java
12   * @author Xavier Cho
13   * @version $Revision 1.1 $ $Date: 2005/07/21 10:04:42 $
14   * @hibernate.class table = "POTRON_ENTRY_LOG"
15   * @hibernate.cache usage = "nonstrict-read-write"
16   */
17  public class EntryLog implements Serializable {
18  
19      private static final long serialVersionUID = 4346200335447050646L;
20  
21      private long id = -1;
22      private String translation;
23      private User translator;
24      private Date modifiedDate;
25  
26      public EntryLog() {
27      }
28  
29      /***
30       * @param entry
31       */
32      public EntryLog(TranslatedEntry entry) {
33          if (entry != null) {
34              this.translation = entry.getTranslatedString();
35              this.translator = entry.getTranslator();
36              this.modifiedDate = entry.getModifiedDate();
37          }
38      }
39  
40      /***
41       * @return Returns the id.
42       * @hibernate.id
43       *          column = "entry_log_id"
44       *          length = "20"
45       *          unsaved-value = "-1"
46       *          generator-class = "native"
47       * @hibernate.generator-param
48       *          name = "sequence"
49       *          value = "POTRON_SEQ_ELOG"
50       */
51      public long getId() {
52          return id;
53      }
54  
55      /***
56       * @return Returns the translation.
57       * @hibernate.property
58       *          column = "translation"
59       *          update = "false"
60       *          not-null = "true"
61       *          type = "text"
62       */
63      public String getTranslation() {
64          return translation;
65      }
66  
67      /***
68       * @return Returns the translator.
69       * @hibernate.many-to-one
70       *          class = "org.gnomekr.potron.data.User"
71       *          column = "translator"
72       */
73      public User getTranslator() {
74          return translator;
75      }
76  
77      /***
78       * @return Returns the modifiedDate.
79       * @hibernate.property
80       *          column = "modified_date"
81       *          update = "false"
82       *          not-null = "true"
83       */
84      public Date getModifiedDate() {
85          return modifiedDate;
86      }
87  
88      /***
89       * @param id The id to set.
90       */
91      public void setId(long id) {
92          this.id = id;
93      }
94  
95      /***
96       * @param modifiedDate The modifiedDate to set.
97       */
98      public void setModifiedDate(Date modifiedDate) {
99          this.modifiedDate = modifiedDate;
100     }
101 
102     /***
103      * @param translation The translation to set.
104      */
105     public void setTranslation(String translation) {
106         this.translation = translation;
107     }
108 
109     /***
110      * @param translator The translator to set.
111      */
112     public void setTranslator(User translator) {
113         this.translator = translator;
114     }
115 
116     /***
117      * @see java.lang.Object#equals(java.lang.Object)
118      */
119     public boolean equals(final Object object) {
120         if (object instanceof EntryLog) {
121             EntryLog log = (EntryLog) object;
122 
123             EqualsBuilder builder = new EqualsBuilder();
124             builder.append(id, log.getId());
125             builder.append(translation, log.getTranslation());
126             builder.append(modifiedDate, log.getModifiedDate());
127 
128             return builder.isEquals();
129         }
130 
131         return false;
132     }
133 
134     /***
135      * @see java.lang.Object#toString()
136      */
137     public String toString() {
138         ToStringBuilder builder = new ToStringBuilder(this);
139         builder.append("id", id);
140         builder.append("modifiedDate", modifiedDate);
141         builder.append("translator", translator);
142 
143         return builder.toString();
144     }
145 
146     /***
147      * @see java.lang.Object#hashCode()
148      */
149     public int hashCode() {
150         HashCodeBuilder builder = new HashCodeBuilder();
151         builder.append(id);
152         builder.append(modifiedDate);
153         builder.append(translation);
154 
155         return builder.toHashCode();
156     }
157 }