1
2
3
4
5
6 package fr.ifremer.quadrige3.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 import fr.ifremer.quadrige3.core.dao.data.survey.Occasion;
29 import java.io.Serializable;
30
31
32
33
34
35 public abstract class OccasPoint
36 implements Serializable, Comparable<OccasPoint>
37 {
38
39
40
41 private static final long serialVersionUID = -7193905324622386042L;
42
43
44 private String occasPosition;
45
46
47
48
49
50 public String getOccasPosition()
51 {
52 return this.occasPosition;
53 }
54
55
56
57
58
59 public void setOccasPosition(String occasPositionIn)
60 {
61 this.occasPosition = occasPositionIn;
62 }
63
64 private Integer occasId;
65
66
67
68
69
70 public Integer getOccasId()
71 {
72 return this.occasId;
73 }
74
75
76
77
78
79 public void setOccasId(Integer occasIdIn)
80 {
81 this.occasId = occasIdIn;
82 }
83
84
85 private Occasion occasion;
86
87
88
89
90
91 public Occasion getOccasion()
92 {
93 return this.occasion;
94 }
95
96
97
98
99
100 public void setOccasion(Occasion occasionIn)
101 {
102 this.occasion = occasionIn;
103 }
104
105
106
107
108
109 @Override
110 public boolean equals(Object object)
111 {
112 if (this == object)
113 {
114 return true;
115 }
116 if (!(object instanceof OccasPoint))
117 {
118 return false;
119 }
120 final OccasPoint that = (OccasPoint)object;
121 if (this.occasId == null || that.getOccasId() == null || !this.occasId.equals(that.getOccasId()))
122 {
123 return false;
124 }
125 return true;
126 }
127
128
129
130
131 @Override
132 public int hashCode()
133 {
134 int hashCode = 0;
135 hashCode = 29 * hashCode + (this.occasId == null ? 0 : this.occasId.hashCode());
136
137 return hashCode;
138 }
139
140
141
142
143 public static final class Factory
144 {
145
146
147
148
149 public static OccasPoint newInstance()
150 {
151 return new OccasPointImpl();
152 }
153
154
155
156
157
158
159
160
161
162 public static OccasPoint newInstance(String occasPosition, Occasion occasion)
163 {
164 final OccasPoint entity = new OccasPointImpl();
165 entity.setOccasPosition(occasPosition);
166 entity.setOccasion(occasion);
167 return entity;
168 }
169 }
170
171
172
173
174 public int compareTo(OccasPoint o)
175 {
176 int cmp = 0;
177 if (this.getOccasId() != null)
178 {
179 cmp = this.getOccasId().compareTo(o.getOccasId());
180 }
181 else
182 {
183 if (this.getOccasPosition() != null)
184 {
185 cmp = (cmp != 0 ? cmp : this.getOccasPosition().compareTo(o.getOccasPosition()));
186 }
187 }
188 return cmp;
189 }
190
191
192 }