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.data.qualification; 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 fr.ifremer.adagio.core.dao.referential.ObjectType; 032import java.io.Serializable; 033import java.sql.Timestamp; 034import java.util.Collection; 035import java.util.HashSet; 036 037/** 038 * Représente la donnée qui a été qualifiée, par une plusieurs règles de qualification. 039 */ 040// HibernateEntity.vsl annotations merge-point 041public abstract class QualifiedItem 042 implements Serializable, Comparable<QualifiedItem> 043{ 044 /** 045 * The serial version UID of this class. Needed for serialization. 046 */ 047 private static final long serialVersionUID = 3111032275632392365L; 048 049 // Generate 3 attributes 050 private Integer id; 051 052 /** 053 * Idenfiant interne. Généré par le système. 054 * @return this.id Integer 055 */ 056 public Integer getId() 057 { 058 return this.id; 059 } 060 061 /** 062 * Idenfiant interne. Généré par le système. 063 * @param idIn Integer 064 */ 065 public void setId(Integer idIn) 066 { 067 this.id = idIn; 068 } 069 070 private Integer objectId; 071 072 /** 073 * Identifiant de l'élément ayant été qualifié. 074 * @return this.objectId Integer 075 */ 076 public Integer getObjectId() 077 { 078 return this.objectId; 079 } 080 081 /** 082 * Identifiant de l'élément ayant été qualifié. 083 * @param objectIdIn Integer 084 */ 085 public void setObjectId(Integer objectIdIn) 086 { 087 this.objectId = objectIdIn; 088 } 089 090 private Timestamp updateDate; 091 092 /** 093 * 094 * @return this.updateDate Timestamp 095 */ 096 public Timestamp getUpdateDate() 097 { 098 return this.updateDate; 099 } 100 101 /** 102 * 103 * @param updateDateIn Timestamp 104 */ 105 public void setUpdateDate(Timestamp updateDateIn) 106 { 107 this.updateDate = updateDateIn; 108 } 109 110 // Generate 2 associations 111 private Collection<AppliedQualificationRule> appliedQualificationRules = new HashSet<AppliedQualificationRule>(); 112 113 /** 114 * Règle de qualification qui a été appliquée, sur une donnée. 115 * @return this.appliedQualificationRules Collection<AppliedQualificationRule> 116 */ 117 public Collection<AppliedQualificationRule> getAppliedQualificationRules() 118 { 119 return this.appliedQualificationRules; 120 } 121 122 /** 123 * Règle de qualification qui a été appliquée, sur une donnée. 124 * @param appliedQualificationRulesIn Collection<AppliedQualificationRule> 125 */ 126 public void setAppliedQualificationRules(Collection<AppliedQualificationRule> appliedQualificationRulesIn) 127 { 128 this.appliedQualificationRules = appliedQualificationRulesIn; 129 } 130 131 /** 132 * Règle de qualification qui a été appliquée, sur une donnée. 133 * @param elementToAdd AppliedQualificationRule 134 * @return <tt>true</tt> if this collection changed as a result of the 135 * call 136 */ 137 public boolean addAppliedQualificationRules(AppliedQualificationRule elementToAdd) 138 { 139 return this.appliedQualificationRules.add(elementToAdd); 140 } 141 142 /** 143 * Règle de qualification qui a été appliquée, sur une donnée. 144 * @param elementToRemove AppliedQualificationRule 145 * @return <tt>true</tt> if this collection changed as a result of the 146 * call 147 */ 148 public boolean removeAppliedQualificationRules(AppliedQualificationRule elementToRemove) 149 { 150 return this.appliedQualificationRules.remove(elementToRemove); 151 } 152 153 private ObjectType objectType; 154 155 /** 156 * Type d'entité qualifiée. 157 * Généralement, on utilise le nom de la table principale de l'entité. 158 * Exemple : 159 * - FISHING_TRIP 160 * - SALE 161 * - PRODUCE 162 * - etc. 163 * @return this.objectType ObjectType 164 */ 165 public ObjectType getObjectType() 166 { 167 return this.objectType; 168 } 169 170 /** 171 * Type d'entité qualifiée. 172 * Généralement, on utilise le nom de la table principale de l'entité. 173 * Exemple : 174 * - FISHING_TRIP 175 * - SALE 176 * - PRODUCE 177 * - etc. 178 * @param objectTypeIn ObjectType 179 */ 180 public void setObjectType(ObjectType objectTypeIn) 181 { 182 this.objectType = objectTypeIn; 183 } 184 185 /** 186 * Returns <code>true</code> if the argument is an QualifiedItem instance and all identifiers for this entity 187 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 188 */ 189 @Override 190 public boolean equals(Object object) 191 { 192 if (this == object) 193 { 194 return true; 195 } 196 if (!(object instanceof QualifiedItem)) 197 { 198 return false; 199 } 200 final QualifiedItem that = (QualifiedItem)object; 201 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 202 { 203 return false; 204 } 205 return true; 206 } 207 208 /** 209 * Returns a hash code based on this entity's identifiers. 210 */ 211 @Override 212 public int hashCode() 213 { 214 int hashCode = 0; 215 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 216 217 return hashCode; 218 } 219 220 /** 221 * Constructs new instances of {@link QualifiedItem}. 222 */ 223 public static final class Factory 224 { 225 /** 226 * Constructs a new instance of {@link QualifiedItem}. 227 * @return new QualifiedItemImpl() 228 */ 229 public static QualifiedItem newInstance() 230 { 231 return new QualifiedItemImpl(); 232 } 233 234 /** 235 * Constructs a new instance of {@link QualifiedItem}, taking all required and/or 236 * read-only properties as arguments, except for identifiers. 237 * @param objectId Integer 238 * @param updateDate Timestamp 239 * @param objectType ObjectType 240 * @return newInstance 241 */ 242 public static QualifiedItem newInstance(Integer objectId, Timestamp updateDate, ObjectType objectType) 243 { 244 final QualifiedItem entity = new QualifiedItemImpl(); 245 entity.setObjectId(objectId); 246 entity.setUpdateDate(updateDate); 247 entity.setObjectType(objectType); 248 return entity; 249 } 250 251 /** 252 * Constructs a new instance of {@link QualifiedItem}, taking all possible properties 253 * (except the identifier(s))as arguments. 254 * @param objectId Integer 255 * @param updateDate Timestamp 256 * @param appliedQualificationRules Collection<AppliedQualificationRule> 257 * @param objectType ObjectType 258 * @return newInstance QualifiedItem 259 */ 260 public static QualifiedItem newInstance(Integer objectId, Timestamp updateDate, Collection<AppliedQualificationRule> appliedQualificationRules, ObjectType objectType) 261 { 262 final QualifiedItem entity = new QualifiedItemImpl(); 263 entity.setObjectId(objectId); 264 entity.setUpdateDate(updateDate); 265 entity.setAppliedQualificationRules(appliedQualificationRules); 266 entity.setObjectType(objectType); 267 return entity; 268 } 269 } 270 271 /** 272 * @see Comparable#compareTo 273 */ 274 public int compareTo(QualifiedItem o) 275 { 276 int cmp = 0; 277 if (this.getId() != null) 278 { 279 cmp = this.getId().compareTo(o.getId()); 280 } 281 else 282 { 283 if (this.getObjectId() != null) 284 { 285 cmp = (cmp != 0 ? cmp : this.getObjectId().compareTo(o.getObjectId())); 286 } 287 if (this.getUpdateDate() != null) 288 { 289 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 290 } 291 } 292 return cmp; 293 } 294// HibernateEntity.vsl merge-point 295// QualifiedItem.java merge-point 296}