001// license-header java merge-point 002// 003// Attention: Generated code! Do not modify by hand! 004// Generated by: hibernate/HibernateEntityPK.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.LocationImpl; 032import java.io.Serializable; 033import java.util.Date; 034import org.apache.commons.lang3.builder.EqualsBuilder; 035import org.apache.commons.lang3.builder.HashCodeBuilder; 036 037/** 038 * Primary key class for VesselRegistrationPeriod 039 */ 040public class VesselRegistrationPeriodPK implements Serializable, Comparable<VesselRegistrationPeriodPK> 041{ 042 /** 043 * The serial version UID of this class. Needed for serialization. 044 */ 045 private static final long serialVersionUID = 1400358090358950484L; 046 047 public VesselRegistrationPeriodPK() 048 { 049 } 050 051 public VesselRegistrationPeriodPK(LocationImpl registrationLocation, VesselImpl vessel, Date startDateTime) 052 { 053 this.registrationLocation = registrationLocation; 054 this.vessel = vessel; 055 this.startDateTime = startDateTime; 056 } 057 058 private LocationImpl registrationLocation; 059 060 public LocationImpl getRegistrationLocation() 061 { 062 return this.registrationLocation; 063 } 064 065 public void setRegistrationLocation(LocationImpl registrationLocation) 066 { 067 this.registrationLocation = registrationLocation; 068 } 069 070 private VesselImpl vessel; 071 072 public VesselImpl getVessel() 073 { 074 return this.vessel; 075 } 076 077 public void setVessel(VesselImpl vessel) 078 { 079 this.vessel = vessel; 080 } 081 082 private Date startDateTime; 083 084 /** 085 * 086 */ 087 public Date getStartDateTime() 088 { 089 return this.startDateTime; 090 } 091 092 public void setStartDateTime(Date startDateTime) 093 { 094 this.startDateTime = startDateTime; 095 } 096 097 @Override 098 public boolean equals(Object object) 099 { 100 if (this == object) 101 { 102 return true; 103 } 104 if (!(object instanceof VesselRegistrationPeriodPK)) 105 { 106 return false; 107 } 108 final VesselRegistrationPeriodPK that = (VesselRegistrationPeriodPK)object; 109 return new EqualsBuilder() 110 .append(this.getRegistrationLocation(),that.getRegistrationLocation()) 111 .append(this.getVessel(),that.getVessel()) 112 .append(this.getStartDateTime(), that.getStartDateTime()) 113 .isEquals(); 114 } 115 116 @Override 117 public int hashCode() 118 { 119 return new HashCodeBuilder() 120 .append(getRegistrationLocation()) 121 .append(getVessel()) 122 .append(getStartDateTime()) 123 .toHashCode(); 124 } 125 126 /** 127 * @see Comparable#compareTo 128 */ 129 @Override 130 public int compareTo(VesselRegistrationPeriodPK o) 131 { 132 int cmp = 0; 133 if (this.getStartDateTime() != null) 134 { 135 cmp = this.getStartDateTime().compareTo(o.getStartDateTime()); 136 } 137 return cmp; 138 } 139}