Project

General

Profile

« Previous | Next » 

Revision 03c4eee9

Added by Andreas Kohlbecker about 9 years ago

performance: avoiding second distribution filtering when creating the DistributionServiceRequestParameterString - #4911

View differences:

cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceUtilities.java
175 175
    static final String VALUE_SUPER_LIST_ENTRY_SEPARATOR = "||";
176 176

  
177 177

  
178

  
179
    //preliminary implementation for TDWG areas
180 178
    /**
181 179
     * Returns the parameter String for the EDIT geo webservice to create a
182
     * dsitribution map.
180
     * distribution map.
183 181
     *
184 182
     * @param distributions
185 183
     *            A set of distributions that should be shown on the map
186
     * @param subAreaPreference
187
     *            enables the <b>Sub area preference rule</b> if set to true,
188
     *            see {@link DescriptionUtility#filterDistributions(Collection,
189
     *            boolean, boolean}
184
     *            The {@link DescriptionUtility} class provides a method for
185
     *            filtering a set of Distributions :
190 186
     *
191
     * @param statusOrderPreference
192
     *            enables the <b>Status order preference rule</b> if set to
193
     *            true, see {@link
194
     *            DescriptionUtility#filterDistributions(Collection, boolean,
195
     *            boolean}
187
     *            {@code
188
     *            Collection<Distribution> filteredDistributions =
189
     *            DescriptionUtility.filterDistributions(distributions,
190
     *            subAreaPreference, statusOrderPreference, hideMarkedAreas);
191
     *            }
196 192
     * @param hideMarkedAreas
197 193
     *            distributions where the area has a {@link Marker} with one of
198 194
     *            the specified {@link MarkerType}s will be skipped, see
......
203 199
     *            PresenceAbsenceTerm is not included in this map, it's default
204 200
     *            color is taken instead. If the map == null all terms are
205 201
     *            colored by their default color.
202
     * @param projectToLayer
203
     *            name of a layer which is representing a specific
204
     *            {@link NamedAreaLevel} Supply this parameter if you to project
205
     *            all other distribution area levels to this layer.
206
     *
206 207
     * @param width
207 208
     *            The maps width
208 209
     * @param height
......
210 211
     * @param bbox
211 212
     *            The maps bounding box (e.g. "-180,-90,180,90" for the whole
212 213
     *            world)
213
     * @param projectToLayer
214
     *            name of a layer which is representing a specific
215
     *            {@link NamedAreaLevel} Supply this parameter if you to project
216
     *            all other distribution area levels to this layer.
217 214
     * @param layer
218 215
     *            The layer that is responsible for background borders and
219 216
     *            colors. Use the name for the layer. If null 'earth' is taken
220 217
     *            as default.
218
     *
221 219
     * @return the parameter string or an empty string if the
222 220
     *         <code>distributions</code> set was null or empty.
223 221
     */
224 222
    @Transient
225 223
    public static String getDistributionServiceRequestParameterString(
226
            Set<Distribution> distributions,
227
            boolean subAreaPreference,
228
            boolean statusOrderPreference,
224
            Collection<Distribution> filteredDistributions,
229 225
            Set<MarkerType> hideMarkedAreas,
230 226
            IGeoServiceAreaMapping mapping,
231 227
            Map<PresenceAbsenceTerm,Color> presenceAbsenceTermColors,
232
            String projectToLayer, List<Language> languages){
228
            String projectToLayer,
229
            List<Language> languages){
233 230

  
234 231

  
235 232
        /*
......
258 255

  
259 256

  
260 257
        //handle empty set
261
        if(distributions == null || distributions.size() == 0){
258
        if(filteredDistributions == null || filteredDistributions.size() == 0){
262 259
            return "";
263 260
        }
264 261

  
265 262
        presenceAbsenceTermColors = mergeMaps(getDefaultPresenceAbsenceTermBaseColors(), presenceAbsenceTermColors);
266 263

  
267
        Collection<Distribution> filteredDistributions = DescriptionUtility.filterDistributions(distributions, subAreaPreference, statusOrderPreference, hideMarkedAreas);
268

  
269 264
        Map<String, Map<Integer, Set<Distribution>>> layerMap = new HashMap<String, Map<Integer, Set<Distribution>>>();
270 265
        List<PresenceAbsenceTerm> statusList = new ArrayList<PresenceAbsenceTerm>();
271 266

  

Also available in: Unified diff