1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.system;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 import com.vividsolutions.jts.geom.MultiLineString;
30 import fr.ifremer.quadrige2.core.dao.data.survey.Survey;
31 import java.io.Serializable;
32
33
34
35
36
37 public abstract class SurveyLine
38 implements Serializable, Comparable<SurveyLine>
39 {
40
41
42
43 private static final long serialVersionUID = -326936635607894780L;
44
45
46 private Integer surveyId;
47
48
49
50
51
52 public Integer getSurveyId()
53 {
54 return this.surveyId;
55 }
56
57
58
59
60
61 public void setSurveyId(Integer surveyIdIn)
62 {
63 this.surveyId = surveyIdIn;
64 }
65
66 private MultiLineString surveyPosition;
67
68
69
70
71
72 public MultiLineString getSurveyPosition()
73 {
74 return this.surveyPosition;
75 }
76
77
78
79
80
81 public void setSurveyPosition(MultiLineString surveyPositionIn)
82 {
83 this.surveyPosition = surveyPositionIn;
84 }
85
86
87 private Survey survey;
88
89
90
91
92
93
94 public Survey getSurvey()
95 {
96 return this.survey;
97 }
98
99
100
101
102
103
104 public void setSurvey(Survey surveyIn)
105 {
106 this.survey = surveyIn;
107 }
108
109
110
111
112
113 @Override
114 public boolean equals(Object object)
115 {
116 if (this == object)
117 {
118 return true;
119 }
120 if (!(object instanceof SurveyLine))
121 {
122 return false;
123 }
124 final SurveyLine that = (SurveyLine)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
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
146
147 public static final class Factory
148 {
149
150
151
152
153 public static SurveyLine newInstance()
154 {
155 return new SurveyLineImpl();
156 }
157
158
159
160
161
162
163
164
165
166 public static SurveyLine newInstance(MultiLineString surveyPosition, Survey survey)
167 {
168 final SurveyLine entity = new SurveyLineImpl();
169 entity.setSurveyPosition(surveyPosition);
170 entity.setSurvey(survey);
171 return entity;
172 }
173 }
174
175
176
177
178 public int compareTo(SurveyLine 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
195
196 }