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 VesselCommissioningPeriod
039 */
040public class VesselCommissioningPeriodPK implements Serializable, Comparable<VesselCommissioningPeriodPK>
041{
042    /**
043     * The serial version UID of this class. Needed for serialization.
044     */
045    private static final long serialVersionUID = 4526710880810578705L;
046
047    public VesselCommissioningPeriodPK()
048    {
049    }
050
051    public VesselCommissioningPeriodPK(LocationImpl commissioningLocation, VesselImpl vessel, Date startDate)
052    {
053        this.commissioningLocation = commissioningLocation;
054        this.vessel = vessel;
055        this.startDate = startDate;
056    }
057
058    private LocationImpl commissioningLocation;
059
060    public LocationImpl getCommissioningLocation()
061    {
062        return this.commissioningLocation;
063    }
064
065    public void setCommissioningLocation(LocationImpl commissioningLocation)
066    {
067        this.commissioningLocation = commissioningLocation;
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 startDate;
083
084    /**
085     * 
086     */
087    public Date getStartDate()
088    {
089        return this.startDate;
090    }
091
092    public void setStartDate(Date startDate)
093    {
094        this.startDate = startDate;
095    }
096
097    @Override
098    public boolean equals(Object object)
099    {
100        if (this == object)
101        {
102            return true;
103        }
104        if (!(object instanceof VesselCommissioningPeriodPK))
105        {
106            return false;
107        }
108        final VesselCommissioningPeriodPK that = (VesselCommissioningPeriodPK)object;
109        return new EqualsBuilder()
110            .append(this.getCommissioningLocation(),that.getCommissioningLocation())
111            .append(this.getVessel(),that.getVessel())
112            .append(this.getStartDate(), that.getStartDate())
113            .isEquals();
114    }
115
116    @Override
117    public int hashCode()
118    {
119        return new HashCodeBuilder()
120            .append(getCommissioningLocation())
121            .append(getVessel())
122            .append(getStartDate())
123            .toHashCode();
124    }
125
126    /**
127     * @see Comparable#compareTo
128     */
129    @Override
130    public int compareTo(VesselCommissioningPeriodPK o)
131    {
132        int cmp = 0;
133        if (this.getStartDate() != null)
134        {
135            cmp = this.getStartDate().compareTo(o.getStartDate());
136        }
137        return cmp;
138    }
139}