2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.api
.service
.dto
;
11 import java
.util
.HashSet
;
14 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
15 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
16 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
17 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
18 import eu
.etaxonomy
.cdm
.model
.occurrence
.GatheringEvent
;
25 public class GatheringEventDTO
{
27 private String locality
;
28 private Point exactLocation
;
29 private String country
;
30 private Set
<String
> collectingAreas
;
31 private String collectingMethod
;
32 private Integer absoluteElevation
;
33 private Integer absoluteElevationMax
;
34 private String absoluteElevationText
;
35 private Double distanceToGround
;
36 private Double distanceToGroundMax
;
37 private String distanceToGroundText
;
38 private Double distanceToWaterSurface
;
39 private Double distanceToWaterSurfaceMax
;
40 private String collector
;
44 * @param exactLocation
46 * @param collectingAreas
47 * @param collectingMethod
48 * @param absoluteElevation
49 * @param absoluteElevationMax
50 * @param absoluteElevationText
51 * @param distanceToGround
52 * @param distanceToGroundMax
53 * @param distanceToGroundText
54 * @param distanceToWaterSurface
55 * @param distanceToWaterSurfaceMax
56 * @param distanceToWaterSurfaceText
58 public GatheringEventDTO(String locality
, Point exactLocation
, String country
, Set
<String
> collectingAreas
,
59 String collectingMethod
, String collector
, Integer absoluteElevation
, Integer absoluteElevationMax
,
60 String absoluteElevationText
, Double distanceToGround
, Double distanceToGroundMax
,
61 String distanceToGroundText
, Double distanceToWaterSurface
, Double distanceToWaterSurfaceMax
,
62 String distanceToWaterSurfaceText
) {
64 this.locality
= locality
;
65 this.exactLocation
= exactLocation
;
66 this.country
= country
;
67 this.collectingAreas
= collectingAreas
;
68 this.collectingMethod
= collectingMethod
;
69 this.setCollector(collector
);
70 this.absoluteElevation
= absoluteElevation
;
71 this.absoluteElevationMax
= absoluteElevationMax
;
72 this.absoluteElevationText
= absoluteElevationText
;
73 this.distanceToGround
= distanceToGround
;
74 this.distanceToGroundMax
= distanceToGroundMax
;
75 this.distanceToGroundText
= distanceToGroundText
;
76 this.distanceToWaterSurface
= distanceToWaterSurface
;
77 this.distanceToWaterSurfaceMax
= distanceToWaterSurfaceMax
;
78 this.distanceToWaterSurfaceText
= distanceToWaterSurfaceText
;
84 public GatheringEventDTO() {
88 public static GatheringEventDTO
newInstance(GatheringEvent gathering
){
89 GatheringEventDTO dto
= new GatheringEventDTO();
90 gathering
= HibernateProxyHelper
.deproxy(gathering
);
91 if (gathering
.getLocality() != null){
92 LanguageString locality
= HibernateProxyHelper
.deproxy(gathering
.getLocality());
93 dto
.locality
= locality
.getText();
95 if (gathering
.getExactLocation() != null){
96 dto
.exactLocation
= gathering
.getExactLocation();
98 if (gathering
.getCountry() != null){
99 dto
.country
= gathering
.getCountry().getTitleCache();
101 if (gathering
.getCollectingMethod() != null){
102 dto
.collectingMethod
= gathering
.getCollectingMethod();
104 if (gathering
.getCollector() != null ){
105 dto
.collector
= gathering
.getCollector().getTitleCache();
107 if (gathering
.getAbsoluteElevation() != null){
108 dto
.absoluteElevation
= gathering
.getAbsoluteElevation();
110 if (gathering
.getAbsoluteElevationMax() != null){
111 dto
.absoluteElevationMax
= gathering
.getAbsoluteElevationMax();
113 if (gathering
.getAbsoluteElevationText() != null){
114 dto
.absoluteElevationText
= gathering
.getAbsoluteElevationText();
116 if (gathering
.getDistanceToGround() != null){
117 dto
.distanceToGround
= gathering
.getDistanceToGround();
119 if (gathering
.getDistanceToGroundMax() != null){
120 dto
.distanceToGroundMax
= gathering
.getDistanceToGroundMax();
122 if (gathering
.getDistanceToGroundText() != null){
123 dto
.distanceToGroundText
= gathering
.getDistanceToGroundText();
125 if (gathering
.getDistanceToWaterSurface() != null){
126 dto
.distanceToWaterSurface
= gathering
.getDistanceToWaterSurface();
128 if (gathering
.getDistanceToWaterSurfaceMax() != null){
129 dto
.distanceToWaterSurfaceMax
= gathering
.getDistanceToWaterSurfaceMax();
131 if (gathering
.getDistanceToWaterSurfaceText() != null){
132 dto
.distanceToWaterSurfaceText
= gathering
.getDistanceToWaterSurfaceText();
135 for (NamedArea area
: gathering
.getCollectingAreas()){
136 String areaString
= area
.getLabel();
137 if (dto
.getCollectingAreas() == null){
138 dto
.collectingAreas
= new HashSet
<>();
140 dto
.collectingAreas
.add(areaString
);
147 public String
getLocality() {
150 public Point
getExactLocation() {
151 return exactLocation
;
153 public String
getCountry() {
156 public Set
<String
> getCollectingAreas() {
157 return collectingAreas
;
159 public String
getCollectingMethod() {
160 return collectingMethod
;
162 public Integer
getAbsoluteElevation() {
163 return absoluteElevation
;
165 public Integer
getAbsoluteElevationMax() {
166 return absoluteElevationMax
;
168 public String
getAbsoluteElevationText() {
169 return absoluteElevationText
;
171 public Double
getDistanceToGround() {
172 return distanceToGround
;
174 public Double
getDistanceToGroundMax() {
175 return distanceToGroundMax
;
177 public String
getDistanceToGroundText() {
178 return distanceToGroundText
;
180 public Double
getDistanceToWaterSurface() {
181 return distanceToWaterSurface
;
183 public Double
getDistanceToWaterSurfaceMax() {
184 return distanceToWaterSurfaceMax
;
186 public String
getDistanceToWaterSurfaceText() {
187 return distanceToWaterSurfaceText
;
189 public String
getCollector() {
192 public void setCollector(String collector
) {
193 this.collector
= collector
;
195 private String distanceToWaterSurfaceText
;