Project

General

Profile

Revision ec5f2748

IDec5f27489518a18eb088799a5172d7ae2c3d2b13
Parent ddda469d
Child 49405267

Added by Andreas Müller about 1 year ago

ref #8441 adapt testdata and SDDDocumentBuilder to FeatureState

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/out/SDDDocumentBuilder.java
53 53
import eu.etaxonomy.cdm.model.description.CategoricalData;
54 54
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
55 55
import eu.etaxonomy.cdm.model.description.Feature;
56
import eu.etaxonomy.cdm.model.description.FeatureState;
56 57
import eu.etaxonomy.cdm.model.description.QuantitativeData;
57 58
import eu.etaxonomy.cdm.model.description.State;
58 59
import eu.etaxonomy.cdm.model.description.StateData;
......
80 81
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
81 82
import eu.etaxonomy.cdm.model.term.Representation;
82 83
import eu.etaxonomy.cdm.model.term.TermBase;
83
import eu.etaxonomy.cdm.model.term.TermTree;
84 84
import eu.etaxonomy.cdm.model.term.TermNode;
85
import eu.etaxonomy.cdm.model.term.TermTree;
85 86
import eu.etaxonomy.cdm.model.term.TermVocabulary;
86 87

  
87 88
/**
......
101 102
	private final Map<Person, String> agents = new HashMap<>();
102 103
	private final Map<TaxonName, String> taxonNames = new HashMap<>();
103 104
	private final Map<Feature, String> characters = new HashMap<>();
104
	private final Map<TermNode, String> featureNodes = new HashMap<>();
105 105
	private final Map<Feature, String> descriptiveConcepts = new HashMap<>();
106 106
	private final Map<TaxonDescription, String> codedDescriptions = new HashMap<>();
107 107
	private final Map<Media, String> medias = new HashMap<>();
......
113 113
	private final Map<NamedArea, String> namedAreas = new HashMap<>();
114 114
	private final Map<DerivedUnit, String> specimens = new HashMap<>();
115 115

  
116
	private final Map<VersionableEntity, String> features = new HashMap<>();
117 116
	private int agentsCount = 0;
118 117
	private int articlesCount = 0;
119 118
	private int codedDescriptionsCount = 0;
......
199 198
	private final String NEWLINE = System.getProperty("line.separator");
200 199

  
201 200
	public SDDDocumentBuilder() throws SAXException, IOException {
202

  
203 201
		document = new DocumentImpl();
204

  
205 202
	}
206 203

  
207 204
	public void marshal(SDDDataSet cdmSource, File sddDestination)
......
1309 1306
			ElementImpl elDependecyRules = new ElementImpl(document,
1310 1307
					"DependecyRules");
1311 1308
			if (parent.getInapplicableIf() != null) {
1312
				Set<State> innaplicableIf = parent.getInapplicableIf();
1313
				ElementImpl elInnaplicableIf = new ElementImpl(document,
1314
						"InapplicableIf");
1315
				for (State state : innaplicableIf) {
1309
				Set<FeatureState> innaplicableIf = parent.getInapplicableIf();
1310
				ElementImpl elInnaplicableIf = new ElementImpl(document, "InapplicableIf");
1311
				for (FeatureState featureState : innaplicableIf) {
1312
				    State state = featureState.getState();
1316 1313
					ElementImpl elState = new ElementImpl(document, STATE);
1317 1314
					buildReference(state, states, REF, elState, "State",
1318 1315
							statesCount);
......
1322 1319
				dependencies = true;
1323 1320
			}
1324 1321
			if (parent.getOnlyApplicableIf() != null) {
1325
				Set<State> onlyApplicableIf = parent.getOnlyApplicableIf();
1322
				Set<FeatureState> onlyApplicableIf = parent.getOnlyApplicableIf();
1326 1323
				ElementImpl elOnlyApplicableIf = new ElementImpl(document,
1327 1324
						"OnlyApplicableIf");
1328
				for (State state : onlyApplicableIf) {
1325
				for (FeatureState featureState : onlyApplicableIf) {
1329 1326
					ElementImpl elState = new ElementImpl(document, STATE);
1330
					buildReference(state, states, REF, elState, "State",
1327
					State state = featureState.getState();
1328
                    buildReference(state, states, REF, elState, "State",
1331 1329
							statesCount);
1332 1330
					elOnlyApplicableIf.appendChild(elState);
1333 1331
				}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/FeatureState.java
39 39
 * @author a.mueller
40 40
 * @since 08.08.2019
41 41
 */
