1 package org.gnomekr.potron.data; 2 3 import java.io.Serializable; 4 import java.util.Date; 5 import java.util.List; 6 7 import org.apache.commons.lang.builder.HashCodeBuilder; 8 import org.apache.commons.lang.builder.ToStringBuilder; 9 10 /*** 11 * Translation.java 12 * @author Xavier Cho 13 * @version $Revision 1.1 $ $Date: 2005/07/24 02:29:15 $ 14 * @hibernate.class table = "POTRON_TRANS" 15 * @hibernate.cache usage = "nonstrict-read-write" 16 */ 17 public class Translation implements Serializable { 18 19 private static final long serialVersionUID = -3803167679027733913L; 20 21 private long id; 22 private String name; 23 private Date registeredDate; 24 private Date revisionDate; 25 private User lastTranslator; 26 private LanguageTeam languageTeam; 27 private Template template; 28 private PluralForms pluralForms; 29 private List<Header> headers; 30 private List<TranslatedEntry> entries; 31 private String comment; 32 33 public Translation() { 34 } 35 36 /*** 37 * @param id 38 */ 39 public Translation(long id) { 40 this.id = id; 41 } 42 43 /*** 44 * @return 45 * @hibernate.id 46 * column = "trans_id" 47 * length = "20" 48 * unsaved-value = "-1" 49 * generator-class = "native" 50 * @hibernate.generator-param 51 * name = "sequence" 52 * value = "POTRON_SEQ_TRANS" 53 */ 54 public long getId() { 55 return id; 56 } 57 58 /*** 59 * @return 60 * @hibernate.property 61 * column = "name" 62 * length = "20" 63 * update = "true" 64 * not-null = "true" 65 */ 66 public String getName() { 67 return name; 68 } 69 70 /*** 71 * @return 72 * @hibernate.property 73 * column = "note" 74 * length = "2000" 75 * update = "true" 76 * not-null = "false" 77 */ 78 public String getComment() { 79 return comment; 80 } 81 82 /*** 83 * @return 84 * @hibernate.property 85 * column = "reg_date" 86 * update = "false" 87 * not-null = "true" 88 */ 89 public Date getRegisteredDate() { 90 return registeredDate; 91 } 92 93 /*** 94 * @return 95 * @hibernate.property 96 * column = "rev_date" 97 * update = "false" 98 * not-null = "false" 99 */ 100 public Date getRevisionDate() { 101 return revisionDate; 102 } 103 104 /*** 105 * @return 106 * @hibernate.many-to-one 107 * class = "org.gnomekr.potron.data.User" 108 * column = "user_name" 109 */ 110 public User getLastTranslator() { 111 return lastTranslator; 112 } 113 114 /*** 115 * @return 116 * @hibernate.many-to-one 117 * class = "org.gnomekr.potron.data.Template" 118 * column = "template_id" 119 * not-null = "true" 120 */ 121 public Template getTemplate() { 122 return template; 123 } 124 125 /*** 126 * @return 127 * @hibernate.many-to-one 128 * class = "org.gnomekr.potron.data.LanguageTeam" 129 * column = "team_id" 130 * not-null = "true" 131 */ 132 public LanguageTeam getLanguageTeam() { 133 return languageTeam; 134 } 135 136 /*** 137 * @return 138 * @hibernate.collection-key 139 * column = "template_id" 140 *@hibernate.collection-index 141 * column = "header_index" 142 * type = "int" 143 * length = "10" 144 *@hibernate.collection-composite-element 145 * class = "org.gnomekr.potron.data.Header" 146 * @hibernate.list 147 * table = "POTRON_TRANS_HEADER" 148 * lazy = "true" 149 * cascade = "all-delete-orphan" 150 */ 151 public List<Header> getHeaders() { 152 return headers; 153 } 154 155 /*** 156 * @return Returns the entries. 157 * @hibernate.collection-one-to-many 158 * class = "org.gnomekr.potron.data.TranslatedEntry" 159 * @hibernate.collection-key 160 * column = "trans_id" 161 * @hibernate.collection-index 162 * column = "trans_entry_index" 163 * type = "int" 164 * length = "10" 165 * @hibernate.list 166 * lazy = "true" 167 * order-by = "trans_entry_id" 168 * cascade = "all-delete-orphan" 169 */ 170 public List<TranslatedEntry> getEntries() { 171 return entries; 172 } 173 174 /*** 175 * @return 176 * @hibernate.component 177 * class = "org.gnomekr.potron.data.PluralForms" 178 */ 179 public PluralForms getPluralForms() { 180 return pluralForms; 181 } 182 183 /*** 184 * @param comment The comment to set. 185 */ 186 public void setComment(String comment) { 187 this.comment = comment; 188 } 189 190 /*** 191 * @param headers The headers to set. 192 */ 193 public void setHeaders(List<Header> headers) { 194 this.headers = headers; 195 } 196 197 /*** 198 * @param id The id to set. 199 */ 200 public void setId(long id) { 201 this.id = id; 202 } 203 204 /*** 205 * @param lastTranslator The lastTranslator to set. 206 */ 207 public void setLastTranslator(User lastTranslator) { 208 this.lastTranslator = lastTranslator; 209 } 210 211 /*** 212 * @param template The template to set. 213 */ 214 public void setTemplate(Template template) { 215 this.template = template; 216 } 217 218 /*** 219 * @param languageTeam The languageTeam to set. 220 */ 221 public void setLanguageTeam(LanguageTeam languageTeam) { 222 this.languageTeam = languageTeam; 223 } 224 225 /*** 226 * @param name The name to set. 227 */ 228 public void setName(String name) { 229 this.name = name; 230 } 231 232 /*** 233 * @param registeredDate The registeredDate to set. 234 */ 235 public void setRegisteredDate(Date registeredDate) { 236 this.registeredDate = registeredDate; 237 } 238 239 /*** 240 * @param revisionDate The revisionDate to set. 241 */ 242 public void setRevisionDate(Date revisionDate) { 243 this.revisionDate = revisionDate; 244 } 245 246 /*** 247 * @param entries The entries to set. 248 */ 249 public void setEntries(List<TranslatedEntry> entries) { 250 this.entries = entries; 251 } 252 253 /*** 254 * @param pluralForms 255 */ 256 public void setPluralForms(PluralForms pluralForms) { 257 this.pluralForms = pluralForms; 258 } 259 260 /*** 261 * @see java.lang.Object#equals(java.lang.Object) 262 */ 263 public boolean equals(final Object object) { 264 if (object instanceof Translation) { 265 long value = ((Translation) object).getId(); 266 return id == value; 267 } 268 269 return false; 270 } 271 272 /*** 273 * @see java.lang.Object#toString() 274 */ 275 public String toString() { 276 ToStringBuilder builder = new ToStringBuilder(this); 277 builder.append("id", id); 278 builder.append("name", name); 279 builder.append("revisionDate", revisionDate); 280 281 return builder.toString(); 282 } 283 284 /*** 285 * @see java.lang.Object#hashCode() 286 */ 287 public int hashCode() { 288 HashCodeBuilder builder = new HashCodeBuilder(); 289 builder.append(id); 290 291 return builder.toHashCode(); 292 } 293 }