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