Project

General

Profile

Download (9.16 KB) Statistics
| Branch: | Tag: | Revision:
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.model.common.Language;
29
import eu.etaxonomy.cdm.model.common.Marker;
30
import eu.etaxonomy.cdm.model.common.MarkerType;
31
import eu.etaxonomy.cdm.model.description.Distribution;
32
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
33
import eu.etaxonomy.cdm.model.description.TaxonDescription;
34
import eu.etaxonomy.cdm.model.location.NamedArea;
35
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
36
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
37
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
38

    
39
/**
40
 * @author a.kohlbecker
41
 * @date 18.06.2009
42
 * @author n.hoffmann
43
 *
44
 */
45
public interface IEditGeoService {
46

    
47
    /**
48
     * Retrieve a parameter string to pass to an EditGeoService endpoint
49
     * The endpoint will deliver a  a map generated by the Edit Geo Service for the given
50
     * <code>TaxonDescription</code>
51
     *
52
     * @param taxonDescriptions
53
     * 			A List of <code>TaxonDescription</code> holding the distribution data
54
     * @param subAreaPreference
55
     *            enables the <b>Sub area preference rule</b> if set to true,
56
     *            see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
57
     * @param statusOrderPreference
58
     *            enables the <b>Status order preference rule</b> if set to true,
59
     *            see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
60
     * @param hideMarkedAreas
61
     *            distributions where the area has a {@link Marker} with one of
62
     *            the specified {@link MarkerType}s will be skipped, see
63
     *            {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
64
     * @param presenceAbsenceTermColors
65
     * 			A map that classifies which <code>PresenceAbsenceTermBase</code> should
66
     * 			be assigned which <code>Color</code>
67
     * @param langs
68
     * @return
69
     *
70
     */
71
    public String getDistributionServiceRequestParameterString(
72
            List<TaxonDescription> taxonDescriptions,
73
            boolean subAreaPreference,
74
            boolean statusOrderPreference,
75
            Set<MarkerType> hideMarkedAreas,
76
            Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
77
            List<Language> langs);
78

    
79

    
80
    /**
81
     *
82
     * @param distributions
83
     * @param subAreaPreference
84
     *            enables the <b>Sub area preference rule</b> if set to true,
85
     *            see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
86
     * @param statusOrderPreference
87
     *            enables the <b>Status order preference rule</b> if set to true,
88
     *            see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
89
     * @param presenceAbsenceTermColors
90
     * @param langs
91
     * @return
92
     */
93
    public String getDistributionServiceRequestParameterString(
94
            Set<Distribution> distributions,
95
            boolean subAreaPreference,
96
            boolean statusOrderPreference,
97
            Set<MarkerType> hideMarkedAreas,
98
            Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
99
            List<Language> langs);
100

    
101
    /**
102
     * Retrieve a parameter string to pass to an EditGeoService endpoint
103
     * The endpoint will deliver a  a map generated by the Edit Geo Service for the given
104
     * <code>TaxonDescription</code>
105
     *
106
     * @param description
107
     * 			The <code>TaxonDescription</code> holding the distribution data
108
     * @param subAreaPreference
109
     *            enables the <b>Sub area preference rule</b> if set to true,
110
     *            see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
111
     * @param statusOrderPreference
112
     *            enables the <b>Status order preference rule</b> if set to true,
113
     *            see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean}
114
     * @param hideMarkedAreas
115
     *            distributions where the area has a {@link Marker} with one of
116
     *            the specified {@link MarkerType}s will be skipped, see
117
     *            {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
118
     * @param presenceAbsenceTermColors
119
     * 			A map that classifies which <code>PresenceAbsenceTermBase</code> should
120
     * 			be assigned which <code>Color</code>
121
     * @return
122
     *
123
     * @deprecated use {@link #getDistributionServiceRequestParameterString(List, Map, int, int, String, String, List)} instead
124
     */
125
    @Deprecated
126
    public String getDistributionServiceRequestParameterString(TaxonDescription description,
127
            boolean subAreaPreference,
128
            boolean statusOrderPreference,
129
            Set<MarkerType> hideMarkedAreas,
130
            Map<PresenceAbsenceTerm,Color> presenceAbsenceTermColors,
131
            List<Language> langs);
132

    
133

    
134
    public OccurrenceServiceRequestParameterDto getOccurrenceServiceRequestParameterString(
135
            List<SpecimenOrObservationBase> specimensOrObersvations,
136
            Map<SpecimenOrObservationType,Color> specimenOrObservationTypeColors
137
            );
138

    
139
    /**
140
     * Adds an area mapping (CDM area -> geo service area). It is recommended to set the mapping
141
     * in a persistent way, so it is available after restarting the application.
142
     * @param area
143
     * @param geoServiceArea
144
     * @throws XMLStreamException
145
     */
146
    public void setMapping(NamedArea area, GeoServiceArea geoServiceArea);
147

    
148
    /**
149
     * Reads csv data containing the attributes from a shape file and adds the
150
     * shapefile data to each area in the given set of {@link NamedAreas}. The
151
     * way this data it attached to the areas is specific to the
152
     * {@link IGeoServiceAreaMapping} implementation. It is recommended to
153
     * create csv file directly from the original shape file by making use of
154
     * the {@code org2ogr} command which is contained in the <a
155
     * href="http://www.gdal.org/ogr2ogr.html">gdal</a> tools:
156
     *
157
     * <pre>
158
     * ogr2ogr -f csv out.csv input_shape_file.shp
159
     * </pre>
160
     *
161
     * @param csvReader
162
     * @param idSearchFields
163
     *            An ordered list column names in the the csv file to be
164
     *            imported. These columns will be used to search for the
165
     *            {@link NamedArea#getIdInVocabulary() IdInVocabulary} of each
166
     *            area
167
     * @param wmsLayerName
168
     * @return the resulting table of the import, also together with diagnostic
169
     *         messages per NamedArea (id not found, ambiguous mapping)
170
     * @param areaVocabularyUuid
171
     *            , can be <code>NULL</code>. The NamedAreas contained in this
172
     *            vocabulary will be combined with areas defined in the
173
     *            <code>namedAreaUuids</code>
174
     * @param namedAreaUuids
175
     *            a set of UUIDS for {@link NamedArea}. Can be <code>NULL</code>.
176
     *            Will be combined with the vocabulary if the
177
     *            <code>areaVocabularyUuid</code> is also given.
178
     *
179
     * @return
180
     * @throws IOException
181
     */
182
    @Transactional(readOnly=false)
183
    public abstract Map<NamedArea, String> mapShapeFileToNamedAreas(Reader csvReader,
184
            List<String> idSearchFields, String wmsLayerName, UUID areaVocabularyUuid,
185
            Set<UUID> namedAreaUuids)
186
            throws IOException;
187

    
188
    /**
189
    *
190
    * @param parts
191
    * @param taxonUUID
192
    * @param subAreaPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
193
    * @param statusOrderPreference see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
194
    * @param hiddenAreaMarkerTypes see {@link DescriptionUtility#filterDistributions(Collection, boolean, boolean, Set)}
195
    * @param omitLevels see {@link DescriptionUtility#orderDistributions(Set, Collection)}
196
    * @param presenceAbsenceTermColors
197
    * @param languages
198
     * @param propertyPaths
199
    * @return
200
    */
201
    public DistributionInfoDTO composeDistributionInfoFor(EnumSet<DistributionInfoDTO.InfoPart> parts, UUID taxonUUID,
202
            boolean subAreaPreference, boolean statusOrderPreference, Set<MarkerType> hiddenAreaMarkerTypes,
203
            Set<NamedAreaLevel> omitLevels, Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
204
            List<Language> languages, List<String> propertyPaths, CondensedDistributionRecipe recipe);
205

    
206
}
(8-8/11)