Revision 09da8d56
Added by Andreas Müller almost 2 years ago
cdmlib-cache/pom.xml | ||
---|---|---|
22 | 22 |
<execution> |
23 | 23 |
<phase>compile</phase> |
24 | 24 |
<goals> |
25 |
<!-- goal 'java' has problems with closing threads, therefore se exec --> |
|
25 |
<!-- goal 'java' has problems with closing threads, therefore use exec -->
|
|
26 | 26 |
<goal>exec</goal> |
27 | 27 |
</goals> |
28 | 28 |
</execution> |
... | ... | |
34 | 34 |
<classpath/> |
35 | 35 |
<argument>eu.etaxonomy.cdm.cache.CdmModelCacher</argument> |
36 | 36 |
</arguments> |
37 |
<!-- configuration if using goal 'java' --> |
|
38 |
<!-- <mainClass>eu.etaxonomy.cdm.cache.CdmModelCacher</mainClass> |
|
39 |
<cleanupDaemonThreads>true</cleanupDaemonThreads> |
|
40 |
<stopUnresponsiveDaemonThreads>false</stopUnresponsiveDaemonThreads> --> |
|
41 | 37 |
</configuration> |
42 | 38 |
</plugin> |
43 | 39 |
</plugins> |
cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CdmModelCacher.java | ||
---|---|---|
139 | 139 |
|
140 | 140 |
// To create the serialised cdm map run |
141 | 141 |
// mvn exec:exec -Dexec.mainClass="eu.etaxonomy.cdm.cache.CdmModelCacher" |
142 |
// in the cdmlib-cache project root directory |
|
142 |
// in the cdmlib-cache project root directory.
|
|
143 | 143 |
// See also https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions |
144 |
//Note AM: does not fully work for me, but running the main from the IDE works. |
|
145 | 144 |
|
146 | 145 |
System.out.println("Start CdmModelCacher main."); |
147 | 146 |
CdmModelCacher cdmModelCacher = new CdmModelCacher(); |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdmLight/CdmLightClassificationExport.java | ||
---|---|---|
256 | 256 |
state.getNodeChildrenMap().put(root.getUuid(), childNodes); |
257 | 257 |
|
258 | 258 |
// add root to node map |
259 |
|
|
260 | 259 |
} |
261 | 260 |
TaxonNodeDto rootDto = new TaxonNodeDto(root); |
262 | 261 |
UUID parentUuid = root.getParent() != null ? root.getParent().getUuid() |
... | ... | |
268 | 267 |
List<TaxonNodeDto> rootList = new ArrayList<>(); |
269 | 268 |
rootList.add(rootDto); |
270 | 269 |
state.getNodeChildrenMap().put(parentUuid, rootList); |
271 |
|
|
272 | 270 |
} |
273 | 271 |
if (root.hasTaxon()) { |
274 | 272 |
handleTaxon(state, root); |
275 |
|
|
276 | 273 |
} |
277 | 274 |
} catch (Exception e) { |
278 | 275 |
state.getResult().addException(e, "An unexpected error occurred when handling taxonNode " |
... | ... | |
297 | 294 |
Taxon taxon = CdmBase.deproxy(taxonNode.getTaxon()); |
298 | 295 |
|
299 | 296 |
try { |
297 |
//accepted name |
|
300 | 298 |
TaxonName name = taxon.getName(); |
301 | 299 |
handleName(state, name, taxon, true); |
300 |
|
|
301 |
//homotypic group / synonyms |
|
302 | 302 |
HomotypicalGroup homotypicGroup = taxon.getHomotypicGroup(); |
303 | 303 |
int index = 0; |
304 | 304 |
int homotypicGroupIndex = 0; |
... | ... | |
318 | 318 |
homotypicGroupIndex++; |
319 | 319 |
} |
320 | 320 |
|
321 |
//pro parte synonyms |
|
321 | 322 |
index = 0; |
322 | 323 |
for (Taxon tax : taxon.getAllProParteSynonyms()) { |
323 | 324 |
handleProPartePartialMisapplied(state, tax, taxon, true, false, index); |
324 | 325 |
index++; |
325 | 326 |
} |
326 | 327 |
|
327 |
|
|
328 |
//misapplications |
|
328 | 329 |
for (Taxon tax : taxon.getAllMisappliedNames()) { |
329 | 330 |
handleProPartePartialMisapplied(state, tax, taxon, false, true, index); |
330 | 331 |
index++; |
331 | 332 |
} |
332 | 333 |
|
334 |
//taxon table |
|
333 | 335 |
CdmLightExportTable table = CdmLightExportTable.TAXON; |
334 | 336 |
String[] csvLine = new String[table.getSize()]; |
335 | 337 |
|
... | ... | |
357 | 359 |
taxonNode.getClassification()); |
358 | 360 |
csvLine[table.getIndex(CdmLightExportTable.CLASSIFICATION_TITLE)] = taxonNode.getClassification() |
359 | 361 |
.getTitleCache(); |
360 |
|
|
361 | 362 |
csvLine[table.getIndex(CdmLightExportTable.PUBLISHED)] = taxon.isPublish() ? "1" : "0"; |
363 |
|
|
364 |
//taxon node |
|
362 | 365 |
csvLine[table.getIndex(CdmLightExportTable.EXCLUDED)] = taxonNode.isExcluded() ? "1" : "0"; |
366 |
csvLine[table.getIndex(CdmLightExportTable.UNPLACED)] = taxonNode.isUnplaced() ? "1" : "0"; |
|
367 |
csvLine[table.getIndex(CdmLightExportTable.DOUBTFUL)] = taxonNode.isDoubtful() ? "1" : "0"; |
|
363 | 368 |
Map<Language, LanguageString> notesMap = taxonNode.getStatusNote(); |
364 | 369 |
String statusNotes = ""; |
365 | 370 |
if (!notesMap.isEmpty() && notesMap.size() == 1) { |
... | ... | |
373 | 378 |
} |
374 | 379 |
csvLine[table.getIndex(CdmLightExportTable.STATUS_NOTES)] = statusNotes; |
375 | 380 |
|
376 |
csvLine[table.getIndex(CdmLightExportTable.UNPLACED)] = taxonNode.isUnplaced() ? "1" : "0"; |
|
377 |
csvLine[table.getIndex(CdmLightExportTable.DOUBTFUL)] = taxonNode.isDoubtful() ? "1" : "0"; |
|
381 |
//process taxon line |
|
378 | 382 |
state.getProcessor().put(table, taxon, csvLine); |
383 |
|
|
384 |
//descriptions |
|
379 | 385 |
handleDescriptions(state, taxon); |
380 | 386 |
} catch (Exception e) { |
381 | 387 |
state.getResult().addException(e, |
... | ... | |
383 | 389 |
state.getResult().setState(ExportResultState.INCOMPLETE_WITH_ERROR); |
384 | 390 |
} |
385 | 391 |
} |
386 |
|
|
387 | 392 |
} catch (Exception e) { |
388 | 393 |
state.getResult().addException(e, "An unexpected error occurred when handling the taxon node of " |
389 | 394 |
+ cdmBaseStr(taxonNode.getTaxon()) + ", titleCache:"+ taxonNode.getTaxon().getTitleCache()+": " + e.getMessage()); |
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/cdmLight/out/CdmLightExportTest.java | ||
---|---|---|
19 | 19 |
import java.util.Set; |
20 | 20 |
import java.util.UUID; |
21 | 21 |
|
22 |
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger; |
|
22 |
import org.apache.logging.log4j.LogManager; |
|
23 |
import org.apache.logging.log4j.Logger; |
|
23 | 24 |
import org.junit.Assert; |
24 | 25 |
import org.junit.Before; |
25 | 26 |
import org.junit.Test; |
... | ... | |
83 | 84 |
|
84 | 85 |
@Before |
85 | 86 |
public void setUp() { |
86 |
// DefinedTerm ipniIdentifierTerm = DefinedTerm.NewIdentifierTypeInstance("IPNI Identifier", "IPNI Identifier", "IPNI Identifier"); |
|
87 |
// ipniIdentifierTerm.setUuid(DefinedTerm.uuidIpniNameIdentifier); |
|
88 |
// |
|
89 |
// DefinedTerm tropicosIdentifierTerm = DefinedTerm.NewIdentifierTypeInstance("Tropicos Identifier", "Tropicos Identifier", "Tropicos Identifier"); |
|
90 |
// tropicosIdentifierTerm.setUuid(DefinedTerm.uuidTropicosNameIdentifier); |
|
91 |
// |
|
92 |
// DefinedTerm wfoIdentifierTerm = DefinedTerm.NewIdentifierTypeInstance("WFO Identifier", "WFO Identifier", "WFO Identifier"); |
|
93 |
// wfoIdentifierTerm.setUuid(DefinedTerm.uuidWfoNameIdentifier); |
|
94 |
// List<DefinedTermBase> terms = new ArrayList(); |
|
95 |
// terms.add(wfoIdentifierTerm); |
|
96 |
// terms.add(tropicosIdentifierTerm); |
|
97 |
// terms.add(ipniIdentifierTerm); |
|
98 |
// termService.saveOrUpdate(terms); |
|
99 | 87 |
createFullTestDataSet(); |
100 | 88 |
} |
101 | 89 |
|
... | ... | |
107 | 95 |
public void testSubTree(){ |
108 | 96 |
|
109 | 97 |
CdmLightExportConfigurator config = CdmLightExportConfigurator.NewInstance(); |
110 |
// config.setCreateCondensedDistributionString(false); |
|
111 | 98 |
config.setTaxonNodeFilter(TaxonNodeFilter.NewSubtreeInstance(UUID.fromString("f8c9933a-fe3a-42ce-8a92-000e27bfdfac"))); |
112 | 99 |
|
113 | 100 |
config.setTarget(TARGET.EXPORT_DATA); |
... | ... | |
118 | 105 |
@SuppressWarnings("unchecked") |
119 | 106 |
Map<String, byte[]> data = (Map<String, byte[]>) exportData.getExportData(); |
120 | 107 |
|
121 |
byte[] taxon = data.get(CdmLightExportTable.TAXON.getTableName()); |
|
122 |
Assert.assertNotNull("Taxon table must not be null", taxon); |
|
123 |
String taxonStr = new String(taxon); |
|
108 |
byte[] taxonByte = data.get(CdmLightExportTable.TAXON.getTableName());
|
|
109 |
Assert.assertNotNull("Taxon table must not be null", taxonByte);
|
|
110 |
String taxonStr = new String(taxonByte);
|
|
124 | 111 |
String notExpected = "\"9182e136-f2e2-4f9a-9010-3f35908fb5e0\""; |
125 | 112 |
Assert.assertFalse("Result must not contain root taxon", taxonStr.startsWith(notExpected)); |
126 | 113 |
String expected = "\"b2c86698-500e-4efb-b9ae-6bb6e701d4bc\",\"4096df99-7274-421e-8843-211b603d832e\",\"CdmLightExportTest Classification\",\"3483cc5e-4c77-4c80-8cb0-73d43df31ee3\",\"9182e136-f2e2-4f9a-9010-3f35908fb5e0\",\"4b6acca1-959b-4790-b76e-e474a0882990\",\"My sec ref\""; |
... | ... | |
187 | 174 |
|
188 | 175 |
ByteArrayInputStream stream = new ByteArrayInputStream( data.get(CdmLightExportTable.TAXON.getTableName())); |
189 | 176 |
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8"))); |
190 |
String line; |
|
177 |
|
|
191 | 178 |
int count = 0; |
192 | 179 |
try { |
193 |
while ((line = reader.readLine()) != null) {
|
|
180 |
while (reader.readLine() != null) {
|
|
194 | 181 |
count ++; |
195 | 182 |
} |
196 |
Assert.assertTrue("There should be 5 taxa", count == 6);// 6 because of the header line
|
|
183 |
Assert.assertTrue("There should be 5 taxa", count == 5+1);// 1 header line
|
|
197 | 184 |
|
198 | 185 |
stream = new ByteArrayInputStream(data.get(CdmLightExportTable.REFERENCE.getTableName())); |
199 | 186 |
reader = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8"))); |
200 | 187 |
count = 0; |
201 |
while ((line = reader.readLine()) != null) {
|
|
188 |
while (reader.readLine() != null) {
|
|
202 | 189 |
count ++; |
203 | 190 |
} |
204 |
Assert.assertTrue("There should be 7 references (6 nomenclatural references and 1 sec reference)", count == 8);
|
|
191 |
Assert.assertTrue("There should be 7 references (6 nomenclatural references and 1 sec reference)", count == 7+1); //1 header line
|
|
205 | 192 |
stream = new ByteArrayInputStream(data.get(CdmLightExportTable.SYNONYM.getTableName())); |
206 | 193 |
reader = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8"))); |
207 | 194 |
count = 0; |
208 |
while ((line = reader.readLine()) != null) {
|
|
195 |
while (reader.readLine() != null) {
|
|
209 | 196 |
count ++; |
210 | 197 |
} |
211 |
Assert.assertTrue("There should be 1 synonym", count == 2);
|
|
198 |
Assert.assertTrue("There should be 1 synonym", count == 1+1); // 1 header line
|
|
212 | 199 |
} catch (IOException e) { |
213 | 200 |
e.printStackTrace(); |
214 | 201 |
Assert.fail("IO Exception thrown during test."); |
215 | 202 |
} |
216 |
byte[] taxon = data.get(CdmLightExportTable.TAXON.getTableName()); |
|
217 |
Assert.assertNotNull("Taxon table must not be null", taxon); |
|
218 |
String taxonStr = new String(taxon); |
|
203 |
byte[] taxonByte = data.get(CdmLightExportTable.TAXON.getTableName());
|
|
204 |
Assert.assertNotNull("Taxon table must not be null", taxonByte);
|
|
205 |
String taxonStr = new String(taxonByte);
|
|
219 | 206 |
String notExpected = "\"9182e136-f2e2-4f9a-9010-3f35908fb5e0\""; |
220 | 207 |
Assert.assertFalse("Result must not contain root taxon", taxonStr.startsWith(notExpected)); |
221 | 208 |
String expected = "\"b2c86698-500e-4efb-b9ae-6bb6e701d4bc\",\"4096df99-7274-421e-8843-211b603d832e\",\"CdmLightExportTest Classification\",\"3483cc5e-4c77-4c80-8cb0-73d43df31ee3\",\"9182e136-f2e2-4f9a-9010-3f35908fb5e0\",\"4b6acca1-959b-4790-b76e-e474a0882990\",\"My sec ref\""; |
... | ... | |
340 | 327 |
} |
341 | 328 |
|
342 | 329 |
public void createFullTestDataSet() { |
330 |
|
|
343 | 331 |
Set<TaxonNode> nodesToSave = new HashSet<>(); |
344 | 332 |
|
345 | 333 |
Reference sec1 = ReferenceFactory.newGeneric(); |
... | ... | |
428 | 416 |
} |
429 | 417 |
|
430 | 418 |
@Override |
431 |
public void createTestDataSet() throws FileNotFoundException { |
|
432 |
// try { |
|
433 |
// writeDbUnitDataSetFile(new String[] { |
|
434 |
// "Classification", |
|
435 |
// }, "testAttachDnaSampleToDerivedUnit"); |
|
436 |
// } catch (FileNotFoundException e) { |
|
437 |
// e.printStackTrace(); |
|
438 |
// } |
|
439 |
} |
|
419 |
public void createTestDataSet() throws FileNotFoundException {} |
|
440 | 420 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/RelationshipTermBase.java | ||
---|---|---|
104 | 104 |
//******************** CONSTRUCTOR ************************/ |
105 | 105 |
|
106 | 106 |
//for hibernate use only, *packet* private required by bytebuddy |
107 |
@SuppressWarnings("unused") |
|
108 | 107 |
@Deprecated |
109 | 108 |
RelationshipTermBase(){} |
110 | 109 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/CdmMetaData.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.model.metadata; |
11 | 10 |
|
12 | 11 |
import java.util.ArrayList; |
... | ... | |
19 | 18 |
import javax.validation.constraints.NotNull; |
20 | 19 |
import javax.xml.bind.annotation.XmlAttribute; |
21 | 20 |
|
22 |
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger; |
|
21 |
import org.apache.logging.log4j.LogManager; |
|
22 |
import org.apache.logging.log4j.Logger; |
|
23 | 23 |
import org.hibernate.annotations.Type; |
24 | 24 |
import org.joda.time.DateTime; |
25 | 25 |
|
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/TaxonNode.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.model.taxon; |
11 | 10 |
|
12 | 11 |
import java.util.ArrayList; |
... | ... | |
90 | 89 |
}) |
91 | 90 |
@XmlRootElement(name = "TaxonNode") |
92 | 91 |
@Entity |
93 |
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search |
|
94 |
//@Indexed(index = "eu.etaxonomy.cdm.model.taxon.TaxonNode") |
|
95 | 92 |
@Audited |
96 | 93 |
@Table(name="TaxonNode", indexes = { @javax.persistence.Index(name = "taxonNodeTreeIndex", columnList = "treeIndex") }) |
97 | 94 |
@ChildTaxaMustBeLowerRankThanParent(groups = Level3.class) |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v529_53x/VocabularyTreeCreator.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.database.update.v529_53x; |
|
10 |
|
|
11 |
import java.sql.SQLException; |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor; |
|
16 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
|
17 |
import eu.etaxonomy.cdm.database.update.CaseType; |
|
18 |
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep; |
|
19 |
import eu.etaxonomy.cdm.database.update.SchemaUpdateResult; |
|
20 |
import eu.etaxonomy.cdm.database.update.SchemaUpdaterStepBase; |
|
21 |
|
|
22 |
/** |
|
23 |
* #6794 |
|
24 |
* @author a.mueller |
|
25 |
* @since 22.04.2021 |
|
26 |
*/ |
|
27 |
public class VocabularyTreeCreator extends SchemaUpdaterStepBase { |
|
28 |
|
|
29 |
protected VocabularyTreeCreator(List<ISchemaUpdaterStep> stepList, String stepName) { |
|
30 |
super(stepList, stepName); |
|
31 |
} |
|
32 |
@Override |
|
33 |
public List<ISchemaUpdaterStep> getInnerSteps() { |
|
34 |
List<ISchemaUpdaterStep> result = new ArrayList<>(); |
|
35 |
|
|
36 |
return result; |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public void invoke(ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType, |
|
41 |
SchemaUpdateResult result) throws SQLException { |
|
42 |
|
|
43 |
//before this the tree (or graph) attribute needs to be added to TermVocabulary |
|
44 |
|
|
45 |
//Create tree |
|
46 |
//Set ordered flag |
|
47 |
//set flat flag depending on existing terms |
|
48 |
//getTermsOrdered |
|
49 |
//for each Term |
|
50 |
//addToTree |
|
51 |
//TODO decide on kindOf vs. partOf |
|
52 |
//do the same for hierarchical terms |
|
53 |
//add tree to vocabulary |
|
54 |
|
|
55 |
//TODO how to handle AUD data |
|
56 |
|
|
57 |
// boolean includeAudit = true; |
|
58 |
// int osbId = getMaxId1(datasource, "OriginalSourceBase", includeAudit, monitor, caseType, result); |
|
59 |
// |
|
60 |
// String sql = "SELECT * " |
|
61 |
// + " FROM "+caseType.transformTo(tableName)+" t " |
|
62 |
// + " WHERE t."+this.citationsIdAttr+" IS NOT NULL OR t."+this.detailAttr+" IS NOT NULL "; |
|
63 |
// |
|
64 |
// ResultSet rs = datasource.executeQuery(sql); |
|
65 |
// while(rs.next()){ |
|
66 |
// int tnId = rs.getInt("id"); |
|
67 |
// Integer citationId = nullSafeInt(rs, citationsIdAttr); |
|
68 |
// Integer createdById = nullSafeInt(rs, "createdBy_id"); |
|
69 |
// String detail = rs.getString(detailAttr); |
|
70 |
// |
|
71 |
// sql = "INSERT INTO @@OriginalSourceBase@@ (DTYPE, sourceType, uuid, id, citation_id, citationMicroReference, createdBy_id, created, "+sourcedAttr+")" |
|
72 |
// + " VALUES ('"+dtype+"', '"+sourceType+"','"+UUID.randomUUID()+"'," + osbId + ", " + citationId + "," + nullSafeParam(detail) + "," + createdById + ",'" + this.getNowString() + "',"+tnId+")"; |
|
73 |
// datasource.executeUpdate(caseType.replaceTableNames(sql)); |
|
74 |
// |
|
75 |
// osbId++; |
|
76 |
// } |
|
77 |
} |
|
78 |
} |
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v532_53x/VocabularyTreeCreator.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.database.update.v529_53x; |
|
10 |
|
|
11 |
import java.sql.SQLException; |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor; |
|
16 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
|
17 |
import eu.etaxonomy.cdm.database.update.CaseType; |
|
18 |
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep; |
|
19 |
import eu.etaxonomy.cdm.database.update.SchemaUpdateResult; |
|
20 |
import eu.etaxonomy.cdm.database.update.SchemaUpdaterStepBase; |
|
21 |
|
|
22 |
/** |
|
23 |
* #6794 |
|
24 |
* @author a.mueller |
|
25 |
* @since 22.04.2021 |
|
26 |
*/ |
|
27 |
public class VocabularyTreeCreator extends SchemaUpdaterStepBase { |
|
28 |
|
|
29 |
protected VocabularyTreeCreator(List<ISchemaUpdaterStep> stepList, String stepName) { |
|
30 |
super(stepList, stepName); |
|
31 |
} |
|
32 |
@Override |
|
33 |
public List<ISchemaUpdaterStep> getInnerSteps() { |
|
34 |
List<ISchemaUpdaterStep> result = new ArrayList<>(); |
|
35 |
|
|
36 |
return result; |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public void invoke(ICdmDataSource datasource, IProgressMonitor monitor, CaseType caseType, |
|
41 |
SchemaUpdateResult result) throws SQLException { |
|
42 |
|
|
43 |
//before this the tree (or graph) attribute needs to be added to TermVocabulary |
|
44 |
|
|
45 |
//Create tree |
|
46 |
//Set ordered flag |
|
47 |
//set flat flag depending on existing terms |
|
48 |
//getTermsOrdered |
|
49 |
//for each Term |
|
50 |
//addToTree |
|
51 |
//TODO decide on kindOf vs. partOf |
|
52 |
//do the same for hierarchical terms |
|
53 |
//add tree to vocabulary |
|
54 |
|
|
55 |
//TODO how to handle AUD data |
|
56 |
|
|
57 |
// boolean includeAudit = true; |
|
58 |
// int osbId = getMaxId1(datasource, "OriginalSourceBase", includeAudit, monitor, caseType, result); |
|
59 |
// |
|
60 |
// String sql = "SELECT * " |
|
61 |
// + " FROM "+caseType.transformTo(tableName)+" t " |
|
62 |
// + " WHERE t."+this.citationsIdAttr+" IS NOT NULL OR t."+this.detailAttr+" IS NOT NULL "; |
|
63 |
// |
|
64 |
// ResultSet rs = datasource.executeQuery(sql); |
|
65 |
// while(rs.next()){ |
|
66 |
// int tnId = rs.getInt("id"); |
|
67 |
// Integer citationId = nullSafeInt(rs, citationsIdAttr); |
|
68 |
// Integer createdById = nullSafeInt(rs, "createdBy_id"); |
|
69 |
// String detail = rs.getString(detailAttr); |
|
70 |
// |
|
71 |
// sql = "INSERT INTO @@OriginalSourceBase@@ (DTYPE, sourceType, uuid, id, citation_id, citationMicroReference, createdBy_id, created, "+sourcedAttr+")" |
|
72 |
// + " VALUES ('"+dtype+"', '"+sourceType+"','"+UUID.randomUUID()+"'," + osbId + ", " + citationId + "," + nullSafeParam(detail) + "," + createdById + ",'" + this.getNowString() + "',"+tnId+")"; |
|
73 |
// datasource.executeUpdate(caseType.replaceTableNames(sql)); |
|
74 |
// |
|
75 |
// osbId++; |
|
76 |
// } |
|
77 |
} |
|
78 |
} |
Also available in: Unified diff
cleanup