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.pmfm.QualitativeValueImpl; 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 VesselFleetEvent 039 */ 040public class VesselFleetEventPK implements Serializable, Comparable<VesselFleetEventPK> 041{ 042 /** 043 * The serial version UID of this class. Needed for serialization. 044 */ 045 private static final long serialVersionUID = -5393265792266755596L; 046 047 public VesselFleetEventPK() 048 { 049 } 050 051 public VesselFleetEventPK(VesselImpl vessel, QualitativeValueImpl eventType, Date eventDate, Short rankOrder) 052 { 053 this.vessel = vessel; 054 this.eventType = eventType; 055 this.eventDate = eventDate; 056 this.rankOrder = rankOrder; 057 } 058 059 private VesselImpl vessel; 060 061 public VesselImpl getVessel() 062 { 063 return this.vessel; 064 } 065 066 public void setVessel(VesselImpl vessel) 067 { 068 this.vessel = vessel; 069 } 070 071 private QualitativeValueImpl eventType; 072 073 public QualitativeValueImpl getEventType() 074 { 075 return this.eventType; 076 } 077 078 public void setEventType(QualitativeValueImpl eventType) 079 { 080 this.eventType = eventType; 081 } 082 083 private Date eventDate; 084 085 /** 086 * 087 */ 088 public Date getEventDate() 089 { 090 return this.eventDate; 091 } 092 093 public void setEventDate(Date eventDate) 094 { 095 this.eventDate = eventDate; 096 } 097 098 private Short rankOrder; 099 100 /** 101 * Ajout pour gérer les regsitre de navires (hors registre consolidé) ou des doublons peuvent 102 * exister. 103 * mantis #14112 104 */ 105 public Short getRankOrder() 106 { 107 return this.rankOrder; 108 } 109 110 public void setRankOrder(Short rankOrder) 111 { 112 this.rankOrder = rankOrder; 113 } 114 115 @Override 116 public boolean equals(Object object) 117 { 118 if (this == object) 119 { 120 return true; 121 } 122 if (!(object instanceof VesselFleetEventPK)) 123 { 124 return false; 125 } 126 final VesselFleetEventPK that = (VesselFleetEventPK)object; 127 return new EqualsBuilder() 128 .append(this.getVessel(),that.getVessel()) 129 .append(this.getEventType(),that.getEventType()) 130 .append(this.getEventDate(), that.getEventDate()) 131 .append(this.getRankOrder(), that.getRankOrder()) 132 .isEquals(); 133 } 134 135 @Override 136 public int hashCode() 137 { 138 return new HashCodeBuilder() 139 .append(getVessel()) 140 .append(getEventType()) 141 .append(getEventDate()) 142 .append(getRankOrder()) 143 .toHashCode(); 144 } 145 146 /** 147 * @see Comparable#compareTo 148 */ 149 @Override 150 public int compareTo(VesselFleetEventPK o) 151 { 152 int cmp = 0; 153 if (this.getEventDate() != null) 154 { 155 cmp = this.getEventDate().compareTo(o.getEventDate()); 156 } 157 if (this.getRankOrder() != null) 158 { 159 cmp = (cmp != 0 ? cmp : this.getRankOrder().compareTo(o.getRankOrder())); 160 } 161 return cmp; 162 } 163}