1
2
3
4
5
6
7
8
9 package data.worldbank.org.indicators;
10
11 import java.io.Serializable;
12 import javax.persistence.Basic;
13 import javax.persistence.CascadeType;
14 import javax.persistence.Column;
15 import javax.persistence.Entity;
16 import javax.persistence.GeneratedValue;
17 import javax.persistence.GenerationType;
18 import javax.persistence.Id;
19 import javax.persistence.Inheritance;
20 import javax.persistence.InheritanceType;
21 import javax.persistence.JoinColumn;
22 import javax.persistence.ManyToOne;
23 import javax.persistence.Table;
24 import javax.xml.bind.annotation.XmlAccessType;
25 import javax.xml.bind.annotation.XmlAccessorType;
26 import javax.xml.bind.annotation.XmlAttribute;
27 import javax.xml.bind.annotation.XmlElement;
28 import javax.xml.bind.annotation.XmlRootElement;
29 import javax.xml.bind.annotation.XmlSchemaType;
30 import javax.xml.bind.annotation.XmlType;
31 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
32 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
33 import org.apache.commons.lang.builder.EqualsBuilder;
34 import org.apache.commons.lang.builder.HashCodeBuilder;
35 import org.jvnet.jaxb2_commons.lang.Equals;
36 import org.jvnet.jaxb2_commons.lang.HashCode;
37 import org.jvnet.jaxb2_commons.lang.builder.JAXBEqualsBuilder;
38 import org.jvnet.jaxb2_commons.lang.builder.JAXBHashCodeBuilder;
39
40
41 /***
42 * <p>Java class for anonymous complex type.
43 *
44 * <p>The following schema fragment specifies the expected content contained within this class.
45 *
46 * <pre>
47 * <complexType>
48 * <complexContent>
49 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
50 * <sequence>
51 * <element ref="{http://www.worldbank.org}name"/>
52 * <element ref="{http://www.worldbank.org}source"/>
53 * <element ref="{http://www.worldbank.org}sourceNote"/>
54 * <element ref="{http://www.worldbank.org}topics"/>
55 * </sequence>
56 * <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
57 * </restriction>
58 * </complexContent>
59 * </complexType>
60 * </pre>
61 *
62 *
63 */
64 @XmlAccessorType(XmlAccessType.FIELD)
65 @XmlType(name = "", propOrder = {
66 "name",
67 "source",
68 "sourceNote",
69 "topics"
70 })
71 @XmlRootElement(name = "indicator")
72 @Entity(name = "data.worldbank.org.indicators.Indicator")
73 @Table(name = "INDICATOR_")
74 @Inheritance(strategy = InheritanceType.JOINED)
75 public class Indicator
76 implements Serializable, Equals, HashCode
77 {
78
79 @XmlElement(required = true)
80 protected String name;
81 @XmlElement(required = true)
82 protected Source source;
83 @XmlElement(required = true)
84 protected String sourceNote;
85 @XmlElement(required = true)
86 protected Topics topics;
87 @XmlAttribute(required = true)
88 @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
89 @XmlSchemaType(name = "NCName")
90 protected String id;
91 @XmlAttribute(name = "Hjid")
92 protected Long hjid;
93
94 /***
95 * Gets the value of the name property.
96 *
97 * @return
98 * possible object is
99 * {@link String }
100 *
101 */
102 @Basic
103 @Column(name = "NAME_", length = 255)
104 public String getName() {
105 return name;
106 }
107
108 /***
109 * Sets the value of the name property.
110 *
111 * @param value
112 * allowed object is
113 * {@link String }
114 *
115 */
116 public void setName(String value) {
117 this.name = value;
118 }
119
120 /***
121 * Gets the value of the source property.
122 *
123 * @return
124 * possible object is
125 * {@link Source }
126 *
127 */
128 @ManyToOne(targetEntity = Source.class, cascade = {
129 CascadeType.ALL
130 })
131 @JoinColumn(name = "SOURCE__INDICATOR__HJID")
132 public Source getSource() {
133 return source;
134 }
135
136 /***
137 * Sets the value of the source property.
138 *
139 * @param value
140 * allowed object is
141 * {@link Source }
142 *
143 */
144 public void setSource(Source value) {
145 this.source = value;
146 }
147
148 /***
149 * Gets the value of the sourceNote property.
150 *
151 * @return
152 * possible object is
153 * {@link String }
154 *
155 */
156 @Basic
157 @Column(name = "SOURCENOTE", length = 255)
158 public String getSourceNote() {
159 return sourceNote;
160 }
161
162 /***
163 * Sets the value of the sourceNote property.
164 *
165 * @param value
166 * allowed object is
167 * {@link String }
168 *
169 */
170 public void setSourceNote(String value) {
171 this.sourceNote = value;
172 }
173
174 /***
175 * Gets the value of the topics property.
176 *
177 * @return
178 * possible object is
179 * {@link Topics }
180 *
181 */
182 @ManyToOne(targetEntity = Topics.class, cascade = {
183 CascadeType.ALL
184 })
185 @JoinColumn(name = "TOPICS_INDICATOR__HJID")
186 public Topics getTopics() {
187 return topics;
188 }
189
190 /***
191 * Sets the value of the topics property.
192 *
193 * @param value
194 * allowed object is
195 * {@link Topics }
196 *
197 */
198 public void setTopics(Topics value) {
199 this.topics = value;
200 }
201
202 /***
203 * Gets the value of the id property.
204 *
205 * @return
206 * possible object is
207 * {@link String }
208 *
209 */
210 @Basic
211 @Column(name = "ID", length = 255)
212 public String getId() {
213 return id;
214 }
215
216 /***
217 * Sets the value of the id property.
218 *
219 * @param value
220 * allowed object is
221 * {@link String }
222 *
223 */
224 public void setId(String value) {
225 this.id = value;
226 }
227
228 /***
229 * Gets the value of the hjid property.
230 *
231 * @return
232 * possible object is
233 * {@link Long }
234 *
235 */
236 @Id
237 @Column(name = "HJID")
238 @GeneratedValue(strategy = GenerationType.AUTO)
239 public Long getHjid() {
240 return hjid;
241 }
242
243 /***
244 * Sets the value of the hjid property.
245 *
246 * @param value
247 * allowed object is
248 * {@link Long }
249 *
250 */
251 public void setHjid(Long value) {
252 this.hjid = value;
253 }
254
255 public void equals(Object object, EqualsBuilder equalsBuilder) {
256 if (!(object instanceof Indicator)) {
257 equalsBuilder.appendSuper(false);
258 return ;
259 }
260 if (this == object) {
261 return ;
262 }
263 final Indicator that = ((Indicator) object);
264 equalsBuilder.append(this.getName(), that.getName());
265 equalsBuilder.append(this.getSource(), that.getSource());
266 equalsBuilder.append(this.getSourceNote(), that.getSourceNote());
267 equalsBuilder.append(this.getTopics(), that.getTopics());
268 equalsBuilder.append(this.getId(), that.getId());
269 }
270
271 public boolean equals(Object object) {
272 if (!(object instanceof Indicator)) {
273 return false;
274 }
275 if (this == object) {
276 return true;
277 }
278 final EqualsBuilder equalsBuilder = new JAXBEqualsBuilder();
279 equals(object, equalsBuilder);
280 return equalsBuilder.isEquals();
281 }
282
283 public void hashCode(HashCodeBuilder hashCodeBuilder) {
284 hashCodeBuilder.append(this.getName());
285 hashCodeBuilder.append(this.getSource());
286 hashCodeBuilder.append(this.getSourceNote());
287 hashCodeBuilder.append(this.getTopics());
288 hashCodeBuilder.append(this.getId());
289 }
290
291 public int hashCode() {
292 final HashCodeBuilder hashCodeBuilder = new JAXBHashCodeBuilder();
293 hashCode(hashCodeBuilder);
294 return hashCodeBuilder.toHashCode();
295 }
296
297 }