2 * Copyright (C) 2011 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.editor
.view
.uses
;
11 import java
.util
.ArrayList
;
12 import java
.util
.HashSet
;
13 import java
.util
.List
;
17 import eu
.etaxonomy
.cdm
.model
.common
.Marker
;
18 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
19 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionBase
;
20 import eu
.etaxonomy
.cdm
.model
.description
.IDescribable
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
22 import eu
.etaxonomy
.taxeditor
.editor
.view
.descriptive
.DescriptiveContentProvider
;
23 import eu
.etaxonomy
.taxeditor
.model
.FeatureNodeContainerTree
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 import eu
.etaxonomy
.taxeditor
.store
.UsageTermCollection
;
28 * The class provides the required content to the Uses View
30 * @created mar 13, 2012
33 public class UsesContentProvider
extends DescriptiveContentProvider
{
35 Set
<MarkerType
> markerTypes
= new HashSet
<MarkerType
>();
38 * <p>Constructor for DescriptiveContentProvider.</p>
40 * @param featureNodeContainerCache a {@link java.util.Map} object.
42 public UsesContentProvider(Map
<DescriptionBase
<?
>, FeatureNodeContainerTree
> featureNodeContainerCache
) {
43 super(featureNodeContainerCache
);
44 this.featureNodeContainerCache
= featureNodeContainerCache
;
48 * Get all descriptions associated with the given TaxonEditorInput
50 * @param parentElement
54 protected List
<DescriptionBase
<?
>> getDescriptions(IDescribable
<?
> parentElement
) {
55 List
<DescriptionBase
<?
>> descriptions
= new ArrayList
<DescriptionBase
<?
>>();
56 if(parentElement
instanceof Taxon
){
57 Taxon taxon
= (Taxon
) parentElement
;
58 this.markerTypes
.addAll(CdmStore
.getTermManager().getPreferredTerms(MarkerType
.class));
59 for(DescriptionBase
<?
> description
: taxon
.getDescriptions()){
60 if(! description
.isImageGallery()){
61 Set
<Marker
> descriptionMarkers
= description
.getMarkers();
62 if(descriptionMarkers
!= null) {
63 for (Marker marker
: descriptionMarkers
) {
64 if(marker
.getMarkerType() != null && marker
.getMarkerType().getUuid().equals(UsageTermCollection
.uuidUseMarkerType
)) {
65 descriptions
.add(description
);