1
2
3
4
5
6
7
8
9 package com.hack23.cia.model.external.val.partier.impl;
10
11 import java.io.Serializable;
12 import java.util.ArrayList;
13 import java.util.List;
14 import javax.persistence.Basic;
15 import javax.persistence.CascadeType;
16 import javax.persistence.Column;
17 import javax.persistence.Entity;
18 import javax.persistence.GeneratedValue;
19 import javax.persistence.GenerationType;
20 import javax.persistence.Id;
21 import javax.persistence.Inheritance;
22 import javax.persistence.InheritanceType;
23 import javax.persistence.JoinColumn;
24 import javax.persistence.OneToMany;
25 import javax.persistence.Table;
26 import javax.xml.bind.annotation.XmlAccessType;
27 import javax.xml.bind.annotation.XmlAccessorType;
28 import javax.xml.bind.annotation.XmlAttribute;
29 import javax.xml.bind.annotation.XmlElement;
30 import javax.xml.bind.annotation.XmlType;
31 import com.hack23.cia.model.common.api.ModelObject;
32 import org.jvnet.jaxb2_commons.lang.Equals;
33 import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
34 import org.jvnet.jaxb2_commons.lang.HashCode;
35 import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
36 import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
37 import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
38 import org.jvnet.jaxb2_commons.locator.ObjectLocator;
39 import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 @XmlAccessorType(XmlAccessType.FIELD)
65 @XmlType(name = "SwedenElectionRegion", propOrder = {
66 "countyId",
67 "municipalId",
68 "regionName",
69 "parties"
70 })
71 @Entity(name = "SwedenElectionRegion")
72 @Table(name = "SWEDEN_ELECTION_REGION")
73 @Inheritance(strategy = InheritanceType.JOINED)
74 public class SwedenElectionRegion
75 implements Serializable, ModelObject, Equals, HashCode
76 {
77
78 @XmlElement(name = "lan_id", required = true)
79 protected String countyId;
80 @XmlElement(name = "kommun_id", required = true)
81 protected String municipalId;
82 @XmlElement(name = "namn", required = true)
83 protected String regionName;
84 @XmlElement(name = "parti", required = true)
85 protected List<SwedenPoliticalParty> parties;
86 @XmlAttribute(name = "Hjid")
87 protected Long hjid;
88
89
90
91
92
93
94
95
96
97 @Basic
98 @Column(name = "COUNTY_ID", length = 255)
99 public String getCountyId() {
100 return countyId;
101 }
102
103
104
105
106
107
108
109
110
111 public void setCountyId(String value) {
112 this.countyId = value;
113 }
114
115
116
117
118
119
120
121
122
123 @Basic
124 @Column(name = "MUNICIPAL_ID", length = 255)
125 public String getMunicipalId() {
126 return municipalId;
127 }
128
129
130
131
132
133
134
135
136
137 public void setMunicipalId(String value) {
138 this.municipalId = value;
139 }
140
141
142
143
144
145
146
147
148
149 @Basic
150 @Column(name = "REGION_NAME", length = 255)
151 public String getRegionName() {
152 return regionName;
153 }
154
155
156
157
158
159
160
161
162
163 public void setRegionName(String value) {
164 this.regionName = value;
165 }
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189 @OneToMany(targetEntity = SwedenPoliticalParty.class, cascade = {
190 CascadeType.ALL
191 })
192 @JoinColumn(name = "PARTIES_SWEDEN_ELECTION_REGI_0")
193 public List<SwedenPoliticalParty> getParties() {
194 if (parties == null) {
195 parties = new ArrayList<SwedenPoliticalParty>();
196 }
197 return this.parties;
198 }
199
200
201
202
203
204 public void setParties(List<SwedenPoliticalParty> parties) {
205 this.parties = parties;
206 }
207
208
209
210
211
212
213
214
215
216 @Id
217 @Column(name = "HJID")
218 @GeneratedValue(strategy = GenerationType.AUTO)
219 public Long getHjid() {
220 return hjid;
221 }
222
223
224
225
226
227
228
229
230
231 public void setHjid(Long value) {
232 this.hjid = value;
233 }
234
235 public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
236 if ((object == null)||(this.getClass()!= object.getClass())) {
237 return false;
238 }
239 if (this == object) {
240 return true;
241 }
242 final SwedenElectionRegion that = ((SwedenElectionRegion) object);
243 {
244 String lhsCountyId;
245 lhsCountyId = this.getCountyId();
246 String rhsCountyId;
247 rhsCountyId = that.getCountyId();
248 if (!strategy.equals(LocatorUtils.property(thisLocator, "countyId", lhsCountyId), LocatorUtils.property(thatLocator, "countyId", rhsCountyId), lhsCountyId, rhsCountyId)) {
249 return false;
250 }
251 }
252 {
253 String lhsMunicipalId;
254 lhsMunicipalId = this.getMunicipalId();
255 String rhsMunicipalId;
256 rhsMunicipalId = that.getMunicipalId();
257 if (!strategy.equals(LocatorUtils.property(thisLocator, "municipalId", lhsMunicipalId), LocatorUtils.property(thatLocator, "municipalId", rhsMunicipalId), lhsMunicipalId, rhsMunicipalId)) {
258 return false;
259 }
260 }
261 {
262 String lhsRegionName;
263 lhsRegionName = this.getRegionName();
264 String rhsRegionName;
265 rhsRegionName = that.getRegionName();
266 if (!strategy.equals(LocatorUtils.property(thisLocator, "regionName", lhsRegionName), LocatorUtils.property(thatLocator, "regionName", rhsRegionName), lhsRegionName, rhsRegionName)) {
267 return false;
268 }
269 }
270 {
271 List<SwedenPoliticalParty> lhsParties;
272 lhsParties = (((this.parties!= null)&&(!this.parties.isEmpty()))?this.getParties():null);
273 List<SwedenPoliticalParty> rhsParties;
274 rhsParties = (((that.parties!= null)&&(!that.parties.isEmpty()))?that.getParties():null);
275 if (!strategy.equals(LocatorUtils.property(thisLocator, "parties", lhsParties), LocatorUtils.property(thatLocator, "parties", rhsParties), lhsParties, rhsParties)) {
276 return false;
277 }
278 }
279 return true;
280 }
281
282 public boolean equals(Object object) {
283 final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
284 return equals(null, null, object, strategy);
285 }
286
287 public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
288 int currentHashCode = 1;
289 {
290 String theCountyId;
291 theCountyId = this.getCountyId();
292 currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "countyId", theCountyId), currentHashCode, theCountyId);
293 }
294 {
295 String theMunicipalId;
296 theMunicipalId = this.getMunicipalId();
297 currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "municipalId", theMunicipalId), currentHashCode, theMunicipalId);
298 }
299 {
300 String theRegionName;
301 theRegionName = this.getRegionName();
302 currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "regionName", theRegionName), currentHashCode, theRegionName);
303 }
304 {
305 List<SwedenPoliticalParty> theParties;
306 theParties = (((this.parties!= null)&&(!this.parties.isEmpty()))?this.getParties():null);
307 currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "parties", theParties), currentHashCode, theParties);
308 }
309 return currentHashCode;
310 }
311
312 public int hashCode() {
313 final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
314 return this.hashCode(null, strategy);
315 }
316
317 }