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.administration.programStrategy;
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 java.io.Serializable;
032import java.util.Date;
033import org.apache.commons.lang3.builder.EqualsBuilder;
034import org.apache.commons.lang3.builder.HashCodeBuilder;
035
036/**
037 * Primary key class for AppliedPeriod
038 */
039public class AppliedPeriodPK implements Serializable, Comparable<AppliedPeriodPK>
040{
041    /**
042     * The serial version UID of this class. Needed for serialization.
043     */
044    private static final long serialVersionUID = -3631266350072516223L;
045
046    public AppliedPeriodPK()
047    {
048    }
049
050    public AppliedPeriodPK(AppliedStrategyImpl appliedStrategy, Date startDate)
051    {
052        this.appliedStrategy = appliedStrategy;
053        this.startDate = startDate;
054    }
055
056    private AppliedStrategyImpl appliedStrategy;
057
058    public AppliedStrategyImpl getAppliedStrategy()
059    {
060        return this.appliedStrategy;
061    }
062
063    public void setAppliedStrategy(AppliedStrategyImpl appliedStrategy)
064    {
065        this.appliedStrategy = appliedStrategy;
066    }
067
068    private Date startDate;
069
070    /**
071     * 
072     */
073    public Date getStartDate()
074    {
075        return this.startDate;
076    }
077
078    public void setStartDate(Date startDate)
079    {
080        this.startDate = startDate;
081    }
082
083    @Override
084    public boolean equals(Object object)
085    {
086        if (this == object)
087        {
088            return true;
089        }
090        if (!(object instanceof AppliedPeriodPK))
091        {
092            return false;
093        }
094        final AppliedPeriodPK that = (AppliedPeriodPK)object;
095        return new EqualsBuilder()
096            .append(this.getAppliedStrategy(),that.getAppliedStrategy())
097            .append(this.getStartDate(), that.getStartDate())
098            .isEquals();
099    }
100
101    @Override
102    public int hashCode()
103    {
104        return new HashCodeBuilder()
105            .append(getAppliedStrategy())
106            .append(getStartDate())
107            .toHashCode();
108    }
109
110    /**
111     * @see Comparable#compareTo
112     */
113    @Override
114    public int compareTo(AppliedPeriodPK o)
115    {
116        int cmp = 0;
117        if (this.getStartDate() != null)
118        {
119            cmp = this.getStartDate().compareTo(o.getStartDate());
120        }
121        return cmp;
122    }
123}