View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: Generated code! Do not modify by hand!
4   // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
5   //
6   package fr.ifremer.quadrige2.core.dao.system;
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 com.vividsolutions.jts.geom.MultiPolygon;
30  import fr.ifremer.quadrige2.core.dao.data.survey.Campaign;
31  import java.io.Serializable;
32  
33  /**
34   * Gestion de la géométrie surfacique des campagnes.
35   */
36  // HibernateEntity.vsl annotations merge-point
37  public abstract class CampaignArea
38      implements Serializable, Comparable<CampaignArea>
39  {
40      /**
41       * The serial version UID of this class. Needed for serialization.
42       */
43      private static final long serialVersionUID = -842960095041081006L;
44  
45      // Generate 2 attributes
46      private MultiPolygon campaignPosition;
47  
48      /**
49       * Positionnement de l'objet
50       * @return this.campaignPosition MultiPolygon
51       */
52      public MultiPolygon getCampaignPosition()
53      {
54          return this.campaignPosition;
55      }
56  
57      /**
58       * Positionnement de l'objet
59       * @param campaignPositionIn MultiPolygon
60       */
61      public void setCampaignPosition(MultiPolygon campaignPositionIn)
62      {
63          this.campaignPosition = campaignPositionIn;
64      }
65  
66      private Integer campaignId;
67  
68      /**
69       * 
70       * @return this.campaignId Integer
71       */
72      public Integer getCampaignId()
73      {
74          return this.campaignId;
75      }
76  
77      /**
78       * 
79       * @param campaignIdIn Integer
80       */
81      public void setCampaignId(Integer campaignIdIn)
82      {
83          this.campaignId = campaignIdIn;
84      }
85  
86      // Generate 1 associations
87      private Campaign campaign;
88  
89      /**
90       * Liste des campagnes.
91       * @return this.campaign Campaign
92       */
93      public Campaign getCampaign()
94      {
95          return this.campaign;
96      }
97  
98      /**
99       * Liste des campagnes.
100      * @param campaignIn Campaign
101      */
102     public void setCampaign(Campaign campaignIn)
103     {
104         this.campaign = campaignIn;
105     }
106 
107     /**
108      * Returns <code>true</code> if the argument is an CampaignArea instance and all identifiers for this entity
109      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
110      */
111     @Override
112     public boolean equals(Object object)
113     {
114         if (this == object)
115         {
116             return true;
117         }
118         if (!(object instanceof CampaignArea))
119         {
120             return false;
121         }
122         final CampaignArea that = (CampaignArea)object;
123         if (this.campaignId == null || that.getCampaignId() == null || !this.campaignId.equals(that.getCampaignId()))
124         {
125             return false;
126         }
127         return true;
128     }
129 
130     /**
131      * Returns a hash code based on this entity's identifiers.
132      */
133     @Override
134     public int hashCode()
135     {
136         int hashCode = 0;
137         hashCode = 29 * hashCode + (this.campaignId == null ? 0 : this.campaignId.hashCode());
138 
139         return hashCode;
140     }
141 
142     /**
143      * Constructs new instances of {@link CampaignArea}.
144      */
145     public static final class Factory
146     {
147         /**
148          * Constructs a new instance of {@link CampaignArea}.
149          * @return new CampaignAreaImpl()
150          */
151         public static CampaignArea newInstance()
152         {
153             return new CampaignAreaImpl();
154         }
155 
156 
157         /**
158          * Constructs a new instance of {@link CampaignArea}, taking all possible properties
159          * (except the identifier(s))as arguments.
160          * @param campaignPosition MultiPolygon
161          * @param campaign Campaign
162          * @return newInstance CampaignArea
163          */
164         public static CampaignArea newInstance(MultiPolygon campaignPosition, Campaign campaign)
165         {
166             final CampaignArea entity = new CampaignAreaImpl();
167             entity.setCampaignPosition(campaignPosition);
168             entity.setCampaign(campaign);
169             return entity;
170         }
171     }
172 
173     /**
174      * @see Comparable#compareTo
175      */
176     public int compareTo(CampaignArea o)
177     {
178         int cmp = 0;
179         if (this.getCampaignId() != null)
180         {
181             cmp = this.getCampaignId().compareTo(o.getCampaignId());
182         }
183         else
184         {
185             if (this.getCampaignPosition() != null)
186             {
187                 cmp = (cmp != 0 ? cmp : this.getCampaignPosition().compareTo(o.getCampaignPosition()));
188             }
189         }
190         return cmp;
191     }
192 // HibernateEntity.vsl merge-point
193 // CampaignArea.java merge-point
194 }