--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2023 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.model.metadata;
+
+/**
+ * @author katjaluther
+ * @date 10.10.2023
+ *
+ */
+public enum DistributionDescription implements IKeyLabel{
+ AlwaysDefault("AlwaysDefault", "Always use default description"),
+ OwnDescriptionForDistributions("OwnDescription", "Use own description for distributions"),
+ DescriptionsPerSource("DescriptionPerSource", "Every source has its own description");
+
+
+ private String label;
+ private String key;
+
+ private DistributionDescription(String key, String label) {
+ this.key = key;
+ this.label = label;
+ }
+
+ @Override
+ public String getLabel() {
+
+ return label;
+ }
+
+ @Override
+ public String getKey() {
+
+ return key;
+ }
+
+ @Override
+ public String toString() {
+ return key;
+ }
+
+ public static DistributionDescription byKey(String key){
+ for (DistributionDescription distributionDesc : values()){
+ if (distributionDesc.key.equals(key)){
+ return distributionDesc;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
+
+}
DisplayOfStatusInCombo(UUID.fromString("a8ff1763-987f-4935-aaba-910f3a870d07"), "Distribution Editor: Display of Status", "distribution.editor.status.combo_display", TermComboEnum.TermDisplayPlusTitle),
DisplayOfAreasInDistributionEditor(UUID.fromString("7b671bba-1b7f-4cb9-bbac-c914518a4bf8"), "Distribution Editor: Display of Areas", "distribution.editor.areas.displayAreas", TermDisplayEnum.Title),
NumberOfVisibleStatusInDropDown(UUID.fromString("5e5ed585-2212-4d07-bbaf-c5e19a61dace"), "Distribution Editor: Number of visible status in drop down", "distribution.editor.status.numberVisibleStatus", 10),
- OwnDescriptionForDistributionEditor(UUID.fromString("38282571-049c-473e-bec3-bde6f65f796a"), "Distribution Editor: Create distribution editor TaxonDescription", "distribution.editor.distributionOwnDescription", Boolean.FALSE),
+ DescriptionForDistributionEditor(UUID.fromString("38282571-049c-473e-bec3-bde6f65f796a"), "Distribution Editor: Create distribution editor TaxonDescription", "distribution.editor.distributionOwnDescription", DistributionDescription.AlwaysDefault),
AvailableDistributionAreaTerms(UUID.fromString("34469acc-9e23-4f95-92d4-1695e02cb5a0"), "Available Distribution Area Terms", "distribution.area.terms", null), //default: all/no filter
//Character matrix
UUID taxonUUID;
Set<TaxonDescription> descriptions = new HashSet();
- public TaxonDescriptionDTO(Taxon taxon, boolean onlyUseDefault){
+ public TaxonDescriptionDTO(Taxon taxon, boolean alwaysUseDefault){
this.taxonUUID = taxon.getUuid();
for (TaxonDescription desc: taxon.getDescriptions()){
if (desc.isDefault()) {
descriptions.add(desc);
- if (onlyUseDefault) {
- break;
- }
}
}
- if (descriptions.isEmpty() || !onlyUseDefault) {
+ if (descriptions.isEmpty() || !alwaysUseDefault) {
for (TaxonDescription desc: taxon.getDescriptions()){
if (desc.isComputed()) {
continue;