Revision e0bbe0fa
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/MatrixUtility.java | ||
---|---|---|
11 | 11 |
import java.util.Set; |
12 | 12 |
import java.util.stream.Collectors; |
13 | 13 |
|
14 |
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
|
|
14 |
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
|
|
15 | 15 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
16 | 16 |
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet; |
17 | 17 |
import eu.etaxonomy.cdm.model.description.Feature; |
... | ... | |
69 | 69 |
+(max==null?"":"("+max.toString()+")"); //$NON-NLS-1$ |
70 | 70 |
} |
71 | 71 |
|
72 |
/** |
|
73 |
* Checks if the given entity has any marker of type |
|
74 |
* {@link MarkerType#COMPUTED()} |
|
75 |
* |
|
76 |
* @param entity |
|
77 |
* the entity to check |
|
78 |
* @return <code>true</code> of a computed marker was found, |
|
79 |
* <code>false</code> otherwise |
|
80 |
*/ |
|
81 |
public static boolean isEntityComputed(AnnotatableEntity entity){ |
|
82 |
return entity.getMarkers().stream() |
|
83 |
.anyMatch(marker->marker.getMarkerType().equals(MarkerType.COMPUTED())); |
|
84 |
} |
|
85 |
|
|
86 |
|
|
87 | 72 |
public static Classification getClassificationForDescriptiveDataSet(DescriptiveDataSet descriptiveDataSet){ |
88 | 73 |
Set<TaxonNode> taxonSubtreeFilter = descriptiveDataSet.getTaxonSubtreeFilter(); |
89 | 74 |
if(taxonSubtreeFilter!=null && !taxonSubtreeFilter.isEmpty()){ |
... | ... | |
91 | 76 |
} |
92 | 77 |
return null; |
93 | 78 |
} |
79 |
|
|
80 |
public static boolean isDefaultTaxonDescription(TaxonRowWrapperDTO taxonRowWrapperDTO){ |
|
81 |
return hasMarker(taxonRowWrapperDTO, MarkerType.USE()); |
|
82 |
} |
|
83 |
|
|
84 |
public static boolean isAggregatedTaxonDescription(TaxonRowWrapperDTO taxonRowWrapperDTO){ |
|
85 |
return hasMarker(taxonRowWrapperDTO, MarkerType.COMPUTED()); |
|
86 |
} |
|
87 |
|
|
88 |
public static boolean isLiteratureTaxonDescription(TaxonRowWrapperDTO taxonRowWrapperDTO){ |
|
89 |
return hasMarker(taxonRowWrapperDTO, MarkerType.IN_BIBLIOGRAPHY()); |
|
90 |
} |
|
91 |
|
|
92 |
private static boolean hasMarker(TaxonRowWrapperDTO taxonRowWrapperDTO, MarkerType markerType){ |
|
93 |
return taxonRowWrapperDTO.getDescription().getMarkers().stream() |
|
94 |
.anyMatch(marker->marker.getMarkerType().equals(markerType)); |
|
95 |
} |
|
94 | 96 |
} |
95 | 97 |
|
Also available in: Unified diff
ref #7674 Add specific style and label for each taxon description type