001// license-header java merge-point 002// 003// Attention: Generated code! Do not modify by hand! 004// Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge. 005// 006package fr.ifremer.adagio.core.dao.referential.grouping; 007 008/* 009 * #%L 010 * SIH-Adagio :: Core 011 * $Id:$ 012 * $HeadURL:$ 013 * %% 014 * Copyright (C) 2012 - 2014 Ifremer 015 * %% 016 * This program is free software: you can redistribute it and/or modify 017 * it under the terms of the GNU Affero General Public License as published by 018 * the Free Software Foundation, either version 3 of the License, or 019 * (at your option) any later version. 020 * 021 * This program is distributed in the hope that it will be useful, 022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 024 * GNU General Public License for more details. 025 * 026 * You should have received a copy of the GNU Affero General Public License 027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 028 * #L% 029 */ 030 031import java.io.Serializable; 032 033/** 034 * <html> 035 * <head> 036 * <style> 037 * p {padding:0px; margin:0px;} 038 * </style> 039 * </head> 040 * <body> 041 * <p> 042 * <i>GroupingItem</i> permet de lister les entités du référentiel qui 043 * appartiennent à un regroupement. 044 * </p> 045 * </body> 046 * </html> 047 */ 048// HibernateEntity.vsl annotations merge-point 049public abstract class GroupingItem 050 implements Serializable, Comparable<GroupingItem> 051{ 052 /** 053 * The serial version UID of this class. Needed for serialization. 054 */ 055 private static final long serialVersionUID = 6151210822077954978L; 056 057 // Generate 4 attributes 058 private Integer id; 059 060 /** 061 * Identifiant interne. Généré par le système. 062 * @return this.id Integer 063 */ 064 public Integer getId() 065 { 066 return this.id; 067 } 068 069 /** 070 * Identifiant interne. Généré par le système. 071 * @param idIn Integer 072 */ 073 public void setId(Integer idIn) 074 { 075 this.id = idIn; 076 } 077 078 private Integer objectId; 079 080 /** 081 * <html> 082 * <head> 083 * <style> 084 * p {padding:0px; margin:0px;} 085 * </style> 086 * </head> 087 * <body> 088 * <p> 089 * <i>objectId</i> permet de stocker l’identifiant de l’entité, sachant que 090 * la table pointée doit correspondre au type d’entité de la classification 091 * de regroupement (cf <i>GroupingClassification.objectType</i>) 092 * </p> 093 * </body> 094 * </html> 095 * @return this.objectId Integer 096 */ 097 public Integer getObjectId() 098 { 099 return this.objectId; 100 } 101 102 /** 103 * <html> 104 * <head> 105 * <style> 106 * p {padding:0px; margin:0px;} 107 * </style> 108 * </head> 109 * <body> 110 * <p> 111 * <i>objectId</i> permet de stocker l’identifiant de l’entité, sachant que 112 * la table pointée doit correspondre au type d’entité de la classification 113 * de regroupement (cf <i>GroupingClassification.objectType</i>) 114 * </p> 115 * </body> 116 * </html> 117 * @param objectIdIn Integer 118 */ 119 public void setObjectId(Integer objectIdIn) 120 { 121 this.objectId = objectIdIn; 122 } 123 124 private String objectCode; 125 126 /** 127 * 128 * @return this.objectCode String 129 */ 130 public String getObjectCode() 131 { 132 return this.objectCode; 133 } 134 135 /** 136 * 137 * @param objectCodeIn String 138 */ 139 public void setObjectCode(String objectCodeIn) 140 { 141 this.objectCode = objectCodeIn; 142 } 143 144 private String comments; 145 146 /** 147 * 148 * @return this.comments String 149 */ 150 public String getComments() 151 { 152 return this.comments; 153 } 154 155 /** 156 * 157 * @param commentsIn String 158 */ 159 public void setComments(String commentsIn) 160 { 161 this.comments = commentsIn; 162 } 163 164 // Generate 1 associations 165 private Grouping grouping; 166 167 /** 168 * <html> 169 * <head> 170 * <style> 171 * p {padding:0px; margin:0px;} 172 * </style> 173 * </head> 174 * <body> 175 * <p> 176 * Un regroupement représente un groupement d'entités (du référentiel ou 177 * bien de navires), correspondant à un niveau de regroupement donné (<i>GroupingLevel</i>). 178 * </p> 179 * <p> 180 * </p> 181 * <p> 182 * Un regroupement peut faire référence à une ou plusieurs entités du 183 * référentiel (<i>GroupingItem</i>). Généralement, surtout les 184 * regroupements de plus bas niveau sont liés à des entités du référentiel 185 * (plus facile à maintenir), puis une table technique remplie toutes les 186 * associations possible avec les ancêtres (cf <i>GroupingItemHierarchy</i>). 187 * </p> 188 * <p> 189 * </p> 190 * <p> 191 * Un regroupement peut avoir un regroupement parent. 192 * </p> 193 * </body> 194 * </html> 195 * @return this.grouping Grouping 196 */ 197 public Grouping getGrouping() 198 { 199 return this.grouping; 200 } 201 202 /** 203 * <html> 204 * <head> 205 * <style> 206 * p {padding:0px; margin:0px;} 207 * </style> 208 * </head> 209 * <body> 210 * <p> 211 * Un regroupement représente un groupement d'entités (du référentiel ou 212 * bien de navires), correspondant à un niveau de regroupement donné (<i>GroupingLevel</i>). 213 * </p> 214 * <p> 215 * </p> 216 * <p> 217 * Un regroupement peut faire référence à une ou plusieurs entités du 218 * référentiel (<i>GroupingItem</i>). Généralement, surtout les 219 * regroupements de plus bas niveau sont liés à des entités du référentiel 220 * (plus facile à maintenir), puis une table technique remplie toutes les 221 * associations possible avec les ancêtres (cf <i>GroupingItemHierarchy</i>). 222 * </p> 223 * <p> 224 * </p> 225 * <p> 226 * Un regroupement peut avoir un regroupement parent. 227 * </p> 228 * </body> 229 * </html> 230 * @param groupingIn Grouping 231 */ 232 public void setGrouping(Grouping groupingIn) 233 { 234 this.grouping = groupingIn; 235 } 236 237 /** 238 * Returns <code>true</code> if the argument is an GroupingItem instance and all identifiers for this entity 239 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 240 */ 241 @Override 242 public boolean equals(Object object) 243 { 244 if (this == object) 245 { 246 return true; 247 } 248 if (!(object instanceof GroupingItem)) 249 { 250 return false; 251 } 252 final GroupingItem that = (GroupingItem)object; 253 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 254 { 255 return false; 256 } 257 return true; 258 } 259 260 /** 261 * Returns a hash code based on this entity's identifiers. 262 */ 263 @Override 264 public int hashCode() 265 { 266 int hashCode = 0; 267 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 268 269 return hashCode; 270 } 271 272 /** 273 * Constructs new instances of {@link GroupingItem}. 274 */ 275 public static final class Factory 276 { 277 /** 278 * Constructs a new instance of {@link GroupingItem}. 279 * @return new GroupingItemImpl() 280 */ 281 public static GroupingItem newInstance() 282 { 283 return new GroupingItemImpl(); 284 } 285 286 /** 287 * Constructs a new instance of {@link GroupingItem}, taking all required and/or 288 * read-only properties as arguments, except for identifiers. 289 * @param grouping Grouping 290 * @return newInstance 291 */ 292 public static GroupingItem newInstance(Grouping grouping) 293 { 294 final GroupingItem entity = new GroupingItemImpl(); 295 entity.setGrouping(grouping); 296 return entity; 297 } 298 299 /** 300 * Constructs a new instance of {@link GroupingItem}, taking all possible properties 301 * (except the identifier(s))as arguments. 302 * @param objectId Integer 303 * @param objectCode String 304 * @param comments String 305 * @param grouping Grouping 306 * @return newInstance GroupingItem 307 */ 308 public static GroupingItem newInstance(Integer objectId, String objectCode, String comments, Grouping grouping) 309 { 310 final GroupingItem entity = new GroupingItemImpl(); 311 entity.setObjectId(objectId); 312 entity.setObjectCode(objectCode); 313 entity.setComments(comments); 314 entity.setGrouping(grouping); 315 return entity; 316 } 317 } 318 319 /** 320 * @see Comparable#compareTo 321 */ 322 public int compareTo(GroupingItem o) 323 { 324 int cmp = 0; 325 if (this.getId() != null) 326 { 327 cmp = this.getId().compareTo(o.getId()); 328 } 329 else 330 { 331 if (this.getObjectId() != null) 332 { 333 cmp = (cmp != 0 ? cmp : this.getObjectId().compareTo(o.getObjectId())); 334 } 335 if (this.getObjectCode() != null) 336 { 337 cmp = (cmp != 0 ? cmp : this.getObjectCode().compareTo(o.getObjectCode())); 338 } 339 if (this.getComments() != null) 340 { 341 cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments())); 342 } 343 } 344 return cmp; 345 } 346// HibernateEntity.vsl merge-point 347// GroupingItem.java merge-point 348}