Revision bb38665e
Added by Andreas Müller over 10 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/util/TestDatabase.java | ||
---|---|---|
36 | 36 |
import eu.etaxonomy.cdm.model.description.TaxonInteraction; |
37 | 37 |
import eu.etaxonomy.cdm.model.description.TaxonNameDescription; |
38 | 38 |
import eu.etaxonomy.cdm.model.location.NamedAreaType; |
39 |
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
|
|
39 |
import eu.etaxonomy.cdm.model.location.Country; |
|
40 | 40 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
41 | 41 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
42 | 42 |
import eu.etaxonomy.cdm.model.name.Rank; |
43 | 43 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
44 |
import eu.etaxonomy.cdm.model.occurrence.Specimen;
|
|
44 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
|
45 | 45 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
46 | 46 |
import eu.etaxonomy.cdm.model.reference.Reference; |
47 | 47 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
48 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
48 | 49 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
49 | 50 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; |
50 | 51 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
51 | 52 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
52 | 53 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
53 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
54 | 54 |
|
55 | 55 |
/** |
56 | 56 |
* @author a.babadshanjan |
... | ... | |
67 | 67 |
|
68 | 68 |
logger.info("Setting DB " + dbname); |
69 | 69 |
String password = AccountStore.readOrStorePassword(dbname, server, username, null); |
70 |
ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password, NomenclaturalCode.ICBN);
|
|
70 |
ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password, NomenclaturalCode.ICNAFP);
|
|
71 | 71 |
return datasource; |
72 | 72 |
} |
73 | 73 |
|
... | ... | |
118 | 118 |
Feature feature1 = Feature.BIOLOGY_ECOLOGY(); |
119 | 119 |
|
120 | 120 |
TaxonNameDescription taxNameDescription = TaxonNameDescription.NewInstance(); |
121 |
taxNameDescription.addFeature(feature1);
|
|
121 |
// taxNameDescription.addFeature(feature1); //no longer supported since v3.3
|
|
122 | 122 |
QuantitativeData element = QuantitativeData.NewInstance(); |
123 | 123 |
StatisticalMeasurementValue statisticalValue = StatisticalMeasurementValue.NewInstance(); |
124 | 124 |
statisticalValue.setType(StatisticalMeasure.MAX()); |
... | ... | |
126 | 126 |
element.addStatisticalValue(statisticalValue); |
127 | 127 |
taxNameDescription.addElement(element); |
128 | 128 |
|
129 |
SpecimenOrObservationBase<?> specimen = Specimen.NewInstance();
|
|
129 |
SpecimenOrObservationBase<?> specimen = DerivedUnit.NewPreservedSpecimenInstance();
|
|
130 | 130 |
|
131 | 131 |
specimen.setIndividualCount(12); |
132 | 132 |
|
133 | 133 |
|
134 | 134 |
Feature featureIndAss = Feature.INDIVIDUALS_ASSOCIATION(); |
135 | 135 |
TaxonNameDescription newTaxNameDesc = TaxonNameDescription.NewInstance(); |
136 |
newTaxNameDesc.addFeature(featureIndAss);
|
|
136 |
// newTaxNameDesc.addFeature(featureIndAss); //no longer supported since v3.3
|
|
137 | 137 |
IndividualsAssociation indAss = IndividualsAssociation.NewInstance(); |
138 | 138 |
indAss.setAssociatedSpecimenOrObservation(specimen); |
139 | 139 |
|
... | ... | |
269 | 269 |
|
270 | 270 |
|
271 | 271 |
//locationFeature. |
272 |
WaterbodyOrCountry area = WaterbodyOrCountry.NewInstance("", "locationTest", null);
|
|
272 |
Country area = Country.NewInstance("", "locationTest", null);
|
|
273 | 273 |
area.setType(NamedAreaType.NATURAL_AREA()); |
274 | 274 |
|
275 |
//WaterbodyOrCountry woC= WaterbodyOrCountry.NewInstance();
|
|
276 |
area.addWaterbodyOrCountry(WaterbodyOrCountry.AFGHANISTAN());
|
|
275 |
//Country woC= Country.NewInstance();
|
|
276 |
area.addCountry(Country.AFGHANISTAN());
|
|
277 | 277 |
taxDesc.addGeoScope(area); |
278 |
taxDesc.addFeature(locationFeature);
|
|
278 |
// taxDesc.addFeature(locationFeature); //no longer supported since v3.3
|
|
279 | 279 |
root1T.addDescription(taxDesc); |
280 | 280 |
|
281 | 281 |
|
... | ... | |
301 | 301 |
//TODO: Adapt to classification |
302 | 302 |
taxTree = Classification.NewInstance("TestTree"); |
303 | 303 |
|
304 |
root1TNode = taxTree.addChildTaxon(root1T, sec, null, null);
|
|
305 |
child1Node = root1TNode.addChildTaxon(child1, null, null, null);
|
|
306 |
child2Node = root1TNode.addChildTaxon(child2, null, null, null);
|
|
307 |
child21Node = child2Node.addChildTaxon(child21, null, null, null);
|
|
304 |
root1TNode = taxTree.addChildTaxon(root1T, sec, null); |
|
305 |
child1Node = root1TNode.addChildTaxon(child1, null, null); |
|
306 |
child2Node = root1TNode.addChildTaxon(child2, null, null); |
|
307 |
child21Node = child2Node.addChildTaxon(child21, null, null); |
|
308 | 308 |
|
309 | 309 |
taxTree2 = Classification.NewInstance("TestTree2"); |
310 | 310 |
|
311 |
root2TNode = taxTree2.addChildTaxon(root2T, sec, null, null);
|
|
312 |
root2TNode.addChildTaxon(child1, sec, "p.1010", syn11);
|
|
313 |
root2TNode.addChildTaxon(child2, null, null, null);
|
|
311 |
root2TNode = taxTree2.addChildTaxon(root2T, sec, null); |
|
312 |
root2TNode.addChildTaxon(child1, sec, "p.1010").setSynonymToBeUsed(syn11);
|
|
313 |
root2TNode.addChildTaxon(child2, null, null); |
|
314 | 314 |
|
315 | 315 |
/* |
316 | 316 |
root1T.addTaxonomicChild(child1, sec, "p.1010"); |
Also available in: Unified diff
reintegrate cdmlib-app-3.3 branch into trunk