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
.io
.Serializable
;
12 import java
.util
.HashSet
;
15 import org
.joda
.time
.Partial
;
17 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
18 import eu
.etaxonomy
.cdm
.model
.common
.LanguageString
;
19 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
20 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
21 import eu
.etaxonomy
.cdm
.model
.occurrence
.GatheringEvent
;
28 public class GatheringEventDTO
implements Serializable
{
30 private static final long serialVersionUID
= -4381193272881277448L;
32 private String locality
;
33 private Point exactLocation
;
34 private String country
;
35 private Set
<String
> collectingAreas
;
36 private String collectingMethod
;
37 private Integer absoluteElevation
;
38 private Integer absoluteElevationMax
;
39 private String absoluteElevationText
;
40 private Double distanceToGround
;
41 private Double distanceToGroundMax
;
42 private String distanceToGroundText
;
43 private Double distanceToWaterSurface
;
44 private Double distanceToWaterSurfaceMax
;
45 private String collector
;
50 * @param exactLocation
52 * @param collectingAreas
53 * @param collectingMethod
54 * @param absoluteElevation
55 * @param absoluteElevationMax
56 * @param absoluteElevationText
57 * @param distanceToGround
58 * @param distanceToGroundMax
59 * @param distanceToGroundText
60 * @param distanceToWaterSurface
61 * @param distanceToWaterSurfaceMax
62 * @param distanceToWaterSurfaceText
64 public GatheringEventDTO(String locality
, Point exactLocation
, String country
, Set
<String
> collectingAreas
,
65 String collectingMethod
, String collector
, Integer absoluteElevation
, Integer absoluteElevationMax
,
66 String absoluteElevationText
, Double distanceToGround
, Double distanceToGroundMax
,
67 String distanceToGroundText
, Double distanceToWaterSurface
, Double distanceToWaterSurfaceMax
,
68 String distanceToWaterSurfaceText
) {
70 this.locality
= locality
;
71 this.exactLocation
= exactLocation
;
72 this.country
= country
;
73 this.collectingAreas
= collectingAreas
;
74 this.collectingMethod
= collectingMethod
;
75 this.setCollector(collector
);
76 this.absoluteElevation
= absoluteElevation
;
77 this.absoluteElevationMax
= absoluteElevationMax
;
78 this.absoluteElevationText
= absoluteElevationText
;
79 this.distanceToGround
= distanceToGround
;
80 this.distanceToGroundMax
= distanceToGroundMax
;
81 this.distanceToGroundText
= distanceToGroundText
;
82 this.distanceToWaterSurface
= distanceToWaterSurface
;
83 this.distanceToWaterSurfaceMax
= distanceToWaterSurfaceMax
;
84 this.distanceToWaterSurfaceText
= distanceToWaterSurfaceText
;
90 public GatheringEventDTO() {
94 public static GatheringEventDTO
newInstance(GatheringEvent gathering
){
95 GatheringEventDTO dto
= new GatheringEventDTO();
96 gathering
= HibernateProxyHelper
.deproxy(gathering
);
97 if (gathering
.getLocality() != null){
98 LanguageString locality
= HibernateProxyHelper
.deproxy(gathering
.getLocality());
99 dto
.locality
= locality
.getText();
101 if (gathering
.getExactLocation() != null){
102 dto
.exactLocation
= gathering
.getExactLocation();
104 if (gathering
.getCountry() != null){
105 dto
.country
= gathering
.getCountry().getTitleCache();
107 if (gathering
.getCollectingMethod() != null){
108 dto
.collectingMethod
= gathering
.getCollectingMethod();
110 if (gathering
.getCollector() != null ){
111 dto
.collector
= gathering
.getCollector().getTitleCache();
113 if (gathering
.getAbsoluteElevation() != null){
114 dto
.absoluteElevation
= gathering
.getAbsoluteElevation();
116 if (gathering
.getAbsoluteElevationMax() != null){
117 dto
.absoluteElevationMax
= gathering
.getAbsoluteElevationMax();
119 if (gathering
.getAbsoluteElevationText() != null){
120 dto
.absoluteElevationText
= gathering
.getAbsoluteElevationText();
122 if (gathering
.getDistanceToGround() != null){
123 dto
.distanceToGround
= gathering
.getDistanceToGround();
125 if (gathering
.getDistanceToGroundMax() != null){
126 dto
.distanceToGroundMax
= gathering
.getDistanceToGroundMax();
128 if (gathering
.getDistanceToGroundText() != null){
129 dto
.distanceToGroundText
= gathering
.getDistanceToGroundText();
131 if (gathering
.getDistanceToWaterSurface() != null){
132 dto
.distanceToWaterSurface
= gathering
.getDistanceToWaterSurface();
134 if (gathering
.getDistanceToWaterSurfaceMax() != null){
135 dto
.distanceToWaterSurfaceMax
= gathering
.getDistanceToWaterSurfaceMax();
137 if (gathering
.getDistanceToWaterSurfaceText() != null){
138 dto
.distanceToWaterSurfaceText
= gathering
.getDistanceToWaterSurfaceText();
140 if(gathering
.getTimeperiod() != null) {
141 dto
.setDate(gathering
.getGatheringDate());
144 for (NamedArea area
: gathering
.getCollectingAreas()){
145 String areaString
= area
.getLabel();
146 if (dto
.getCollectingAreas() == null){
147 dto
.collectingAreas
= new HashSet
<>();
149 dto
.collectingAreas
.add(areaString
);
156 public String
getLocality() {
159 public Point
getExactLocation() {
160 return exactLocation
;
162 public String
getCountry() {
165 public Set
<String
> getCollectingAreas() {
166 return collectingAreas
;
168 public String
getCollectingMethod() {
169 return collectingMethod
;
171 public Integer
getAbsoluteElevation() {
172 return absoluteElevation
;
174 public Integer
getAbsoluteElevationMax() {
175 return absoluteElevationMax
;
177 public String
getAbsoluteElevationText() {
178 return absoluteElevationText
;
180 public Double
getDistanceToGround() {
181 return distanceToGround
;
183 public Double
getDistanceToGroundMax() {
184 return distanceToGroundMax
;
186 public String
getDistanceToGroundText() {
187 return distanceToGroundText
;
189 public Double
getDistanceToWaterSurface() {
190 return distanceToWaterSurface
;
192 public Double
getDistanceToWaterSurfaceMax() {
193 return distanceToWaterSurfaceMax
;
195 public String
getDistanceToWaterSurfaceText() {
196 return distanceToWaterSurfaceText
;
198 public String
getCollector() {
201 public void setCollector(String collector
) {
202 this.collector
= collector
;
204 public Partial
getdate() {
208 public void setDate(Partial date
) {
211 private String distanceToWaterSurfaceText
;