View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: Generated code! Do not modify by hand!
4   // Generated by: hibernate/HibernateEntityPK.vsl in andromda-hibernate-cartridge.
5   //
6   package fr.ifremer.quadrige2.core.dao.administration.strategy;
7   
8   /*-
9    * #%L
10   * Quadrige2 Core :: Server API
11   * %%
12   * Copyright (C) 2017 Ifremer
13   * %%
14   * This program is free software: you can redistribute it and/or modify
15   * it under the terms of the GNU Affero General Public License as published by
16   * the Free Software Foundation, either version 3 of the License, or
17   * (at your option) any later version.
18   * 
19   * This program is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22   * GNU General Public License for more details.
23   * 
24   * You should have received a copy of the GNU Affero General Public License
25   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26   * #L%
27   */
28  
29  import java.io.Serializable;
30  import java.util.Date;
31  import org.apache.commons.lang3.builder.EqualsBuilder;
32  import org.apache.commons.lang3.builder.HashCodeBuilder;
33  
34  /**
35   * Primary key class for AppliedPeriod
36   */
37  public class AppliedPeriodPK implements Serializable, Comparable<AppliedPeriodPK>
38  {
39      /**
40       * The serial version UID of this class. Needed for serialization.
41       */
42      private static final long serialVersionUID = -4145217320950770178L;
43  
44      public AppliedPeriodPK()
45      {
46      }
47  
48      public AppliedPeriodPK(AppliedStrategyImpl appliedStrategy, Date appliedPeriodStartDt)
49      {
50          this.appliedStrategy = appliedStrategy;
51          this.appliedPeriodStartDt = appliedPeriodStartDt;
52      }
53  
54      private AppliedStrategyImpl appliedStrategy;
55  
56      public AppliedStrategyImpl getAppliedStrategy()
57      {
58          return this.appliedStrategy;
59      }
60  
61      public void setAppliedStrategy(AppliedStrategyImpl appliedStrategy)
62      {
63          this.appliedStrategy = appliedStrategy;
64      }
65  
66      private Date appliedPeriodStartDt;
67  
68      /**
69       * Date de début de la période applicable
70       */
71      public Date getAppliedPeriodStartDt()
72      {
73          return this.appliedPeriodStartDt;
74      }
75  
76      public void setAppliedPeriodStartDt(Date appliedPeriodStartDt)
77      {
78          this.appliedPeriodStartDt = appliedPeriodStartDt;
79      }
80  
81      @Override
82      public boolean equals(Object object)
83      {
84          if (this == object)
85          {
86              return true;
87          }
88          if (!(object instanceof AppliedPeriodPK))
89          {
90              return false;
91          }
92          final AppliedPeriodPK that = (AppliedPeriodPK)object;
93          return new EqualsBuilder()
94              .append(this.getAppliedStrategy(),that.getAppliedStrategy())
95              .append(this.getAppliedPeriodStartDt(), that.getAppliedPeriodStartDt())
96              .isEquals();
97      }
98  
99      @Override
100     public int hashCode()
101     {
102         return new HashCodeBuilder()
103             .append(getAppliedStrategy())
104             .append(getAppliedPeriodStartDt())
105             .toHashCode();
106     }
107 
108     /**
109      * @see Comparable#compareTo
110      */
111     @Override
112     public int compareTo(AppliedPeriodPK o)
113     {
114         int cmp = 0;
115         if (this.getAppliedPeriodStartDt() != null)
116         {
117             cmp = this.getAppliedPeriodStartDt().compareTo(o.getAppliedPeriodStartDt());
118         }
119         return cmp;
120     }
121 }