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; 007 008/* 009 * #%L 010 * SIH-Adagio :: Core for Allegro 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 * Pour les données du référentiel, information permettant de déterminer si une donnée est valide, 035 * obsolète ou temporaire. 036 * - obsolète (=inactif) : '0' 037 * - valide (=actif) : '1' 038 * - temporaire : '2' 039 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas confondre 040 * avec par exemple l'activité d'un navire sur un mois. 041 */ 042// HibernateEntity.vsl annotations merge-point 043public abstract class Status 044 implements Serializable, Comparable<Status> 045{ 046 /** 047 * The serial version UID of this class. Needed for serialization. 048 */ 049 private static final long serialVersionUID = -7737379012535636245L; 050 051 // Generate 2 attributes 052 private String code; 053 054 /** 055 * 056 * @return this.code String 057 */ 058 public String getCode() 059 { 060 return this.code; 061 } 062 063 /** 064 * 065 * @param codeIn String 066 */ 067 public void setCode(String codeIn) 068 { 069 this.code = codeIn; 070 } 071 072 private String name; 073 074 /** 075 * 076 * @return this.name String 077 */ 078 public String getName() 079 { 080 return this.name; 081 } 082 083 /** 084 * 085 * @param nameIn String 086 */ 087 public void setName(String nameIn) 088 { 089 this.name = nameIn; 090 } 091 092 // Generate 42 associations 093 /** 094 * Returns <code>true</code> if the argument is an Status instance and all identifiers for this entity 095 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 096 */ 097 @Override 098 public boolean equals(Object object) 099 { 100 if (this == object) 101 { 102 return true; 103 } 104 if (!(object instanceof Status)) 105 { 106 return false; 107 } 108 final Status that = (Status)object; 109 if (this.code == null || that.getCode() == null || !this.code.equals(that.getCode())) 110 { 111 return false; 112 } 113 return true; 114 } 115 116 /** 117 * Returns a hash code based on this entity's identifiers. 118 */ 119 @Override 120 public int hashCode() 121 { 122 int hashCode = 0; 123 hashCode = 29 * hashCode + (this.code == null ? 0 : this.code.hashCode()); 124 125 return hashCode; 126 } 127 128 /** 129 * Constructs new instances of {@link Status}. 130 */ 131 public static final class Factory 132 { 133 /** 134 * Constructs a new instance of {@link Status}. 135 * @return new StatusImpl() 136 */ 137 public static Status newInstance() 138 { 139 return new StatusImpl(); 140 } 141 142 143 /** 144 * Constructs a new instance of {@link Status}, taking all possible properties 145 * (except the identifier(s))as arguments. 146 * @param name String 147 * @return newInstance Status 148 */ 149 public static Status newInstance(String name) 150 { 151 final Status entity = new StatusImpl(); 152 entity.setName(name); 153 return entity; 154 } 155 } 156 157 /** 158 * @see Comparable#compareTo 159 */ 160 public int compareTo(Status o) 161 { 162 int cmp = 0; 163 if (this.getCode() != null) 164 { 165 cmp = this.getCode().compareTo(o.getCode()); 166 } 167 else 168 { 169 if (this.getName() != null) 170 { 171 cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); 172 } 173 } 174 return cmp; 175 } 176// HibernateEntity.vsl merge-point 177// Status.java merge-point 178}