42
@XmlAccessorType(XmlAccessType.PROPERTY)
42
@XmlAccessorType(XmlAccessType.FIELD)
43 43
@XmlType(name="FeatureState", factoryMethod="NewInstance", propOrder = {
44 44
        "feature",
45 45
        "state"
cdmlib-test/src/main/resources/dbscripts/001-cdm.h2.sql
5121 5121
-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TERMRELATION_AUD;
5122 5122
CREATE CACHED TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF(
5123 5123
    TERMNODE_ID INTEGER NOT NULL,
5124
    INAPPLICABLEIF_ID INTEGER NOT NULL
5124
    INAPPLICABLEIF_OLD_ID INTEGER NOT NULL
5125 5125
);
5126 5126
-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF;
5127 5127
CREATE CACHED TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF_AUD(
5128 5128
    REV INTEGER NOT NULL,
5129 5129
    TERMNODE_ID INTEGER NOT NULL,
5130
    INAPPLICABLEIF_ID INTEGER NOT NULL,
5130
    INAPPLICABLEIF_OLD_ID INTEGER NOT NULL,
5131 5131
    REVTYPE TINYINT
5132 5132
);
5133 5133
-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF_AUD;
5134 5134
CREATE CACHED TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE(
5135 5135
    TERMNODE_ID INTEGER NOT NULL,
5136
    ONLYAPPLICABLEIF_ID INTEGER NOT NULL
5136
    ONLYAPPLICABLEIF_OLD_ID INTEGER NOT NULL
5137 5137
);
5138 5138
-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE;
5139 5139
CREATE CACHED TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE_AUD(
5140 5140
    REV INTEGER NOT NULL,
5141 5141
    TERMNODE_ID INTEGER NOT NULL,
5142
    ONLYAPPLICABLEIF_ID INTEGER NOT NULL,
5142
    ONLYAPPLICABLEIF_OLD_ID INTEGER NOT NULL,
5143 5143
    REVTYPE TINYINT
5144 5144
);
5145 5145
-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE_AUD;
......
5508 5508
ALTER TABLE PUBLIC.TAXONBASE_ORIGINALSOURCEBASE_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXE3C PRIMARY KEY(REV, TAXONBASE_ID, SOURCES_ID);
5509 5509
ALTER TABLE PUBLIC.SPECIMENOROBSERVATIONBASE_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXC81E PRIMARY KEY(ID, REV);
5510 5510
ALTER TABLE PUBLIC.TAXONNAME_MARKER ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX98E PRIMARY KEY(TAXONNAME_ID, MARKERS_ID);
5511
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXA85 PRIMARY KEY(TERMNODE_ID, ONLYAPPLICABLEIF_ID);
5511
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXA85 PRIMARY KEY(TERMNODE_ID, ONLYAPPLICABLEIF_OLD_ID);
5512 5512
ALTER TABLE PUBLIC.DESCRIPTIVEDATASET_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB92 PRIMARY KEY(ID, REV);
5513 5513
ALTER TABLE PUBLIC.NOMENCLATURALSTATUS_MARKER ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB5D PRIMARY KEY(NOMENCLATURALSTATUS_ID, MARKERS_ID);
5514 5514
ALTER TABLE PUBLIC.DESCRIPTIONBASE_ANNOTATION_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXA82 PRIMARY KEY(REV, DESCRIPTIONBASE_ID, ANNOTATIONS_ID);
......
5610 5610
ALTER TABLE PUBLIC.MEDIAKEY_TAXONSCOPE ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX3AB PRIMARY KEY(MEDIAKEY_ID, TAXONOMICSCOPE_ID);
5611 5611
ALTER TABLE PUBLIC.DERIVATIONEVENT ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX83E PRIMARY KEY(ID);
5612 5612
ALTER TABLE PUBLIC.TERMCOLLECTION_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXDDD PRIMARY KEY(ID, REV);
5613
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX3F PRIMARY KEY(REV, TERMNODE_ID, ONLYAPPLICABLEIF_ID);
5613
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX3F PRIMARY KEY(REV, TERMNODE_ID, ONLYAPPLICABLEIF_OLD_ID);
5614 5614
ALTER TABLE PUBLIC.MEDIAKEY_COVEREDTAXON ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXAA PRIMARY KEY(MEDIAKEY_ID, COVEREDTAXA_ID);
5615 5615
ALTER TABLE PUBLIC.DEFINEDTERMBASE_COUNTRY_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX96 PRIMARY KEY(REV, NAMEDAREA_ID, COUNTRIES_ID);
5616 5616
ALTER TABLE PUBLIC.MULTIACCESSKEY_COVEREDTAXON ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXCAA PRIMARY KEY(MULTIACCESSKEY_ID, COVEREDTAXA_ID);
......
5623 5623
ALTER TABLE PUBLIC.MULTIACCESSKEY_NAMEDAREA ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXCC2 PRIMARY KEY(MULTIACCESSKEY_ID, GEOGRAPHICALSCOPE_ID);
5624 5624
ALTER TABLE PUBLIC.NOMENCLATURALSTATUS_ANNOTATION ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX879 PRIMARY KEY(NOMENCLATURALSTATUS_ID, ANNOTATIONS_ID);
5625 5625
ALTER TABLE PUBLIC.GATHERINGEVENT_DEFINEDTERMBASE_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXC7 PRIMARY KEY(REV, GATHERINGEVENT_ID, COLLECTINGAREAS_ID);
5626
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXAC PRIMARY KEY(TERMNODE_ID, INAPPLICABLEIF_ID);
5626
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXAC PRIMARY KEY(TERMNODE_ID, INAPPLICABLEIF_OLD_ID);
5627 5627
ALTER TABLE PUBLIC.AGENTBASE_EXTENSION_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB9 PRIMARY KEY(REV, AGENTBASE_ID, EXTENSIONS_ID);
5628 5628
ALTER TABLE PUBLIC.ANNOTATION ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXC0 PRIMARY KEY(ID);
5629 5629
ALTER TABLE PUBLIC.COLLECTION ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB5 PRIMARY KEY(ID);
......
5635 5635
ALTER TABLE PUBLIC.HOMOTYPICALGROUP_MARKER ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXBC PRIMARY KEY(HOMOTYPICALGROUP_ID, MARKERS_ID);
5636 5636
ALTER TABLE PUBLIC.MEDIAREPRESENTATIONPART_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXX48 PRIMARY KEY(ID, REV);
5637 5637
ALTER TABLE PUBLIC.COLLECTION_EXTENSION ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXBB PRIMARY KEY(COLLECTION_ID, EXTENSIONS_ID);
5638
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB3 PRIMARY KEY(REV, TERMNODE_ID, INAPPLICABLEIF_ID);
5638
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF_AUD ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB3 PRIMARY KEY(REV, TERMNODE_ID, INAPPLICABLEIF_OLD_ID);
5639 5639
ALTER TABLE PUBLIC.PERMISSIONGROUP_GRANTEDAUTHORITYIMPL ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB1 PRIMARY KEY(GROUP_ID, GRANTEDAUTHORITIES_ID);
5640 5640
ALTER TABLE PUBLIC.DEFINEDTERMBASE_STATISTICALMEASURE ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB6 PRIMARY KEY(FEATURE_ID, RECOMMENDEDSTATISTICALMEASURES_ID);
5641 5641
ALTER TABLE PUBLIC.POLYTOMOUSKEY_SCOPE ADD CONSTRAINT PUBLIC.CONSTRAINT_XXXB7 PRIMARY KEY(POLYTOMOUSKEY_ID, SCOPERESTRICTIONS_ID);
......
6144 6144
ALTER TABLE PUBLIC.TAXONBASE_ANNOTATION_AUD ADD CONSTRAINT PUBLIC.FK8C145C434869AAE FOREIGN KEY(REV) REFERENCES PUBLIC.AUDITEVENT(REVISIONNUMBER) NOCHECK;
6145 6145
ALTER TABLE PUBLIC.DESCRIPTIONELEMENTBASE ADD CONSTRAINT PUBLIC.FK38FE7671E8D36B00 FOREIGN KEY(LANGUAGE_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6146 6146
ALTER TABLE PUBLIC.MEDIA ADD CONSTRAINT PUBLIC.FK46C7FC4AEB7F3BE FOREIGN KEY(CITATION_ID) REFERENCES PUBLIC.REFERENCE(ID) NOCHECK;
6147
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE ADD CONSTRAINT PUBLIC.FK6AE876AB57FA94D4 FOREIGN KEY(ONLYAPPLICABLEIF_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6147
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_ONLYAPPLICABLE ADD CONSTRAINT PUBLIC.FK6AE876AB57FA94D4 FOREIGN KEY(ONLYAPPLICABLEIF_OLD_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6148 6148
ALTER TABLE PUBLIC.DESCRIPTIONELEMENTBASE_MODIFIER ADD CONSTRAINT PUBLIC.FK97E0D1053B8BB609 FOREIGN KEY(DESCRIPTIONELEMENTBASE_ID) REFERENCES PUBLIC.DESCRIPTIONELEMENTBASE(ID) NOCHECK;
6149 6149
ALTER TABLE PUBLIC.TERMRELATION ADD CONSTRAINT PUBLIC.FK4CEED9F84220AFEB FOREIGN KEY(TERM_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6150 6150
ALTER TABLE PUBLIC.DEFINEDTERMBASE_STATISTICALMEASURE ADD CONSTRAINT PUBLIC.FK6FF15DFCD0BDAE9B FOREIGN KEY(FEATURE_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
......
6353 6353
ALTER TABLE PUBLIC.REFERENCE_MEDIA_AUD ADD CONSTRAINT PUBLIC.FK8318CB8134869AAE FOREIGN KEY(REV) REFERENCES PUBLIC.AUDITEVENT(REVISIONNUMBER) NOCHECK;
6354 6354
ALTER TABLE PUBLIC.INDIVIDUALSASSOCIATION_LANGUAGESTRING ADD CONSTRAINT PUBLIC.FKB5C75EC028459272 FOREIGN KEY(DESCRIPTION_MAPKEY_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6355 6355
ALTER TABLE PUBLIC.MEDIAREPRESENTATIONPART ADD CONSTRAINT PUBLIC.FK67A45544BC5DA539 FOREIGN KEY(UPDATEDBY_ID) REFERENCES PUBLIC.USERACCOUNT(ID) NOCHECK;
6356
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF ADD CONSTRAINT PUBLIC.FK56833D011128E63B FOREIGN KEY(INAPPLICABLEIF_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6356
ALTER TABLE PUBLIC.TERMNODE_DEFINEDTERMBASE_INAPPLICABLEIF ADD CONSTRAINT PUBLIC.FK56833D011128E63B FOREIGN KEY(INAPPLICABLEIF_OLD_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6357 6357
ALTER TABLE PUBLIC.COLLECTION_CREDIT_AUD ADD CONSTRAINT PUBLIC.FK25A8D88B34869AAE FOREIGN KEY(REV) REFERENCES PUBLIC.AUDITEVENT(REVISIONNUMBER) NOCHECK;
6358 6358
ALTER TABLE PUBLIC.DEFINEDTERMBASE_SUPPORTEDCATEGORICALENUMERATION ADD CONSTRAINT PUBLIC.FK2170B25CD0BDAE9B FOREIGN KEY(FEATURE_ID) REFERENCES PUBLIC.DEFINEDTERMBASE(ID) NOCHECK;
6359 6359
ALTER TABLE PUBLIC.DERIVATIONEVENT_MARKER_AUD ADD CONSTRAINT PUBLIC.FK8ED0FAE734869AAE FOREIGN KEY(REV) REFERENCES PUBLIC.AUDITEVENT(REVISIONNUMBER) NOCHECK;
cdmlib-test/src/main/resources/eu/etaxonomy/cdm/database/schema/dataset.dtd
111 111
    DETERMINATIONEVENT_REFERENCE_AUD*,
112 112
    EXTENSION*,
113 113
    EXTENSION_AUD*,
114
    FEATURESTATE*,
115
    FEATURESTATE_AUD*,
114 116
    GATHERINGEVENT*,
115 117
    GATHERINGEVENT_ANNOTATION*,
116 118
    GATHERINGEVENT_ANNOTATION_AUD*,
......
1498 1500
    UPDATEDBY_ID CDATA #IMPLIED
1499 1501
>
1500 1502

  
1503
<!ELEMENT FEATURESTATE EMPTY>
1504
<!ATTLIST FEATURESTATE
1505
    ID CDATA #REQUIRED
1506
    REV CDATA #REQUIRED
1507
    REVTYPE CDATA #IMPLIED
1508
    CREATED CDATA #IMPLIED
1509
    UUID CDATA #IMPLIED
1510
    UPDATED CDATA #IMPLIED
1511
    FEATURE_ID CDATA #IMPLIED
1512
    STATE_ID CDATA #IMPLIED
1513
    CREATEDBY_ID CDATA #IMPLIED
1514
    UPDATEDBY_ID CDATA #IMPLIED
1515
>
1516

  
1517
<!ELEMENT FEATURESTATE_AUD EMPTY>
1518
<!ATTLIST FEATURESTATE_AUD
1519
    ID CDATA #REQUIRED
1520
    CREATED CDATA #IMPLIED
1521
    UUID CDATA #IMPLIED
1522
    UPDATED CDATA #IMPLIED
1523
    FEATURE_ID CDATA #IMPLIED
1524
    STATE_ID CDATA #IMPLIED
1525
    CREATEDBY_ID CDATA #IMPLIED
1526
    UPDATEDBY_ID CDATA #IMPLIED
1527
>
1528

  
1501 1529
<!ELEMENT GATHERINGEVENT EMPTY>
1502 1530
<!ATTLIST GATHERINGEVENT
1503 1531
    ID CDATA #REQUIRED

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)