Revision 6bf3734b
Added by Andreas Müller almost 3 years ago
cdmlib-cache/src/main/resources/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml | ||
---|---|---|
199 | 199 |
<mapping class="eu.etaxonomy.cdm.model.reference.CdmLinkSource"/> |
200 | 200 |
|
201 | 201 |
<!-- Taxon Package --> |
202 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Classification"/> |
|
202 | 203 |
<mapping class="eu.etaxonomy.cdm.model.taxon.SecundumSource"/> |
203 | 204 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Synonym"/> |
204 | 205 |
<mapping class="eu.etaxonomy.cdm.model.taxon.SynonymType"/> |
205 | 206 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Taxon"/> |
207 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonomicOperation"/> |
|
206 | 208 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNode"/> |
207 | 209 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation"/> |
208 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Classification"/> |
|
209 | 210 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationship"/> |
210 | 211 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType"/> |
211 | 212 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/hibernate/EnumUserType.java | ||
---|---|---|
44 | 44 |
import eu.etaxonomy.cdm.model.taxon.ConceptStatus; |
45 | 45 |
import eu.etaxonomy.cdm.model.taxon.TaxonNodeStatus; |
46 | 46 |
import eu.etaxonomy.cdm.model.taxon.TaxonType; |
47 |
import eu.etaxonomy.cdm.model.taxon.TaxonomicOperationType; |
|
47 | 48 |
import eu.etaxonomy.cdm.model.term.IKeyTerm; |
48 | 49 |
import eu.etaxonomy.cdm.model.term.TermType; |
49 | 50 |
|
... | ... | |
159 | 160 |
//CdmClass |
160 | 161 |
}else if (clazz.equals(CdmClass.class)){ |
161 | 162 |
return CdmClass.getByKey(val); |
162 |
//CdmClass
|
|
163 |
//ConceptDefinition
|
|
163 | 164 |
}else if (clazz.equals(ConceptDefinition.class)){ |
164 | 165 |
return ConceptDefinition.getByKey(val); |
165 |
//CdmClass
|
|
166 |
//ConceptStatus
|
|
166 | 167 |
}else if (clazz.equals(ConceptStatus.class)){ |
167 | 168 |
return ConceptStatus.getByKey(val); |
168 |
//CdmClass
|
|
169 |
//TaxonType
|
|
169 | 170 |
}else if (clazz.equals(TaxonType.class)){ |
170 | 171 |
return TaxonType.getByKey(val); |
172 |
//TaxonomicOperation |
|
173 |
}else if (clazz.equals(TaxonomicOperationType.class)){ |
|
174 |
return TaxonomicOperationType.getByKey(val); |
|
171 | 175 |
}else{ |
172 | 176 |
throw new IllegalArgumentException(String.format("EnumType %s not supported by %s.", clazz.getSimpleName(), EnumUserType.class.getSimpleName())); |
173 | 177 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/Reference.java | ||
---|---|---|
695 | 695 |
} |
696 | 696 |
|
697 | 697 |
public boolean hasDatePublished(){ |
698 |
boolean result = ! ( (this.datePublished == null) || isBlank(datePublished.toString()));
|
|
698 |
boolean result = !((this.datePublished == null) || isBlank(datePublished.toString()));
|
|
699 | 699 |
return result; |
700 | 700 |
} |
701 | 701 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/ConceptDefinition.java | ||
---|---|---|
30 | 30 |
HOMOTYPIC_GROUP_WITH_EDITOR(UUID.fromString("ee316a72-fd0c-48ac-9104-0fccff091b01"),"homotypic groups with editor decisions","HGWE"), |
31 | 31 |
DESCRIPTION(UUID.fromString("eaec1b7e-a9cd-432f-a684-9504f0e85337"),"descriptions","DES"), |
32 | 32 |
DESCRIPTION_WITH_EDITOR(UUID.fromString("5ab7fd6e-b7c3-42b7-9a75-d3cccb547a96"),"descriptions with editor decisions","DESWE"), |
33 |
|
|
34 | 33 |
; |
34 |
|
|
35 | 35 |
@SuppressWarnings("unchecked") |
36 | 36 |
private ConceptDefinition(UUID uuid, String defaultString, String key){ |
37 | 37 |
delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, defaultString, key, null); |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonRelationship.java | ||
---|---|---|
22 | 22 |
import javax.xml.bind.annotation.XmlType; |
23 | 23 |
|
24 | 24 |
import org.apache.log4j.Logger; |
25 |
import org.hibernate.annotations.Cascade; |
|
26 |
import org.hibernate.annotations.CascadeType; |
|
25 | 27 |
import org.hibernate.envers.Audited; |
26 | 28 |
import org.hibernate.search.annotations.Indexed; |
27 | 29 |
import org.hibernate.search.annotations.IndexedEmbedded; |
... | ... | |
46 | 48 |
@XmlType(name = "TaxonRelationship", propOrder = { |
47 | 49 |
"relatedFrom", |
48 | 50 |
"relatedTo", |
49 |
"type" |
|
51 |
"type", |
|
52 |
"operation" |
|
50 | 53 |
}) |
51 | 54 |
@XmlRootElement(name = "TaxonRelationship") |
52 | 55 |
@Entity |
... | ... | |
81 | 84 |
@IndexedEmbedded(depth=1) |
82 | 85 |
private TaxonRelationshipType type; |
83 | 86 |
|
87 |
@XmlElement(name = "Type") |
|
88 |
@XmlIDREF |
|
89 |
@XmlSchemaType(name = "IDREF") |
|
90 |
@ManyToOne |
|
91 |
@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, CascadeType.MERGE}) |
|
92 |
private TaxonomicOperation operation; |
|
93 |
|
|
84 | 94 |
/** |
85 | 95 |
* @deprecated for hibernate only, don't use |
86 | 96 |
*/ |
... | ... | |
200 | 210 |
this.type = type; |
201 | 211 |
} |
202 | 212 |
|
213 |
public TaxonomicOperation getOperation() { |
|
214 |
return operation; |
|
215 |
} |
|
216 |
public void setOperation(TaxonomicOperation operation) { |
|
217 |
this.operation = operation; |
|
218 |
} |
|
219 |
|
|
203 | 220 |
//*********************************** CLONE *****************************************/ |
204 | 221 |
|
205 | 222 |
/** |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonomicOperation.java | ||
---|---|---|
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 javax.persistence.Column; |
|
12 |
import javax.persistence.Entity; |
|
13 |
import javax.validation.constraints.NotNull; |
|
14 |
import javax.xml.bind.annotation.XmlAccessType; |
|
15 |
import javax.xml.bind.annotation.XmlAccessorType; |
|
16 |
import javax.xml.bind.annotation.XmlAttribute; |
|
17 |
import javax.xml.bind.annotation.XmlRootElement; |
|
18 |
import javax.xml.bind.annotation.XmlType; |
|
19 |
|
|
20 |
import org.hibernate.annotations.Type; |
|
21 |
import org.hibernate.envers.Audited; |
|
22 |
|
|
23 |
import eu.etaxonomy.cdm.model.common.TimePeriod; |
|
24 |
import eu.etaxonomy.cdm.model.common.VersionableEntity; |
|
25 |
|
|
26 |
/** |
|
27 |
* see https://dev.e-taxonomy.eu/redmine/issues/9692 |
|
28 |
* |
|
29 |
* @author a.mueller |
|
30 |
* @since 02.07.2021 |
|
31 |
*/ |
|
32 |
@XmlAccessorType(XmlAccessType.FIELD) |
|
33 |
@XmlType(name = "TaxonomicOperation", propOrder = { |
|
34 |
"type", |
|
35 |
"timePeriod" |
|
36 |
}) |
|
37 |
@XmlRootElement(name = "TaxonomicOperation") |
|
38 |
@Entity |
|
39 |
@Audited |
|
40 |
public class TaxonomicOperation extends VersionableEntity { |
|
41 |
|
|
42 |
private static final long serialVersionUID = 6044997707560990508L; |
|
43 |
|
|
44 |
@XmlAttribute(name ="TaxonomicOperationType") |
|
45 |
@NotNull |
|
46 |
@Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType", |
|
47 |
parameters = {@org.hibernate.annotations.Parameter(name="enumClass", value="eu.etaxonomy.cdm.model.taxon.TaxonomicOperationType")} |
|
48 |
) |
|
49 |
@Audited |
|
50 |
@Column(length=20) |
|
51 |
private TaxonomicOperationType type; |
|
52 |
|
|
53 |
private TimePeriod timePeriod = TimePeriod.NewInstance(); |
|
54 |
|
|
55 |
// *************************** FACTORY METHODS **************************/ |
|
56 |
|
|
57 |
public static TaxonomicOperation NewInstance(TaxonomicOperationType type){ |
|
58 |
return new TaxonomicOperation(type, null); |
|
59 |
} |
|
60 |
|
|
61 |
// ************************ CONSTRUCTOR *******************************/ |
|
62 |
|
|
63 |
@Deprecated //for jaxb/hibernate use only |
|
64 |
private TaxonomicOperation(){} |
|
65 |
|
|
66 |
private TaxonomicOperation(TaxonomicOperationType type, TimePeriod timePeriod) { |
|
67 |
this.type = type; |
|
68 |
this.setTimePeriod(timePeriod); |
|
69 |
} |
|
70 |
|
|
71 |
// ********************* GETTER / SETTER ********************************/ |
|
72 |
|
|
73 |
public TaxonomicOperationType getType() { |
|
74 |
return type; |
|
75 |
} |
|
76 |
public void setType(TaxonomicOperationType type) { |
|
77 |
this.type = type; |
|
78 |
} |
|
79 |
|
|
80 |
public TimePeriod getTimePeriod() { |
|
81 |
return timePeriod; |
|
82 |
} |
|
83 |
public void setTimePeriod(TimePeriod timePeriod) { |
|
84 |
this.timePeriod = timePeriod; |
|
85 |
} |
|
86 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonomicOperationType.java | ||
---|---|---|
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.Set; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import eu.etaxonomy.cdm.model.common.Language; |
|
15 |
import eu.etaxonomy.cdm.model.term.EnumeratedTermVoc; |
|
16 |
import eu.etaxonomy.cdm.model.term.IEnumTerm; |
|
17 |
|
|
18 |
/** |
|
19 |
* see also https://dev.e-taxonomy.eu/redmine/issues/9692 |
|
20 |
* |
|
21 |
* @author a.mueller |
|
22 |
* @since 02.07.2021 |
|
23 |
*/ |
|
24 |
public enum TaxonomicOperationType implements IEnumTerm<TaxonomicOperationType> { |
|
25 |
SPLIT(UUID.fromString("e2b37637-9fe6-4e91-afb9-4c2eb49b3332"), "Split", "SPLIT"), |
|
26 |
MERGE(UUID.fromString("ef89d825-0eb4-4826-88d5-ca54a9adbae7"), "Merge", "MERGE"), |
|
27 |
; |
|
28 |
@SuppressWarnings("unchecked") |
|
29 |
private TaxonomicOperationType(UUID uuid, String defaultString, String key){ |
|
30 |
delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, defaultString, key, null); |
|
31 |
} |
|
32 |
|
|
33 |
// *************************** DELEGATE **************************************/ |
|
34 |
|
|
35 |
private static EnumeratedTermVoc<TaxonomicOperationType> delegateVoc; |
|
36 |
private IEnumTerm<TaxonomicOperationType> delegateVocTerm; |
|
37 |
|
|
38 |
static { |
|
39 |
delegateVoc = EnumeratedTermVoc.getVoc(TaxonomicOperationType.class); |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public String getKey(){return delegateVocTerm.getKey();} |
|
44 |
|
|
45 |
@Override |
|
46 |
public String getLabel(){return delegateVocTerm.getLabel();} |
|
47 |
|
|
48 |
@Override |
|
49 |
public String getLabel(Language language){return delegateVocTerm.getLabel(language);} |
|
50 |
|
|
51 |
@Override |
|
52 |
public UUID getUuid() {return delegateVocTerm.getUuid();} |
|
53 |
|
|
54 |
@Override |
|
55 |
public TaxonomicOperationType getKindOf() {return delegateVocTerm.getKindOf();} |
|
56 |
|
|
57 |
@Override |
|
58 |
public Set<TaxonomicOperationType> getGeneralizationOf() {return delegateVocTerm.getGeneralizationOf();} |
|
59 |
|
|
60 |
@Override |
|
61 |
public boolean isKindOf(TaxonomicOperationType ancestor) {return delegateVocTerm.isKindOf(ancestor); } |
|
62 |
|
|
63 |
@Override |
|
64 |
public Set<TaxonomicOperationType> getGeneralizationOf(boolean recursive) {return delegateVocTerm.getGeneralizationOf(recursive);} |
|
65 |
|
|
66 |
|
|
67 |
public static TaxonomicOperationType getByKey(String key){return delegateVoc.getByKey(key);} |
|
68 |
public static TaxonomicOperationType getByUuid(UUID uuid) {return delegateVoc.getByUuid(uuid);} |
|
69 |
|
|
70 |
//*************************** END DELEGATE *********************************************/ |
|
71 |
|
|
72 |
|
|
73 |
} |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/data/FullCoverageDataGenerator.java | ||
---|---|---|
145 | 145 |
import eu.etaxonomy.cdm.model.taxon.TaxonNodeStatus; |
146 | 146 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
147 | 147 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
148 |
import eu.etaxonomy.cdm.model.taxon.TaxonomicOperation; |
|
149 |
import eu.etaxonomy.cdm.model.taxon.TaxonomicOperationType; |
|
148 | 150 |
import eu.etaxonomy.cdm.model.term.DefinedTerm; |
149 | 151 |
import eu.etaxonomy.cdm.model.term.Representation; |
150 | 152 |
import eu.etaxonomy.cdm.model.term.TermNode; |
... | ... | |
688 | 690 |
Taxon concept = Taxon.NewInstance(name, getReference()); |
689 | 691 |
TaxonRelationship taxRel = taxon.addTaxonRelation(concept, TaxonRelationshipType.CONGRUENT_TO(), |
690 | 692 |
sec, "444"); |
693 |
taxRel.setOperation(TaxonomicOperation.NewInstance(TaxonomicOperationType.SPLIT)); |
|
691 | 694 |
taxon.setTaxonStatusUnknown(true); |
692 | 695 |
handleAnnotatableEntity(taxRel); |
693 | 696 |
concept.setConcept(true); |
... | ... | |
723 | 726 |
cdmBases.add(childTaxon); |
724 | 727 |
cdmBases.add(classification); |
725 | 728 |
cdmBases.add(agentRelationType); |
726 |
|
|
727 |
|
|
728 | 729 |
} |
729 | 730 |
|
730 |
|
|
731 |
|
|
732 |
|
|
733 | 731 |
private void createReference(List<CdmBase> cdmBases) { |
734 | 732 |
Reference reference = ReferenceFactory.newArticle(); |
735 | 733 |
Person author = Person.NewTitledInstance("Author team"); |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v523_525/SchemaUpdater_5250_5251.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import org.apache.log4j.Logger; |
15 | 15 |
|
16 |
import eu.etaxonomy.cdm.database.update.ColumnAdder; |
|
16 | 17 |
import eu.etaxonomy.cdm.database.update.ISchemaUpdater; |
17 | 18 |
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep; |
18 | 19 |
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase; |
19 |
import eu.etaxonomy.cdm.database.update.v522_523.SchemaUpdater_5220_5230;
|
|
20 |
import eu.etaxonomy.cdm.database.update.TableCreator;
|
|
20 | 21 |
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.CdmVersion; |
21 | 22 |
|
22 | 23 |
/** |
... | ... | |
50 | 51 |
|
51 | 52 |
List<ISchemaUpdaterStep> stepList = new ArrayList<>(); |
52 | 53 |
|
53 |
CollectorTitleUpdater.NewInstance(stepList); |
|
54 |
//#4311 |
|
55 |
CollectorTitleUpdater.NewInstance(stepList); |
|
56 |
|
|
57 |
//#9692 add TaxonomicOperation table |
|
58 |
stepName = "Add TaxonomicOperation table"; |
|
59 |
tableName = "TaxonomicOperation"; |
|
60 |
String[] columnNames = new String[]{"type","timeperiod_start", "timeperiod_end", "timeperiod_freetext"}; |
|
61 |
String[] columnTypes = new String[]{"string_20","string_255","string_255","string_255"}; |
|
62 |
String[] referencedTables = new String[]{null, null, null, null}; |
|
63 |
TableCreator.NewVersionableInstance(stepList, stepName, tableName, columnNames, columnTypes, referencedTables, INCLUDE_AUDIT); |
|
64 |
|
|
65 |
//#9692 add operation to taxon relationship |
|
66 |
stepName = "Add operation to taxon relationship"; |
|
67 |
tableName = "TaxonRelationship"; |
|
68 |
newColumnName = "operation_id"; |
|
69 |
String referencedTable = "TaxonomicOperation"; |
|
70 |
ColumnAdder.NewIntegerInstance(stepList, stepName, tableName, newColumnName, INCLUDE_AUDIT, !NOT_NULL, referencedTable); |
|
54 | 71 |
|
55 | 72 |
return stepList; |
56 | 73 |
} |
57 | 74 |
|
58 | 75 |
@Override |
59 | 76 |
public ISchemaUpdater getPreviousUpdater() { |
60 |
return SchemaUpdater_5220_5230.NewInstance();
|
|
77 |
return SchemaUpdater_5230_5250.NewInstance();
|
|
61 | 78 |
} |
62 | 79 |
} |
cdmlib-persistence/src/main/resources/eu/etaxonomy/cdm/hibernate.cfg.xml | ||
---|---|---|
188 | 188 |
<mapping class="eu.etaxonomy.cdm.model.reference.CdmLinkSource"/> |
189 | 189 |
|
190 | 190 |
<!-- Taxon Package --> |
191 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Classification"/> |
|
191 | 192 |
<mapping class="eu.etaxonomy.cdm.model.taxon.SecundumSource"/> |
192 | 193 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Synonym"/> |
193 | 194 |
<mapping class="eu.etaxonomy.cdm.model.taxon.SynonymType"/> |
194 | 195 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Taxon"/> |
196 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonomicOperation"/> |
|
195 | 197 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNode"/> |
196 | 198 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation"/> |
197 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Classification"/> |
|
198 | 199 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationship"/> |
199 | 200 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType"/> |
200 | 201 |
|
cdmlib-test/src/test/resources/eu/etaxonomy/cdm/hibernate.cfg.xml | ||
---|---|---|
188 | 188 |
<mapping class="eu.etaxonomy.cdm.model.reference.CdmLinkSource"/> |
189 | 189 |
|
190 | 190 |
<!-- Taxon Package --> |
191 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Classification"/> |
|
191 | 192 |
<mapping class="eu.etaxonomy.cdm.model.taxon.SecundumSource"/> |
192 | 193 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Synonym"/> |
193 | 194 |
<mapping class="eu.etaxonomy.cdm.model.taxon.SynonymType"/> |
194 | 195 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Taxon"/> |
196 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonomicOperation"/> |
|
195 | 197 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNode"/> |
196 | 198 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation"/> |
197 |
<mapping class="eu.etaxonomy.cdm.model.taxon.Classification"/> |
|
198 | 199 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationship"/> |
199 | 200 |
<mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType"/> |
200 | 201 |
|
Also available in: Unified diff
ref #9692 add operation class and link from TaxonRelationship