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.vessel; 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.location.Location; 032import java.io.Serializable; 033import java.util.Date; 034 035/** 036 * Période d'armement, ou de mise en service, du navire. 037 * La mise en service est rattaché à un lieu terrestre de mise en service. Cela peut etre le pays 038 * d'armement ou le quartier d'armement. 039 */ 040// HibernateEntity.vsl annotations merge-point 041public abstract class VesselCommissioningPeriod 042 implements Serializable, Comparable<VesselCommissioningPeriod> 043{ 044 /** 045 * The serial version UID of this class. Needed for serialization. 046 */ 047 private static final long serialVersionUID = 4526710880810578705L; 048 049 private VesselCommissioningPeriodPK vesselCommissioningPeriodPk; 050 051 /** 052 * Get the composite primary key identifier class 053 * @return vesselCommissioningPeriodPk 054 */ 055 public VesselCommissioningPeriodPK getVesselCommissioningPeriodPk() 056 { 057 return this.vesselCommissioningPeriodPk; 058 } 059 060 /** 061 * Set the composite primary key identifier class 062 * @param vesselCommissioningPeriodPkIn 063 */ 064 public void setVesselCommissioningPeriodPk(VesselCommissioningPeriodPK vesselCommissioningPeriodPkIn) { 065 this.vesselCommissioningPeriodPk = vesselCommissioningPeriodPkIn; 066 } 067 068 // Generate 2 attributes 069 /** 070 * 071 * @return this.startDate Date 072 */ 073 public Date getStartDate() 074 { 075 return this.getVesselCommissioningPeriodPk().getStartDate(); 076 } 077 078 /** 079 * 080 * @param startDateIn Date 081 */ 082 public void setStartDate(Date startDateIn) 083 { 084 this.getVesselCommissioningPeriodPk().setStartDate(startDateIn); 085 } 086 087 private Date endDate; 088 089 /** 090 * 091 * @return this.endDate Date 092 */ 093 public Date getEndDate() 094 { 095 return this.endDate; 096 } 097 098 /** 099 * 100 * @param endDateIn Date 101 */ 102 public void setEndDate(Date endDateIn) 103 { 104 this.endDate = endDateIn; 105 } 106 107 // Generate 2 associations 108 private Location commissioningLocation; 109 110 /** 111 * Lieu de mise en service. Cela peut etre un pays, ou le quartier d'armement. 112 * @return this.commissioningLocation Location 113 */ 114 public Location getCommissioningLocation() 115 { 116 return this.commissioningLocation; 117 } 118 119 /** 120 * Lieu de mise en service. Cela peut etre un pays, ou le quartier d'armement. 121 * @param commissioningLocationIn Location 122 */ 123 public void setCommissioningLocation(Location commissioningLocationIn) 124 { 125 this.commissioningLocation = commissioningLocationIn; 126 } 127 128 private Vessel vessel; 129 130 /** 131 * Navire, ou plus généralement un usager de la ressource. 132 * Peut etre un navire de peche professionnel ou non, un navire scientifique, un pêcheur à pied, 133 * un 134 * groupement de navires, etc. 135 * @return this.vessel Vessel 136 */ 137 public Vessel getVessel() 138 { 139 return this.vessel; 140 } 141 142 /** 143 * Navire, ou plus généralement un usager de la ressource. 144 * Peut etre un navire de peche professionnel ou non, un navire scientifique, un pêcheur à pied, 145 * un 146 * groupement de navires, etc. 147 * @param vesselIn Vessel 148 */ 149 public void setVessel(Vessel vesselIn) 150 { 151 this.vessel = vesselIn; 152 } 153 154 /** 155 * Returns <code>true</code> if the argument is an VesselCommissioningPeriod instance and all identifiers for this entity 156 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 157 */ 158 @Override 159 public boolean equals(Object object) 160 { 161 if (this == object) 162 { 163 return true; 164 } 165 if (!(object instanceof VesselCommissioningPeriod)) 166 { 167 return false; 168 } 169 final VesselCommissioningPeriod that = (VesselCommissioningPeriod)object; 170 if (this.vesselCommissioningPeriodPk == null || that.vesselCommissioningPeriodPk == null || !this.vesselCommissioningPeriodPk.equals(that.vesselCommissioningPeriodPk)) 171 { 172 return false; 173 } 174 return true; 175 } 176 177 /** 178 * Returns a hash code based on this entity's identifiers. 179 */ 180 @Override 181 public int hashCode() 182 { 183 int hashCode = 0; 184 hashCode = 29 * hashCode + (this.vesselCommissioningPeriodPk == null ? 0 : this.vesselCommissioningPeriodPk.hashCode()); 185 186 return hashCode; 187 } 188 189 /** 190 * Constructs new instances of {@link VesselCommissioningPeriod}. 191 */ 192 public static final class Factory 193 { 194 /** 195 * Constructs a new instance of {@link VesselCommissioningPeriod}. 196 * @return new VesselCommissioningPeriodImpl() 197 */ 198 public static VesselCommissioningPeriod newInstance() 199 { 200 return new VesselCommissioningPeriodImpl(); 201 } 202 203 /** 204 * Constructs a new instance of {@link VesselCommissioningPeriod}, taking all required and/or 205 * read-only properties as arguments, except for identifiers. 206 * @param commissioningLocation Location 207 * @param vessel Vessel 208 * @return newInstance 209 */ 210 public static VesselCommissioningPeriod newInstance(Location commissioningLocation, Vessel vessel) 211 { 212 final VesselCommissioningPeriod entity = new VesselCommissioningPeriodImpl(); 213 entity.setCommissioningLocation(commissioningLocation); 214 entity.setVessel(vessel); 215 return entity; 216 } 217 218 /** 219 * Constructs a new instance of {@link VesselCommissioningPeriod}, taking all possible properties 220 * (except the identifier(s))as arguments. 221 * @param endDate Date 222 * @param commissioningLocation Location 223 * @param vessel Vessel 224 * @return newInstance VesselCommissioningPeriod 225 */ 226 public static VesselCommissioningPeriod newInstance(Date endDate, Location commissioningLocation, Vessel vessel) 227 { 228 final VesselCommissioningPeriod entity = new VesselCommissioningPeriodImpl(); 229 entity.setEndDate(endDate); 230 entity.setCommissioningLocation(commissioningLocation); 231 entity.setVessel(vessel); 232 return entity; 233 } 234 } 235 236 /** 237 * @see Comparable#compareTo 238 */ 239 public int compareTo(VesselCommissioningPeriod o) 240 { 241 int cmp = 0; 242 if (this.getVesselCommissioningPeriodPk() != null) 243 { 244 cmp = this.getVesselCommissioningPeriodPk().compareTo(o.getVesselCommissioningPeriodPk()); 245 } 246 else 247 { 248 if (this.getEndDate() != null) 249 { 250 cmp = (cmp != 0 ? cmp : this.getEndDate().compareTo(o.getEndDate())); 251 } 252 } 253 return cmp; 254 } 255// HibernateEntity.vsl merge-point 256// VesselCommissioningPeriod.java merge-point 257}