1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.ext.geo;
|
11
|
|
12
|
import java.awt.Color;
|
13
|
import java.io.IOException;
|
14
|
import java.io.Reader;
|
15
|
import java.util.Collection;
|
16
|
import java.util.EnumSet;
|
17
|
import java.util.List;
|
18
|
import java.util.Map;
|
19
|
import java.util.Set;
|
20
|
import java.util.UUID;
|
21
|
|
22
|
import javax.xml.stream.XMLStreamException;
|
23
|
|
24
|
import org.springframework.transaction.annotation.Transactional;
|
25
|
|
26
|
import eu.etaxonomy.cdm.api.service.dto.DistributionInfoDTO;
|
27
|
import eu.etaxonomy.cdm.api.utility.DescriptionUtility;
|
28
|
import eu.etaxonomy.cdm.api.utility.DistributionOrder;
|
29
|
import eu.etaxonomy.cdm.model.common.Language;
|
30
|
import eu.etaxonomy.cdm.model.common.Marker;
|
31
|
import eu.etaxonomy.cdm.model.common.MarkerType;
|
32
|
import eu.etaxonomy.cdm.model.description.Distribution;
|
33
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
34
|
import eu.etaxonomy.cdm.model.description.TaxonDescription;
|
35
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
36
|
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
|
37
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
38
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
39
|
|
40
|
/**
|
41
|
* @author a.kohlbecker
|
42
|
* @date 18.06.2009
|
43
|
* @author n.hoffmann
|
44
|
*
|
45
|
*/
|
46
|
public interface IEditGeoService {
|
47
|
|
48
|
/**
|
49
|
* Retrieve a parameter string to pass to an EditGeoService endpoint
|
50
|
* The endpoint will deliver a a map generated by the Edit Geo Service for the given
|
51
|
* <code>TaxonDescription</code>
|
52
|
*
|
53
|
* @param taxonDescriptions
|
54
|
* A List of <code>TaxonDescription</code> holding the distribution data
|
55
|
* @param subAreaPreference
|
56
|
* enables the <b>Sub area preference rule</b> if set to true,
|
57
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
58
|
* @param statusOrderPreference
|
59
|
* enables the <b>Status order preference rule</b> if set to true,
|
60
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
61
|
* @param hideMarkedAreas
|
62
|
* distributions where the area has a {@link Marker} with one of
|
63
|
* the specified {@link MarkerType}s will be skipped, see
|
64
|
* {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
65
|
* @param presenceAbsenceTermColors
|
66
|
* A map that classifies which <code>PresenceAbsenceTermBase</code> should
|
67
|
* be assigned which <code>Color</code>
|
68
|
* @param langs
|
69
|
* @return
|
70
|
*
|
71
|
*/
|
72
|
public String getDistributionServiceRequestParameterString(
|
73
|
List<TaxonDescription> taxonDescriptions,
|
74
|
boolean subAreaPreference,
|
75
|
boolean statusOrderPreference,
|
76
|
Set<MarkerType> hideMarkedAreas,
|
77
|
Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
|
78
|
List<Language> langs);
|
79
|
|
80
|
|
81
|
/**
|
82
|
*
|
83
|
* @param distributions
|
84
|
* @param subAreaPreference
|
85
|
* enables the <b>Sub area preference rule</b> if set to true,
|
86
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
87
|
* @param statusOrderPreference
|
88
|
* enables the <b>Status order preference rule</b> if set to true,
|
89
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
90
|
* @param presenceAbsenceTermColors
|
91
|
* @param langs
|
92
|
* @return
|
93
|
*/
|
94
|
public String getDistributionServiceRequestParameterString(
|
95
|
Set<Distribution> distributions,
|
96
|
boolean subAreaPreference,
|
97
|
boolean statusOrderPreference,
|
98
|
Set<MarkerType> hideMarkedAreas,
|
99
|
Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
|
100
|
List<Language> langs);
|
101
|
|
102
|
/**
|
103
|
* Retrieve a parameter string to pass to an EditGeoService endpoint
|
104
|
* The endpoint will deliver a a map generated by the Edit Geo Service for the given
|
105
|
* <code>TaxonDescription</code>
|
106
|
*
|
107
|
* @param description
|
108
|
* The <code>TaxonDescription</code> holding the distribution data
|
109
|
* @param subAreaPreference
|
110
|
* enables the <b>Sub area preference rule</b> if set to true,
|
111
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
112
|
* @param statusOrderPreference
|
113
|
* enables the <b>Status order preference rule</b> if set to true,
|
114
|
* see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
|
115
|
* @param hideMarkedAreas
|
116
|
* distributions where the area has a {@link Marker} with one of
|
117
|
* the specified {@link MarkerType}s will be skipped, see
|
118
|
* {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
119
|
* @param presenceAbsenceTermColors
|
120
|
* A map that classifies which <code>PresenceAbsenceTermBase</code> should
|
121
|
* be assigned which <code>Color</code>
|
122
|
* @return
|
123
|
*
|
124
|
* @deprecated use {@link #getDistributionServiceRequestParameterString(List, Map, int, int, String, String, List)} instead
|
125
|
*/
|
126
|
@Deprecated
|
127
|
public String getDistributionServiceRequestParameterString(TaxonDescription description,
|
128
|
boolean subAreaPreference,
|
129
|
boolean statusOrderPreference,
|
130
|
Set<MarkerType> hideMarkedAreas,
|
131
|
Map<PresenceAbsenceTerm,Color> presenceAbsenceTermColors,
|
132
|
List<Language> langs);
|
133
|
|
134
|
|
135
|
public OccurrenceServiceRequestParameterDto getOccurrenceServiceRequestParameterString(
|
136
|
List<SpecimenOrObservationBase> specimensOrObersvations,
|
137
|
Map<SpecimenOrObservationType,Color> specimenOrObservationTypeColors
|
138
|
);
|
139
|
|
140
|
/**
|
141
|
* Adds an area mapping (CDM area -> geo service area). It is recommended to set the mapping
|
142
|
* in a persistent way, so it is available after restarting the application.
|
143
|
* @param area
|
144
|
* @param geoServiceArea
|
145
|
* @throws XMLStreamException
|
146
|
*/
|
147
|
public void setMapping(NamedArea area, GeoServiceArea geoServiceArea);
|
148
|
|
149
|
/**
|
150
|
* Reads csv data containing the attributes from a shape file and adds the
|
151
|
* shapefile data to each area in the given set of {@link NamedAreas}. The
|
152
|
* way this data it attached to the areas is specific to the
|
153
|
* {@link IGeoServiceAreaMapping} implementation. It is recommended to
|
154
|
* create csv file directly from the original shape file by making use of
|
155
|
* the {@code org2ogr} command which is contained in the <a
|
156
|
* href="http://www.gdal.org/ogr2ogr.html">gdal</a> tools:
|
157
|
*
|
158
|
* <pre>
|
159
|
* ogr2ogr -f csv out.csv input_shape_file.shp
|
160
|
* </pre>
|
161
|
*
|
162
|
* @param csvReader
|
163
|
* @param idSearchFields
|
164
|
* An ordered list column names in the the csv file to be
|
165
|
* imported. These columns will be used to search for the
|
166
|
* {@link NamedArea#getIdInVocabulary() IdInVocabulary} of each
|
167
|
* area
|
168
|
* @param wmsLayerName
|
169
|
* @return the resulting table of the import, also together with diagnostic
|
170
|
* messages per NamedArea (id not found, ambiguous mapping)
|
171
|
* @param areaVocabularyUuid
|
172
|
* , can be <code>NULL</code>. The NamedAreas contained in this
|
173
|
* vocabulary will be combined with areas defined in the
|
174
|
* <code>namedAreaUuids</code>
|
175
|
* @param namedAreaUuids
|
176
|
* a set of UUIDS for {@link NamedArea}. Can be <code>NULL</code>.
|
177
|
* Will be combined with the vocabulary if the
|
178
|
* <code>areaVocabularyUuid</code> is also given.
|
179
|
*
|
180
|
* @return
|
181
|
* @throws IOException
|
182
|
*/
|
183
|
@Transactional(readOnly=false)
|
184
|
public abstract Map<NamedArea, String> mapShapeFileToNamedAreas(Reader csvReader,
|
185
|
List<String> idSearchFields, String wmsLayerName, UUID areaVocabularyUuid,
|
186
|
Set<UUID> namedAreaUuids)
|
187
|
throws IOException;
|
188
|
|
189
|
/**
|
190
|
*
|
191
|
* @param parts
|
192
|
* @param taxonUUID
|
193
|
* @param subAreaPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
194
|
* @param statusOrderPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
195
|
* @param hiddenAreaMarkerTypes see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
|
196
|
* @param omitLevels see {@link DescriptionUtility#orderDistributions(Set, Collection)}
|
197
|
* @param presenceAbsenceTermColors
|
198
|
* @param languages
|
199
|
* @param propertyPaths
|
200
|
* @return
|
201
|
*/
|
202
|
public DistributionInfoDTO composeDistributionInfoFor(EnumSet<DistributionInfoDTO.InfoPart> parts, UUID taxonUUID,
|
203
|
boolean subAreaPreference, boolean statusOrderPreference, Set<MarkerType> hiddenAreaMarkerTypes,
|
204
|
Set<NamedAreaLevel> omitLevels, Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
|
205
|
List<Language> languages, List<String> propertyPaths, CondensedDistributionRecipe recipe,
|
206
|
DistributionOrder distributionOrder);
|
207
|
|
208
|
}
|