1
|
/**
|
2
|
* Copyright (C) 2021 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.model.taxon;
|
10
|
|
11
|
import java.util.EnumSet;
|
12
|
import java.util.Set;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import javax.xml.bind.annotation.XmlEnum;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.common.Language;
|
18
|
import eu.etaxonomy.cdm.model.term.EnumeratedTermVoc;
|
19
|
import eu.etaxonomy.cdm.model.term.IEnumTerm;
|
20
|
|
21
|
/**
|
22
|
* @author a.mueller
|
23
|
* @since 10.05.2021
|
24
|
*/
|
25
|
@XmlEnum
|
26
|
public enum ConceptStatus
|
27
|
implements IEnumTerm<ConceptStatus>{
|
28
|
|
29
|
PERSISTENT(UUID.fromString("08ae05a9-2d61-4c6d-b005-5d47d0139eff"),"persistent","PER"),
|
30
|
SUPPORTS_PROVENANCE(UUID.fromString("1f0417cb-72ae-4a0e-a2fa-cce0de2c462a"),"supports provenance","PRO"),
|
31
|
CURRENT(UUID.fromString("fba936d3-e871-4993-b29c-20a846a112d7"),"current","CUR")
|
32
|
|
33
|
;
|
34
|
@SuppressWarnings("unchecked")
|
35
|
private ConceptStatus(UUID uuid, String defaultString, String key){
|
36
|
delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, defaultString, key, null);
|
37
|
}
|
38
|
|
39
|
// *************************** DELEGATE **************************************/
|
40
|
|
41
|
private static EnumeratedTermVoc<ConceptStatus> delegateVoc;
|
42
|
private IEnumTerm<ConceptStatus> delegateVocTerm;
|
43
|
|
44
|
static {
|
45
|
delegateVoc = EnumeratedTermVoc.getVoc(ConceptStatus.class);
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public String getKey(){return delegateVocTerm.getKey();}
|
50
|
|
51
|
@Override
|
52
|
public String getLabel(){return delegateVocTerm.getLabel();}
|
53
|
|
54
|
@Override
|
55
|
public String getLabel(Language language){return delegateVocTerm.getLabel(language);}
|
56
|
|
57
|
@Override
|
58
|
public UUID getUuid() {return delegateVocTerm.getUuid();}
|
59
|
|
60
|
@Override
|
61
|
public ConceptStatus getKindOf() {return delegateVocTerm.getKindOf();}
|
62
|
|
63
|
@Override
|
64
|
public Set<ConceptStatus> getGeneralizationOf() {return delegateVocTerm.getGeneralizationOf();}
|
65
|
|
66
|
@Override
|
67
|
public boolean isKindOf(ConceptStatus ancestor) {return delegateVocTerm.isKindOf(ancestor); }
|
68
|
|
69
|
@Override
|
70
|
public Set<ConceptStatus> getGeneralizationOf(boolean recursive) {return delegateVocTerm.getGeneralizationOf(recursive);}
|
71
|
|
72
|
|
73
|
public static ConceptStatus getByKey(String key){return delegateVoc.getByKey(key);}
|
74
|
public static ConceptStatus getByUuid(UUID uuid) {return delegateVoc.getByUuid(uuid);}
|
75
|
|
76
|
//*************************** END DELEGATE *********************************************/
|
77
|
|
78
|
protected static boolean includesType(EnumSet<ConceptStatus> set, ConceptStatus status) {
|
79
|
EnumSet<ConceptStatus> all;
|
80
|
if (status.getGeneralizationOf(true).isEmpty()){
|
81
|
all = EnumSet.noneOf(ConceptStatus.class);
|
82
|
}else{
|
83
|
all = EnumSet.copyOf(status.getGeneralizationOf(true));
|
84
|
}
|
85
|
all.add(status);
|
86
|
for (ConceptStatus st : all){
|
87
|
if (set.contains(st)){
|
88
|
return true;
|
89
|
}
|
90
|
}
|
91
|
return false;
|
92
|
}
|
93
|
}
|