import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
import eu.etaxonomy.cdm.model.media.Media;\r
+import eu.etaxonomy.cdm.model.media.MediaRepresentation;\r
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;\r
import eu.etaxonomy.cdm.model.media.MediaUtils;\r
import eu.etaxonomy.cdm.model.name.NameRelationship;\r
"elements.states.$",\r
"elements.sources.citation.authorTeam",\r
"elements.sources.nameUsedInSource.originalNameString",\r
- /*//"elements.multilanguageText",\r
- "elements.media.representations.parts",*/\r
+ "elements.multilanguageText",\r
+ "elements.media.representations.parts",\r
"elements.media.title",\r
});\r
\r
});\r
\r
private static final List<String> TYPEDESIGNATION_INIT_STRATEGY = Arrays.asList(new String []{\r
- //"$",\r
"typeSpecimen.$",\r
"citation.authorTeam.$",\r
"typeName",\r
+ "typeStatus"\r
});\r
\r
protected static final List<String> TAXONNODE_WITHTAXON_INIT_STRATEGY = Arrays.asList(new String []{\r
private List<Media> getMediaForTaxon(Taxon taxon, Class<? extends MediaRepresentationPart> type, String[] mimeTypes,\r
Integer widthOrDuration, Integer height, Integer size){\r
\r
- Pager<TaxonDescription> p =\r
- descriptionService.getTaxonDescriptions(taxon, null, null, null, null, TAXONDESCRIPTION_MEDIA_INIT_STRATEGY);\r
-\r
- // pars the media and quality parameters\r
-\r
+ List<Media> taxonGalleryMedia = service.listTaxonDescriptionMedia(taxon, false, TAXONDESCRIPTION_MEDIA_INIT_STRATEGY);\r
\r
- // collect all media of the given taxon\r
- boolean limitToGalleries = false;\r
- List<Media> taxonMedia = new ArrayList<Media>();\r
- List<Media> taxonGalleryMedia = new ArrayList<Media>();\r
- for(TaxonDescription desc : p.getRecords()){\r
-\r
- if(desc.isImageGallery()){\r
- for(DescriptionElementBase element : desc.getElements()){\r
- for(Media media : element.getMedia()){\r
- taxonGalleryMedia.add(media);\r
- }\r
- }\r
- } else if(!limitToGalleries){\r
- for(DescriptionElementBase element : desc.getElements()){\r
- for(Media media : element.getMedia()){\r
- taxonMedia.add(media);\r
- }\r
- }\r
- }\r
+ Map<Media, MediaRepresentation> mediaRepresentationMap = MediaUtils.findPreferredMedia(taxonGalleryMedia, type,\r
+ mimeTypes, null, widthOrDuration, height, size);\r
\r
+ List<Media> filteredMedia = new ArrayList<Media>(mediaRepresentationMap.size());\r
+ for(Media media : mediaRepresentationMap.keySet()){\r
+ media.getRepresentations().clear();\r
+ media.addRepresentation(mediaRepresentationMap.get(media));\r
+ filteredMedia.add(media);\r
}\r
\r
- taxonGalleryMedia.addAll(taxonMedia);\r
-\r
- List<Media> returnMedia = MediaUtils.findPreferredMedia(taxonGalleryMedia, type,\r
- mimeTypes, null, widthOrDuration, height, size);\r
-\r
- return returnMedia;\r
+ return filteredMedia;\r
}\r
\r
\r