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.quadrige3.core.dao.administration.strategy;
7   
8   /*-
9    * #%L
10   * Quadrige3 Core :: Client API
11   * %%
12   * Copyright (C) 2017 - 2024 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  import java.io.Serializable;
29  import java.util.Date;
30  import org.apache.commons.lang3.builder.EqualsBuilder;
31  import org.apache.commons.lang3.builder.HashCodeBuilder;
32  
33  /**
34   * Primary key class for AppliedPeriod
35   */
36  public class AppliedPeriodPK implements Serializable, Comparable<AppliedPeriodPK>
37  {
38      /**
39       * The serial version UID of this class. Needed for serialization.
40       */
41      private static final long serialVersionUID = 252077637755485187L;
42  
43      public AppliedPeriodPK()
44      {
45      }
46  
47      public AppliedPeriodPK(AppliedStrategyImpl appliedStrategy, Date appliedPeriodStartDt)
48      {
49          this.appliedStrategy = appliedStrategy;
50          this.appliedPeriodStartDt = appliedPeriodStartDt;
51      }
52  
53      private AppliedStrategyImpl appliedStrategy;
54  
55      public AppliedStrategyImpl getAppliedStrategy()
56      {
57          return this.appliedStrategy;
58      }
59  
60      public void setAppliedStrategy(AppliedStrategyImpl appliedStrategy)
61      {
62          this.appliedStrategy = appliedStrategy;
63      }
64  
65      private Date appliedPeriodStartDt;
66  
67      /**
68       * Date de début de la période applicable
69       */
70      public Date getAppliedPeriodStartDt()
71      {
72          return this.appliedPeriodStartDt;
73      }
74  
75      public void setAppliedPeriodStartDt(Date appliedPeriodStartDt)
76      {
77          this.appliedPeriodStartDt = appliedPeriodStartDt;
78      }
79  
80      @Override
81      public boolean equals(Object object)
82      {
83          if (this == object)
84          {
85              return true;
86          }
87          if (!(object instanceof AppliedPeriodPK))
88          {
89              return false;
90          }
91          final AppliedPeriodPK that = (AppliedPeriodPK)object;
92          return new EqualsBuilder()
93              .append(this.getAppliedStrategy(),that.getAppliedStrategy())
94              .append(this.getAppliedPeriodStartDt(), that.getAppliedPeriodStartDt())
95              .isEquals();
96      }
97  
98      @Override
99      public int hashCode()
100     {
101         return new HashCodeBuilder()
102             .append(getAppliedStrategy())
103             .append(getAppliedPeriodStartDt())
104             .toHashCode();
105     }
106 
107     /**
108      * @see Comparable#compareTo
109      */
110     @Override
111     public int compareTo(AppliedPeriodPK o)
112     {
113         int cmp = 0;
114         if (this.getAppliedPeriodStartDt() != null)
115         {
116             cmp = this.getAppliedPeriodStartDt().compareTo(o.getAppliedPeriodStartDt());
117         }
118         return cmp;
119     }
120 }