+ @Override
+ public String getDistributionServiceRequestParameterString(List<TaxonDescription> taxonDescriptions,
+ boolean subAreaPreference,
+ boolean statusOrderPreference,
+ Set<MarkerType> hideMarkedAreas,
+ Map<PresenceAbsenceTerm, Color> presenceAbsenceTermColors,
+ List<Language> langs,
+ boolean includeUnpublished) {
+
+ Set<Feature> features = new HashSet<>();
+ features.add(Feature.DISTRIBUTION()); //for now only this one
+ Set<Distribution> distributions = getDistributionsOf(taxonDescriptions, features, includeUnpublished);
+
+ String uriParams = getDistributionServiceRequestParameterString(distributions,
+ subAreaPreference,
+ statusOrderPreference,
+ hideMarkedAreas,
+ presenceAbsenceTermColors,
+ langs);
+
+ return uriParams;
+ }
+
+ private Set<Distribution> getDistributionsOf(List<TaxonDescription> taxonDescriptions, Set<Feature> features, boolean includeUnpublished) {
+ Set<Distribution> result = new HashSet<>();
+
+ for (TaxonDescription taxonDescription : taxonDescriptions) {
+ List<Distribution> distributions;
+ if (taxonDescription.getId() > 0){
+ distributions = dao.getDescriptionElements(taxonDescription,
+ null, features, Distribution.class, includeUnpublished, null, null, null);
+ }else{
+ distributions = new ArrayList<>();
+ for (DescriptionElementBase deb : taxonDescription.getElements()){
+ if (deb.isInstanceOf(Distribution.class)){
+ if (features == null || features.isEmpty()
+ || features.contains(deb.getFeature())) {
+ distributions.add(CdmBase.deproxy(deb, Distribution.class));
+ }
+ }
+ }
+ }
+ result.addAll(distributions);
+ }
+ return result;
+ }
+