/layers-store/src/main/java/org/ala/layers/dto/Distribution.java

http://alageospatialportal.googlecode.com/ · Java · 560 lines · 461 code · 77 blank · 22 comment · 238 complexity · e127a2b15f4e8d984dd4964001ee076d MD5 · raw file

  1. /**************************************************************************
  2. * Copyright (C) 2010 Atlas of Living Australia
  3. * All Rights Reserved.
  4. *
  5. * The contents of this file are subject to the Mozilla Public
  6. * License Version 1.1 (the "License"); you may not use this file
  7. * except in compliance with the License. You may obtain a copy of
  8. * the License at http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS
  11. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  12. * implied. See the License for the specific language governing
  13. * rights and limitations under the License.
  14. ***************************************************************************/
  15. package org.ala.layers.dto;
  16. import org.codehaus.jackson.map.annotate.JsonSerialize;
  17. /**
  18. * This class serves as a model object for the "distributions" table
  19. *
  20. * @author ajay
  21. */
  22. // @XmlRootElement(name="distribution")
  23. // @XStreamAlias("distribution")
  24. @JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
  25. public class Distribution {
  26. public static final String EXPERT_DISTRIBUTION = "e";
  27. public static final String SPECIES_CHECKLIST = "c";
  28. Long gid;
  29. Long spcode;
  30. String scientific;
  31. String authority_;
  32. String common_nam;
  33. String family;
  34. String genus_name;
  35. String specific_n;
  36. Double min_depth;
  37. Double max_depth;
  38. Double pelagic_fl;
  39. String metadata_u;
  40. String geometry;
  41. String wmsurl;
  42. String lsid;
  43. String type;
  44. String area_name;
  45. String pid;
  46. String checklist_name;
  47. Double area_km;
  48. String notes;
  49. Long geom_idx;
  50. // additional fields
  51. String group_name;
  52. String family_lsid;
  53. String genus_lsid;
  54. Boolean estuarine_fl;
  55. Boolean coastal_fl;
  56. Boolean desmersal_fl;
  57. String caab_species_number;
  58. String caab_family_number;
  59. String data_resource_uid;
  60. String image_quality;
  61. String bounding_box;
  62. public String getData_resource_uid() {
  63. return data_resource_uid;
  64. }
  65. public void setData_resource_uid(String data_resource_uid) {
  66. this.data_resource_uid = data_resource_uid;
  67. }
  68. public String getImage_quality() {
  69. return image_quality;
  70. }
  71. public void setImage_quality(String image_quality) {
  72. this.image_quality = image_quality;
  73. }
  74. public String getFamily_lsid() {
  75. return family_lsid;
  76. }
  77. public void setFamily_lsid(String family_lsid) {
  78. this.family_lsid = family_lsid;
  79. }
  80. public String getGenus_lsid() {
  81. return genus_lsid;
  82. }
  83. public void setGenus_lsid(String genus_lsid) {
  84. this.genus_lsid = genus_lsid;
  85. }
  86. public Boolean getEstuarine_fl() {
  87. return estuarine_fl;
  88. }
  89. public void setEstuarine_fl(Integer estuarine_fl) {
  90. this.estuarine_fl = estuarine_fl != null && estuarine_fl > 0 ? true : false;
  91. }
  92. public Boolean getCoastal_fl() {
  93. return coastal_fl;
  94. }
  95. public void setCoastal_fl(Integer coastal_fl) {
  96. this.coastal_fl = coastal_fl != null && coastal_fl > 0 ? true : false;
  97. }
  98. public Boolean getDesmersal_fl() {
  99. return desmersal_fl;
  100. }
  101. public void setEstuarine_fl(Boolean estuarine_fl) {
  102. this.estuarine_fl = estuarine_fl;
  103. }
  104. public void setCoastal_fl(Boolean coastal_fl) {
  105. this.coastal_fl = coastal_fl;
  106. }
  107. public void setDesmersal_fl(Boolean desmersal_fl) {
  108. this.desmersal_fl = desmersal_fl;
  109. }
  110. public void setDesmersal_fl(Integer desmersal_fl) {
  111. this.desmersal_fl = desmersal_fl != null && desmersal_fl > 0 ? true : false;
  112. }
  113. public String getCaab_species_number() {
  114. return caab_species_number;
  115. }
  116. public void setCaab_species_number(String caab_species_number) {
  117. this.caab_species_number = caab_species_number;
  118. }
  119. public String getCaab_family_number() {
  120. return caab_family_number;
  121. }
  122. public void setCaab_family_number(String caab_family_number) {
  123. this.caab_family_number = caab_family_number;
  124. }
  125. public void setGid(Long gid) {
  126. this.gid = gid;
  127. }
  128. public Long getGid() {
  129. return gid;
  130. }
  131. public void setSpcode(Long spcode) {
  132. this.spcode = spcode;
  133. }
  134. public void setSpcode(Double spcode) {
  135. if (spcode != null) {
  136. this.spcode = (long) (double) spcode;
  137. }
  138. }
  139. public Long getSpcode() {
  140. return spcode;
  141. }
  142. public void setScientific(String scientific) {
  143. this.scientific = scientific;
  144. }
  145. public String getScientific() {
  146. return scientific;
  147. }
  148. public void setAuthority_(String authority) {
  149. this.authority_ = authority;
  150. }
  151. public String getAuthority_() {
  152. return authority_;
  153. }
  154. public void setCommon_nam(String common_nam) {
  155. this.common_nam = common_nam;
  156. }
  157. public String getCommon_nam() {
  158. return common_nam;
  159. }
  160. public void setFamily(String family) {
  161. this.family = family;
  162. }
  163. public String getFamily() {
  164. return family;
  165. }
  166. public void setGenus_name(String genus_name) {
  167. this.genus_name = genus_name;
  168. }
  169. public String getGenus_name() {
  170. return genus_name;
  171. }
  172. public void setSpecific_n(String specific_n) {
  173. this.specific_n = specific_n;
  174. }
  175. public String getSpecific_n() {
  176. return specific_n;
  177. }
  178. public void setMin_depth(Double min_depth) {
  179. this.min_depth = min_depth;
  180. }
  181. public Double getMin_depth() {
  182. return min_depth;
  183. }
  184. public void setMax_depth(Double max_depth) {
  185. this.max_depth = max_depth;
  186. }
  187. public Double getMax_depth() {
  188. return max_depth;
  189. }
  190. public void setPelagic_fl(Double pelagic_fl) {
  191. this.pelagic_fl = pelagic_fl;
  192. }
  193. public Double getPelagic_fl() {
  194. return pelagic_fl;
  195. }
  196. public void setMetadata_u(String metadata_u) {
  197. this.metadata_u = metadata_u;
  198. }
  199. public String getMetadata_u() {
  200. return metadata_u;
  201. }
  202. public void setGeometry(String geometry) {
  203. this.geometry = geometry;
  204. }
  205. public String getGeometry() {
  206. return geometry;
  207. }
  208. public void setWmsurl(String wmsurl) {
  209. this.wmsurl = wmsurl;
  210. }
  211. public String getWmsurl() {
  212. return wmsurl;
  213. }
  214. public void setLsid(String lsid) {
  215. this.lsid = lsid;
  216. }
  217. public String getLsid() {
  218. return lsid;
  219. }
  220. public void setType(String type) {
  221. this.type = type;
  222. }
  223. public String getType() {
  224. return type;
  225. }
  226. public void setArea_name(String area_name) {
  227. this.area_name = area_name;
  228. }
  229. public String getArea_name() {
  230. return area_name;
  231. }
  232. public void setPid(String pid) {
  233. this.pid = pid;
  234. }
  235. public String getPid() {
  236. return pid;
  237. }
  238. public void setChecklist_name(String checklist_name) {
  239. this.checklist_name = checklist_name;
  240. }
  241. public String getChecklist_name() {
  242. return checklist_name;
  243. }
  244. public void setArea_km(Double area_km) {
  245. this.area_km = area_km;
  246. }
  247. public Double getArea_km() {
  248. return area_km;
  249. }
  250. public void setNotes(String notes) {
  251. this.notes = notes;
  252. }
  253. public String getNotes() {
  254. return notes;
  255. }
  256. public void setGeom_idx(Long geom_idx) {
  257. this.geom_idx = geom_idx;
  258. }
  259. public Long getGeom_idx() {
  260. return geom_idx;
  261. }
  262. public String getGroup_name() {
  263. return group_name;
  264. }
  265. public void setGroup_name(String group_name) {
  266. this.group_name = group_name;
  267. }
  268. public String getBounding_box() {
  269. return bounding_box;
  270. }
  271. public void setBounding_box(String bounding_box) {
  272. this.bounding_box = bounding_box;
  273. }
  274. @Override
  275. public int hashCode() {
  276. final int prime = 31;
  277. int result = 1;
  278. result = prime * result + ((area_km == null) ? 0 : area_km.hashCode());
  279. result = prime * result + ((area_name == null) ? 0 : area_name.hashCode());
  280. result = prime * result + ((authority_ == null) ? 0 : authority_.hashCode());
  281. result = prime * result + ((caab_family_number == null) ? 0 : caab_family_number.hashCode());
  282. result = prime * result + ((caab_species_number == null) ? 0 : caab_species_number.hashCode());
  283. result = prime * result + ((checklist_name == null) ? 0 : checklist_name.hashCode());
  284. result = prime * result + ((coastal_fl == null) ? 0 : coastal_fl.hashCode());
  285. result = prime * result + ((common_nam == null) ? 0 : common_nam.hashCode());
  286. result = prime * result + ((data_resource_uid == null) ? 0 : data_resource_uid.hashCode());
  287. result = prime * result + ((desmersal_fl == null) ? 0 : desmersal_fl.hashCode());
  288. result = prime * result + ((estuarine_fl == null) ? 0 : estuarine_fl.hashCode());
  289. result = prime * result + ((family == null) ? 0 : family.hashCode());
  290. result = prime * result + ((family_lsid == null) ? 0 : family_lsid.hashCode());
  291. result = prime * result + ((genus_lsid == null) ? 0 : genus_lsid.hashCode());
  292. result = prime * result + ((genus_name == null) ? 0 : genus_name.hashCode());
  293. result = prime * result + ((geom_idx == null) ? 0 : geom_idx.hashCode());
  294. result = prime * result + ((geometry == null) ? 0 : geometry.hashCode());
  295. result = prime * result + ((gid == null) ? 0 : gid.hashCode());
  296. result = prime * result + ((group_name == null) ? 0 : group_name.hashCode());
  297. result = prime * result + ((image_quality == null) ? 0 : image_quality.hashCode());
  298. result = prime * result + ((lsid == null) ? 0 : lsid.hashCode());
  299. result = prime * result + ((max_depth == null) ? 0 : max_depth.hashCode());
  300. result = prime * result + ((metadata_u == null) ? 0 : metadata_u.hashCode());
  301. result = prime * result + ((min_depth == null) ? 0 : min_depth.hashCode());
  302. result = prime * result + ((notes == null) ? 0 : notes.hashCode());
  303. result = prime * result + ((pelagic_fl == null) ? 0 : pelagic_fl.hashCode());
  304. result = prime * result + ((pid == null) ? 0 : pid.hashCode());
  305. result = prime * result + ((scientific == null) ? 0 : scientific.hashCode());
  306. result = prime * result + ((spcode == null) ? 0 : spcode.hashCode());
  307. result = prime * result + ((specific_n == null) ? 0 : specific_n.hashCode());
  308. result = prime * result + ((type == null) ? 0 : type.hashCode());
  309. result = prime * result + ((wmsurl == null) ? 0 : wmsurl.hashCode());
  310. return result;
  311. }
  312. @Override
  313. public boolean equals(Object obj) {
  314. if (this == obj)
  315. return true;
  316. if (obj == null)
  317. return false;
  318. if (getClass() != obj.getClass())
  319. return false;
  320. Distribution other = (Distribution) obj;
  321. if (area_km == null) {
  322. if (other.area_km != null)
  323. return false;
  324. } else if (!area_km.equals(other.area_km))
  325. return false;
  326. if (area_name == null) {
  327. if (other.area_name != null)
  328. return false;
  329. } else if (!area_name.equals(other.area_name))
  330. return false;
  331. if (authority_ == null) {
  332. if (other.authority_ != null)
  333. return false;
  334. } else if (!authority_.equals(other.authority_))
  335. return false;
  336. if (caab_family_number == null) {
  337. if (other.caab_family_number != null)
  338. return false;
  339. } else if (!caab_family_number.equals(other.caab_family_number))
  340. return false;
  341. if (caab_species_number == null) {
  342. if (other.caab_species_number != null)
  343. return false;
  344. } else if (!caab_species_number.equals(other.caab_species_number))
  345. return false;
  346. if (checklist_name == null) {
  347. if (other.checklist_name != null)
  348. return false;
  349. } else if (!checklist_name.equals(other.checklist_name))
  350. return false;
  351. if (coastal_fl == null) {
  352. if (other.coastal_fl != null)
  353. return false;
  354. } else if (!coastal_fl.equals(other.coastal_fl))
  355. return false;
  356. if (common_nam == null) {
  357. if (other.common_nam != null)
  358. return false;
  359. } else if (!common_nam.equals(other.common_nam))
  360. return false;
  361. if (data_resource_uid == null) {
  362. if (other.data_resource_uid != null)
  363. return false;
  364. } else if (!data_resource_uid.equals(other.data_resource_uid))
  365. return false;
  366. if (desmersal_fl == null) {
  367. if (other.desmersal_fl != null)
  368. return false;
  369. } else if (!desmersal_fl.equals(other.desmersal_fl))
  370. return false;
  371. if (estuarine_fl == null) {
  372. if (other.estuarine_fl != null)
  373. return false;
  374. } else if (!estuarine_fl.equals(other.estuarine_fl))
  375. return false;
  376. if (family == null) {
  377. if (other.family != null)
  378. return false;
  379. } else if (!family.equals(other.family))
  380. return false;
  381. if (family_lsid == null) {
  382. if (other.family_lsid != null)
  383. return false;
  384. } else if (!family_lsid.equals(other.family_lsid))
  385. return false;
  386. if (genus_lsid == null) {
  387. if (other.genus_lsid != null)
  388. return false;
  389. } else if (!genus_lsid.equals(other.genus_lsid))
  390. return false;
  391. if (genus_name == null) {
  392. if (other.genus_name != null)
  393. return false;
  394. } else if (!genus_name.equals(other.genus_name))
  395. return false;
  396. if (geom_idx == null) {
  397. if (other.geom_idx != null)
  398. return false;
  399. } else if (!geom_idx.equals(other.geom_idx))
  400. return false;
  401. if (geometry == null) {
  402. if (other.geometry != null)
  403. return false;
  404. } else if (!geometry.equals(other.geometry))
  405. return false;
  406. if (gid == null) {
  407. if (other.gid != null)
  408. return false;
  409. } else if (!gid.equals(other.gid))
  410. return false;
  411. if (group_name == null) {
  412. if (other.group_name != null)
  413. return false;
  414. } else if (!group_name.equals(other.group_name))
  415. return false;
  416. if (image_quality == null) {
  417. if (other.image_quality != null)
  418. return false;
  419. } else if (!image_quality.equals(other.image_quality))
  420. return false;
  421. if (lsid == null) {
  422. if (other.lsid != null)
  423. return false;
  424. } else if (!lsid.equals(other.lsid))
  425. return false;
  426. if (max_depth == null) {
  427. if (other.max_depth != null)
  428. return false;
  429. } else if (!max_depth.equals(other.max_depth))
  430. return false;
  431. if (metadata_u == null) {
  432. if (other.metadata_u != null)
  433. return false;
  434. } else if (!metadata_u.equals(other.metadata_u))
  435. return false;
  436. if (min_depth == null) {
  437. if (other.min_depth != null)
  438. return false;
  439. } else if (!min_depth.equals(other.min_depth))
  440. return false;
  441. if (notes == null) {
  442. if (other.notes != null)
  443. return false;
  444. } else if (!notes.equals(other.notes))
  445. return false;
  446. if (pelagic_fl == null) {
  447. if (other.pelagic_fl != null)
  448. return false;
  449. } else if (!pelagic_fl.equals(other.pelagic_fl))
  450. return false;
  451. if (pid == null) {
  452. if (other.pid != null)
  453. return false;
  454. } else if (!pid.equals(other.pid))
  455. return false;
  456. if (scientific == null) {
  457. if (other.scientific != null)
  458. return false;
  459. } else if (!scientific.equals(other.scientific))
  460. return false;
  461. if (spcode == null) {
  462. if (other.spcode != null)
  463. return false;
  464. } else if (!spcode.equals(other.spcode))
  465. return false;
  466. if (specific_n == null) {
  467. if (other.specific_n != null)
  468. return false;
  469. } else if (!specific_n.equals(other.specific_n))
  470. return false;
  471. if (type == null) {
  472. if (other.type != null)
  473. return false;
  474. } else if (!type.equals(other.type))
  475. return false;
  476. if (wmsurl == null) {
  477. if (other.wmsurl != null)
  478. return false;
  479. } else if (!wmsurl.equals(other.wmsurl))
  480. return false;
  481. return true;
  482. }
  483. }