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
.model
.common
.Language
;
15 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
16 import eu
.etaxonomy
.cdm
.model
.location
.Point
;
17 import eu
.etaxonomy
.cdm
.model
.occurrence
.GatheringEvent
;
18 import eu
.etaxonomy
.cdm
.persistence
.dto
.TermDto
;
25 public class GatheringEventDTO
{
27 private String locality
;
28 private Point exactLocation
;
29 private String country
;
30 private Set
<TermDto
> 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
<TermDto
> 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 if (gathering
.getLocality() != null){
91 dto
.locality
= gathering
.getLocality().getLanguageLabel(Language
.DEFAULT());
93 if (gathering
.getExactLocation() != null){
94 dto
.exactLocation
= gathering
.getExactLocation();
96 if (gathering
.getCountry() != null){
97 dto
.country
= gathering
.getCountry().getTitleCache();
99 if (gathering
.getCollectingMethod() != null){
100 dto
.collectingMethod
= gathering
.getCollectingMethod();
102 if (gathering
.getCollector() != null ){
103 dto
.collector
= gathering
.getCollector().getTitleCache();
105 if (gathering
.getAbsoluteElevation() != null){
106 dto
.absoluteElevation
= gathering
.getAbsoluteElevation();
108 if (gathering
.getAbsoluteElevationMax() != null){
109 dto
.absoluteElevationMax
= gathering
.getAbsoluteElevationMax();
111 if (gathering
.getAbsoluteElevationText() != null){
112 dto
.absoluteElevationText
= gathering
.getAbsoluteElevationText();
114 if (gathering
.getDistanceToGround() != null){
115 dto
.distanceToGround
= gathering
.getDistanceToGround();
117 if (gathering
.getDistanceToGroundMax() != null){
118 dto
.distanceToGroundMax
= gathering
.getDistanceToGroundMax();
120 if (gathering
.getDistanceToGroundText() != null){
121 dto
.distanceToGroundText
= gathering
.getDistanceToGroundText();
123 if (gathering
.getDistanceToWaterSurface() != null){
124 dto
.distanceToWaterSurface
= gathering
.getDistanceToWaterSurface();
126 if (gathering
.getDistanceToWaterSurfaceMax() != null){
127 dto
.distanceToWaterSurfaceMax
= gathering
.getDistanceToWaterSurfaceMax();
129 if (gathering
.getDistanceToWaterSurfaceText() != null){
130 dto
.distanceToWaterSurfaceText
= gathering
.getDistanceToWaterSurfaceText();
133 for (NamedArea area
: gathering
.getCollectingAreas()){
134 TermDto areaDto
= TermDto
.fromNamedArea(area
);
135 if (dto
.getCollectingAreas() == null){
136 dto
.collectingAreas
= new HashSet
<>();
138 dto
.collectingAreas
.add(areaDto
);
145 public String
getLocality() {
148 public Point
getExactLocation() {
149 return exactLocation
;
151 public String
getCountry() {
154 public Set
<TermDto
> getCollectingAreas() {
155 return collectingAreas
;
157 public String
getCollectingMethod() {
158 return collectingMethod
;
160 public Integer
getAbsoluteElevation() {
161 return absoluteElevation
;
163 public Integer
getAbsoluteElevationMax() {
164 return absoluteElevationMax
;
166 public String
getAbsoluteElevationText() {
167 return absoluteElevationText
;
169 public Double
getDistanceToGround() {
170 return distanceToGround
;
172 public Double
getDistanceToGroundMax() {
173 return distanceToGroundMax
;
175 public String
getDistanceToGroundText() {
176 return distanceToGroundText
;
178 public Double
getDistanceToWaterSurface() {
179 return distanceToWaterSurface
;
181 public Double
getDistanceToWaterSurfaceMax() {
182 return distanceToWaterSurfaceMax
;
184 public String
getDistanceToWaterSurfaceText() {
185 return distanceToWaterSurfaceText
;
187 public String
getCollector() {
190 public void setCollector(String collector
) {
191 this.collector
= collector
;
193 private String distanceToWaterSurfaceText
;