Revision a4947270
Added by Andreas Müller over 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/common/CdmDestinations.java | ||
---|---|---|
398 | 398 |
} |
399 | 399 |
|
400 | 400 |
public static ICdmDataSource localH2(String database, String username, String filePath){ |
401 |
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath, null);
|
|
401 |
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath); |
|
402 | 402 |
} |
403 | 403 |
|
404 | 404 |
public static ICdmDataSource localH2Salvador(){ |
... | ... | |
634 | 634 |
pwd = AccountStore.readOrStorePassword(cdmServer, cdmDB, cdmUserName, pwd); |
635 | 635 |
ICdmDataSource destination; |
636 | 636 |
if(dbType.equals(DatabaseTypeEnum.MySQL)){ |
637 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
637 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd); |
|
638 | 638 |
} else if(dbType.equals(DatabaseTypeEnum.PostgreSQL)){ |
639 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
639 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd); |
|
640 | 640 |
} else { |
641 | 641 |
//TODO others |
642 | 642 |
throw new RuntimeException("Unsupported DatabaseType"); |
app-import/src/main/java/eu/etaxonomy/cdm/app/sdd/SDDExportActivator.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2009 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
13 | 13 |
import java.net.MalformedURLException; |
14 | 14 |
import java.sql.SQLException; |
15 | 15 |
|
16 |
import junit.framework.Assert; |
|
17 |
|
|
18 | 16 |
import org.apache.log4j.Logger; |
19 | 17 |
|
20 | 18 |
import eu.etaxonomy.cdm.common.CdmUtils; |
... | ... | |
26 | 24 |
import eu.etaxonomy.cdm.io.common.CdmDefaultExport; |
27 | 25 |
import eu.etaxonomy.cdm.io.common.IExportConfigurator.DO_REFERENCES; |
28 | 26 |
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator; |
29 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
|
27 |
import junit.framework.Assert;
|
|
30 | 28 |
|
31 | 29 |
/** |
32 | 30 |
* @author l.morris |
... | ... | |
42 | 40 |
//private static final String destinationFolder = "C:/tmp/viola/exports_SDD"; |
43 | 41 |
|
44 | 42 |
/** NUMBER_ROWS_TO_RETRIEVE = 0 is the default case to retrieve all rows. |
45 |
* For testing purposes: If NUMBER_ROWS_TO_RETRIEVE >0 then retrieve
|
|
46 |
* as many rows as specified for agents, references, etc.
|
|
43 |
* For testing purposes: If NUMBER_ROWS_TO_RETRIEVE >0 then retrieve |
|
44 |
* as many rows as specified for agents, references, etc. |
|
47 | 45 |
* Only root taxa and no synonyms and relationships are retrieved. */ |
48 | 46 |
private static final int NUMBER_ROWS_TO_RETRIEVE = 0; |
49 | 47 |
|
... | ... | |
56 | 54 |
ICdmDataSource datasource = CdmDataSource.NewH2EmbeddedInstance(dbname, username, ""); |
57 | 55 |
return datasource; |
58 | 56 |
} |
59 |
|
|
57 |
|
|
60 | 58 |
private static ICdmDataSource customDataSource() { |
61 | 59 |
|
62 | 60 |
CdmPersistentDataSource loadedDataSource = null; |
... | ... | |
65 | 63 |
String dataSourceName = CdmUtils.readInputLine("Database name: "); |
66 | 64 |
String username = CdmUtils.readInputLine("Username: "); |
67 | 65 |
String password = CdmUtils.readInputLine("Password: "); |
68 |
|
|
66 |
|
|
69 | 67 |
dataSourceName = (dataSourceName.equals("")) ? "cdm_test3" : dataSourceName; |
70 | 68 |
username = (username.equals("")) ? "ljm" : username; |
71 |
|
|
69 |
|
|
72 | 70 |
//ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("127.0.0.1", "cdm_test3", 3306, "ljm", password, NomenclaturalCode.ICBN); |
73 |
ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("127.0.0.1", dataSourceName, 3306, username, password, NomenclaturalCode.ICNAFP);
|
|
71 |
ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("127.0.0.1", dataSourceName, 3306, username, password); |
|
74 | 72 |
//ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("127.0.0.1", "cdm_edit_cichorieae", 3306, "ljm", password, NomenclaturalCode.ICBN); |
75 |
//ICdmDataSource dataSource =
|
|
76 |
CdmDataSource.NewMySqlInstance("160.45.63.201", "cdm_edit_cichorieae", 3306, "edit", password, NomenclaturalCode.ICNAFP);
|
|
73 |
//ICdmDataSource dataSource = |
|
74 |
CdmDataSource.NewMySqlInstance("160.45.63.201", "cdm_edit_cichorieae", 3306, "edit", password); |
|
77 | 75 |
boolean connectionAvailable; |
78 | 76 |
try { |
79 | 77 |
connectionAvailable = dataSource.testConnection(); |
... | ... | |
92 | 90 |
try { |
93 | 91 |
loadedDataSource = CdmPersistentDataSource.NewInstance(dataSourceName); |
94 | 92 |
// CdmApplicationController.NewInstance(loadedDataSource, DbSchemaValidation.CREATE); |
95 |
NomenclaturalCode loadedCode = loadedDataSource.getNomenclaturalCode(); |
|
96 |
|
|
97 |
Assert.assertEquals(NomenclaturalCode.ICNAFP, loadedCode); |
|
93 |
// NomenclaturalCode loadedCode = loadedDataSource.getNomenclaturalCode();
|
|
94 |
// |
|
95 |
// Assert.assertEquals(NomenclaturalCode.ICNAFP, loadedCode);
|
|
98 | 96 |
} catch (DataSourceNotFoundException e) { |
99 |
// TODO Auto-generated catch block |
|
100 | 97 |
e.printStackTrace(); |
101 | 98 |
} |
102 | 99 |
//return loadedDataSource; |
103 | 100 |
return dataSource; |
104 | 101 |
} |
105 |
|
|
106 |
|
|
102 |
|
|
103 |
|
|
107 | 104 |
|
108 | 105 |
private static final Logger logger = Logger.getLogger(ViolaExportActivator.class); |
109 | 106 |
|
... | ... | |
141 | 138 |
// TODO Auto-generated catch block |
142 | 139 |
e.printStackTrace(); |
143 | 140 |
} |
144 |
|
|
145 |
//lorna//SDDExportConfigurator sddExportConfigurator =
|
|
141 |
|
|
142 |
//lorna//SDDExportConfigurator sddExportConfigurator = |
|
146 | 143 |
//SDDExportConfigurator.NewInstance(sourceDb, destinationFileName, destinationFolder); |
147 |
|
|
148 |
SDDExportConfigurator sddExportConfigurator =
|
|
144 |
|
|
145 |
SDDExportConfigurator sddExportConfigurator = |
|
149 | 146 |
SDDExportConfigurator.NewInstance(sourceDb, exporturlStr); |
150 |
|
|
151 |
|
|
152 |
CdmDefaultExport<SDDExportConfigurator> sddExport =
|
|
147 |
|
|
148 |
|
|
149 |
CdmDefaultExport<SDDExportConfigurator> sddExport = |
|
153 | 150 |
new CdmDefaultExport<SDDExportConfigurator>(); |
154 |
|
|
151 |
|
|
155 | 152 |
sddExportConfigurator.setSource(sourceDb); |
156 | 153 |
//lorna//sddExportConfigurator.setDestination(destinationFile); |
157 | 154 |
sddExportConfigurator.setDbSchemaValidation(DbSchemaValidation.VALIDATE); |
... | ... | |
187 | 184 |
public static void main(String[] args) { |
188 | 185 |
|
189 | 186 |
SDDExportActivator sddex = new SDDExportActivator(); |
190 |
|
|
187 |
|
|
191 | 188 |
sddex.invokeExport(); |
192 | 189 |
|
193 | 190 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/app/sdd/SDDImportActivator.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
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 |
*/ |
... | ... | |
14 | 14 |
import java.net.URL; |
15 | 15 |
import java.sql.SQLException; |
16 | 16 |
|
17 |
import junit.framework.Assert; |
|
18 |
|
|
19 | 17 |
import org.apache.log4j.Logger; |
20 | 18 |
|
21 | 19 |
import eu.etaxonomy.cdm.common.CdmUtils; |
... | ... | |
27 | 25 |
import eu.etaxonomy.cdm.io.common.CdmDefaultImport; |
28 | 26 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK; |
29 | 27 |
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator; |
30 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
|
28 |
import junit.framework.Assert;
|
|
31 | 29 |
|
32 | 30 |
/** |
33 | 31 |
* @author h.fradin |
... | ... | |
59 | 57 |
String dataSourceName = CdmUtils.readInputLine("Database name: "); |
60 | 58 |
String username = CdmUtils.readInputLine("Username: "); |
61 | 59 |
String password = CdmUtils.readInputLine("Password: "); |
62 |
|
|
60 |
|
|
63 | 61 |
dataSourceName = (dataSourceName.equals("")) ? "cdm_test4" : dataSourceName; |
64 | 62 |
username = (username.equals("")) ? "ljm" : username; |
65 |
|
|
66 |
ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("127.0.0.1", dataSourceName, 3306, username, password, NomenclaturalCode.ICNAFP);
|
|
63 |
|
|
64 |
ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("127.0.0.1", dataSourceName, 3306, username, password); |
|
67 | 65 |
//ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("127.0.0.1", "cdm_edit_cichorieae", 3306, "ljm", password, NomenclaturalCode.ICBN); |
68 | 66 |
//ICdmDataSource dataSource = CdmDataSource.NewMySqlInstance("160.45.63.201", "cdm_edit_cichorieae", 3306, "edit", password, NomenclaturalCode.ICBN); |
69 | 67 |
boolean connectionAvailable; |
... | ... | |
73 | 71 |
Assert.assertTrue("Testdatabase is not available", connectionAvailable); |
74 | 72 |
|
75 | 73 |
} catch (ClassNotFoundException e1) { |
76 |
// TODO Auto-generated catch block |
|
77 | 74 |
e1.printStackTrace(); |
78 | 75 |
} catch (SQLException e1) { |
79 |
// TODO Auto-generated catch block |
|
80 | 76 |
e1.printStackTrace(); |
81 | 77 |
} |
82 | 78 |
|
... | ... | |
84 | 80 |
try { |
85 | 81 |
loadedDataSource = CdmPersistentDataSource.NewInstance(dataSourceName); |
86 | 82 |
// CdmApplicationController.NewInstance(loadedDataSource, DbSchemaValidation.CREATE); |
87 |
NomenclaturalCode loadedCode = loadedDataSource.getNomenclaturalCode(); |
|
88 |
|
|
89 |
Assert.assertEquals(NomenclaturalCode.ICNAFP, loadedCode); |
|
90 | 83 |
} catch (DataSourceNotFoundException e) { |
91 |
// TODO Auto-generated catch block |
|
92 | 84 |
e.printStackTrace(); |
93 | 85 |
} |
94 | 86 |
//return loadedDataSource; |
... | ... | |
114 | 106 |
source = url.toURI(); |
115 | 107 |
//source = new URI("/eu/etaxonomy/cdm/app/sdd/SDDImportTest-input3.xml"); |
116 | 108 |
System.out.println("Start import from SDD("+ source.toString() + ") ..."); |
117 |
|
|
109 |
|
|
118 | 110 |
// ICdmDataSource destination = CdmDestinations.localH2("cdm","sa","C:/Documents and Settings/lis/Mes documents/CDMtest/"); |
119 | 111 |
//lorna//ICdmDataSource destination = CdmDestinations.localH2(args[3],"sa",args[2]); |
120 | 112 |
ICdmDataSource destination = customDataSource(); |
121 |
|
|
113 |
|
|
122 | 114 |
SDDImportConfigurator sddImportConfigurator = SDDImportConfigurator.NewInstance(source, destination); |
123 |
|
|
115 |
|
|
124 | 116 |
///sddImportConfigurator.setSourceSecId(sourceSecId); |
125 |
|
|
117 |
|
|
126 | 118 |
///sddImportConfigurator.setCheck(check); |
127 | 119 |
///sddImportConfigurator.setDbSchemaValidation(hbm2dll); |
128 |
|
|
120 |
|
|
129 | 121 |
// invoke import |
130 | 122 |
CdmDefaultImport<SDDImportConfigurator> sddImport = new CdmDefaultImport<SDDImportConfigurator>(); |
131 | 123 |
sddImport.invoke(sddImportConfigurator); |
132 |
|
|
124 |
|
|
133 | 125 |
System.out.println("End import from SDD ("+ source.toString() + ")..."); |
134 | 126 |
} catch (URISyntaxException e) { |
135 | 127 |
e.printStackTrace(); |
app-import/src/main/java/eu/etaxonomy/cdm/app/util/TestDatabase.java | ||
---|---|---|
39 | 39 |
import eu.etaxonomy.cdm.model.location.Country; |
40 | 40 |
import eu.etaxonomy.cdm.model.location.NamedAreaType; |
41 | 41 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
42 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
43 | 42 |
import eu.etaxonomy.cdm.model.name.Rank; |
44 | 43 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
45 | 44 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
68 | 67 |
|
69 | 68 |
logger.info("Setting DB " + dbname); |
70 | 69 |
String password = AccountStore.readOrStorePassword(dbname, server, username, null); |
71 |
ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password, NomenclaturalCode.ICNAFP);
|
|
70 |
ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password); |
|
72 | 71 |
return datasource; |
73 | 72 |
} |
74 | 73 |
|
app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/palmae/UseImport.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
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 |
*/ |
... | ... | |
91 | 91 |
ICdmDataSource destination; |
92 | 92 |
if (dbType.equals(DatabaseTypeEnum.MySQL)) { |
93 | 93 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, |
94 |
port, cdmUserName, pwd, null);
|
|
94 |
port, cdmUserName, pwd); |
|
95 | 95 |
} else if (dbType.equals(DatabaseTypeEnum.PostgreSQL)) { |
96 | 96 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, |
97 |
port, cdmUserName, pwd, null);
|
|
97 |
port, cdmUserName, pwd); |
|
98 | 98 |
} else { |
99 | 99 |
// TODO others |
100 | 100 |
throw new RuntimeException("Unsupported DatabaseType"); |
... | ... | |
104 | 104 |
|
105 | 105 |
public boolean importFromExcelSS(String xlsPath) throws InvalidFormatException { |
106 | 106 |
boolean success = true; |
107 |
|
|
107 |
|
|
108 | 108 |
CdmApplicationController applicationController = CdmApplicationController.NewInstance(dataSource()); |
109 | 109 |
ConversationHolder conversation = applicationController.NewConversation(); |
110 | 110 |
conversation.startTransaction(); |
111 |
|
|
111 |
|
|
112 | 112 |
ITaxonService service = applicationController.getTaxonService(); |
113 | 113 |
ITermService termService = applicationController.getTermService(); |
114 | 114 |
IDescriptionService descService = applicationController.getDescriptionService(); |
115 | 115 |
IReferenceService referenceService = applicationController.getReferenceService(); |
116 | 116 |
InputStream inputStream = null; |
117 |
|
|
117 |
|
|
118 | 118 |
try { |
119 | 119 |
inputStream = new FileInputStream(xlsPath); |
120 | 120 |
|
... | ... | |
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
// POIFSFileSystem fileSystem = null; |
128 |
|
|
128 |
|
|
129 | 129 |
try { |
130 | 130 |
// fileSystem = new POIFSFileSystem(inputStream); |
131 | 131 |
// |
132 | 132 |
// HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); |
133 | 133 |
Workbook workBook = WorkbookFactory.create(inputStream); |
134 | 134 |
|
135 |
|
|
135 |
|
|
136 | 136 |
Sheet sheet = workBook.getSheetAt(0); |
137 | 137 |
Iterator<Row> rows = sheet.rowIterator(); |
138 | 138 |
// Iterator rows = sheet.rowIterator(); |
139 | 139 |
ArrayList<ArrayList<String>> lstUpdates = new ArrayList<ArrayList<String>>(); |
140 | 140 |
Set<Integer> lstTaxonIDs = new HashSet<Integer>(); |
141 | 141 |
//Set<Integer> lstTaxonIDs; |
142 |
|
|
142 |
|
|
143 | 143 |
|
144 | 144 |
while (rows.hasNext()) { |
145 | 145 |
|
... | ... | |
526 | 526 |
e.printStackTrace(); |
527 | 527 |
} |
528 | 528 |
|
529 |
|
|
529 |
|
|
530 | 530 |
try { |
531 | 531 |
// POIFSFileSystem fileSystem = new POIFSFileSystem(inputStream); |
532 | 532 |
// HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); |
533 | 533 |
|
534 | 534 |
Workbook workBook = WorkbookFactory.create(inputStream); |
535 | 535 |
|
536 |
|
|
536 |
|
|
537 | 537 |
Sheet sheet = workBook.getSheetAt(0); |
538 | 538 |
Iterator<Row> rows = sheet.rowIterator(); |
539 | 539 |
|
540 | 540 |
ArrayList<ArrayList<String>> lstUpdates = new ArrayList<ArrayList<String>>(); |
541 |
|
|
541 |
|
|
542 | 542 |
while (rows.hasNext()) { |
543 | 543 |
|
544 | 544 |
Row row = rows.next(); |
... | ... | |
585 | 585 |
vocabularyService.saveOrUpdate(stateVocabulary); |
586 | 586 |
conversation.commit(true); |
587 | 587 |
break; |
588 |
|
|
588 |
|
|
589 | 589 |
//case 1: = HumanGroup |
590 | 590 |
case 1: |
591 | 591 |
Pager<DefinedTerm> humanGroupPager = termService.findByRepresentationText(lstUpdate.get(1), DefinedTerm.class, null, null); |
592 |
|
|
592 |
|
|
593 | 593 |
DefinedTerm humanGroup = null; |
594 | 594 |
DefinedTerm ethnicGroup = null; |
595 | 595 |
if(humanGroupPager.getCount()>0) { |
596 | 596 |
humanGroup = humanGroupPager.getRecords().get(0); |
597 | 597 |
} |
598 |
|
|
598 |
|
|
599 | 599 |
if(humanGroup == null) { |
600 | 600 |
humanGroup = DefinedTerm.NewModifierInstance(lstUpdate.get(1), lstUpdate.get(1), null); |
601 | 601 |
} |
602 |
|
|
602 |
|
|
603 | 603 |
if(lstUpdate.size() >2) { |
604 | 604 |
ethnicGroup = DefinedTerm.NewModifierInstance(lstUpdate.get(2), lstUpdate.get(2), null); |
605 | 605 |
humanGroup.addIncludes(ethnicGroup); |
... | ... | |
608 | 608 |
vocabularyService.saveOrUpdate(humanGroupVocabulary); |
609 | 609 |
conversation.commit(true); |
610 | 610 |
break; |
611 |
|
|
611 |
|
|
612 | 612 |
//case 2: = Country |
613 | 613 |
case 2: |
614 | 614 |
Pager<DefinedTerm> countryPager = termService.findByRepresentationText(lstUpdate.get(1), DefinedTerm.class, null, null); |
615 | 615 |
DefinedTermBase country = null; |
616 |
|
|
616 |
|
|
617 | 617 |
if(countryPager.getCount()>0) { |
618 | 618 |
country = countryPager.getRecords().get(0); |
619 | 619 |
} |
620 |
|
|
620 |
|
|
621 | 621 |
if(country == null) { |
622 | 622 |
country = NamedArea.NewInstance(lstUpdate.get(1), lstUpdate.get(1), null); |
623 | 623 |
countryVocabulary.addTerm(country); |
... | ... | |
625 | 625 |
} |
626 | 626 |
conversation.commit(true); |
627 | 627 |
break; |
628 |
|
|
628 |
|
|
629 | 629 |
//case 3: //plantPart |
630 | 630 |
case 3: |
631 | 631 |
Pager<DefinedTerm> plantPartPager = termService.findByRepresentationText(lstUpdate.get(1), DefinedTerm.class, null, null); |
632 | 632 |
DefinedTerm plantPart = null; |
633 |
|
|
633 |
|
|
634 | 634 |
if(plantPartPager.getCount()>0) { |
635 | 635 |
plantPart = plantPartPager.getRecords().get(0); |
636 | 636 |
} |
637 |
|
|
637 |
|
|
638 | 638 |
if(plantPart == null) { |
639 | 639 |
plantPart = DefinedTerm.NewModifierInstance(lstUpdate.get(1), lstUpdate.get(1), null); |
640 | 640 |
plantPartVocabulary.addTerm(plantPart); |
... | ... | |
667 | 667 |
System.out.println("File not found in the specified path."); |
668 | 668 |
e.printStackTrace(); |
669 | 669 |
} |
670 |
|
|
670 |
|
|
671 | 671 |
try { |
672 | 672 |
// POIFSFileSystem fileSystem = new POIFSFileSystem(inputStream); |
673 | 673 |
// HSSFWorkbook workBook = new HSSFWorkbook(fileSystem); |
674 |
|
|
674 |
|
|
675 | 675 |
Workbook workBook = WorkbookFactory.create(inputStream); |
676 | 676 |
|
677 |
|
|
677 |
|
|
678 | 678 |
Sheet sheet = workBook.getSheetAt(0); |
679 | 679 |
Iterator<Row> rows = sheet.rowIterator(); |
680 | 680 |
// Iterator rows = sheet.rowIterator(); |
681 | 681 |
//Set<Integer> lstTaxonIDs; |
682 |
|
|
682 |
|
|
683 | 683 |
|
684 | 684 |
while (rows.hasNext()) { |
685 | 685 |
|
... | ... | |
763 | 763 |
} |
764 | 764 |
countryVocabulary = TermVocabulary.NewInstance(TermType.NamedArea, "Country", "Country", null, termSourceUri); |
765 | 765 |
countryVocabulary.setUuid(UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b")); |
766 |
|
|
766 |
|
|
767 | 767 |
vocabularyService.saveOrUpdate(countryVocabulary); |
768 | 768 |
conversation.commit(true); |
769 | 769 |
} |
... | ... | |
815 | 815 |
FeatureNode useSumFeatureNode = FeatureNode.NewInstance(featureUseSummary); |
816 | 816 |
palmWebFeatureTree.getRoot().addChild(useSumFeatureNode); |
817 | 817 |
} |
818 |
|
|
818 |
|
|
819 | 819 |
vocabularyService.saveOrUpdate(featureVocabulary); |
820 | 820 |
featureTreeService.saveOrUpdate(palmWebFeatureTree); |
821 | 821 |
conversation.commit(true); |
822 |
|
|
822 |
|
|
823 | 823 |
} |
824 | 824 |
if(notAvailModPager.getCount() == 0) { |
825 | 825 |
DefinedTerm notAvailMod = DefinedTerm.NewInstance(TermType.Modifier, "N/A", "N/A", null); |
826 | 826 |
termService.saveOrUpdate(notAvailMod); |
827 | 827 |
conversation.commit(true); |
828 | 828 |
} |
829 |
|
|
829 |
|
|
830 | 830 |
if(notAvailStatePager.getCount() == 0) { |
831 | 831 |
State notAvailState = State.NewInstance("N/A", "N/A", null); |
832 | 832 |
termService.saveOrUpdate(notAvailState); |
... | ... | |
845 | 845 |
vocabularyService.saveOrUpdate(featureVocabulary); |
846 | 846 |
featureTreeService.saveOrUpdate(palmWebFeatureTree); |
847 | 847 |
conversation.commit(true); |
848 |
|
|
848 |
|
|
849 | 849 |
} |
850 | 850 |
if(featureUseSummary == null) { |
851 | 851 |
featureUseSummary = Feature.NewInstance("Use Summary", "Use Summary", null); |
... | ... | |
861 | 861 |
featureTreeService.saveOrUpdate(palmWebFeatureTree); |
862 | 862 |
conversation.commit(true); |
863 | 863 |
}*/ |
864 |
|
|
864 |
|
|
865 | 865 |
conversation.close(); |
866 | 866 |
applicationController.close(); |
867 |
|
|
867 |
|
|
868 | 868 |
return success; |
869 | 869 |
} |
870 | 870 |
|
... | ... | |
872 | 872 |
UseImport uiImport = new UseImport(); |
873 | 873 |
// String xlsPath = ".//toload.xlsx"; |
874 | 874 |
//String xlsPath = "C://workspace//CDM Trunk//UseImport//src//main//java//eu//etaxonomy//cdm//toLoad2.xls"; |
875 |
|
|
875 |
|
|
876 | 876 |
uiImport.setupNecessaryItems(); |
877 | 877 |
try { |
878 | 878 |
uiImport.loadTerms(); |
cdm-eflora/src/main/java/eu/etaxonomy/cdm/app/eflora/CdmDestinations.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
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 |
*/ |
... | ... | |
22 | 22 |
public class CdmDestinations { |
23 | 23 |
@SuppressWarnings("unused") |
24 | 24 |
private static Logger logger = Logger.getLogger(CdmDestinations.class); |
25 |
|
|
25 |
|
|
26 | 26 |
/** |
27 | 27 |
* Intended to be used for imports |
28 | 28 |
*/ |
... | ... | |
33 | 33 |
String cdmUserName = "root"; |
34 | 34 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
35 | 35 |
} |
36 |
|
|
36 |
|
|
37 | 37 |
public static ICdmDataSource cdm_test_local_mysql(){ |
38 | 38 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
39 | 39 |
String cdmServer = "127.0.0.1"; |
40 |
String cdmDB = "cdm_test";
|
|
40 |
String cdmDB = "cdm_test"; |
|
41 | 41 |
String cdmUserName = "root"; |
42 | 42 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
43 | 43 |
} |
... | ... | |
45 | 45 |
public static ICdmDataSource cdm_test_local_mysql_fdac(){ |
46 | 46 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
47 | 47 |
String cdmServer = "127.0.0.1"; |
48 |
String cdmDB = "fdac";
|
|
48 |
String cdmDB = "fdac"; |
|
49 | 49 |
String cdmUserName = "edit"; |
50 | 50 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
51 | 51 |
} |
52 |
|
|
52 |
|
|
53 | 53 |
public static ICdmDataSource cdm_test_local_mysql_test(){ |
54 | 54 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
55 | 55 |
String cdmServer = "127.0.0.1"; |
56 |
String cdmDB = "test";
|
|
56 |
String cdmDB = "test"; |
|
57 | 57 |
String cdmUserName = "edit"; |
58 | 58 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
59 | 59 |
} |
... | ... | |
61 | 61 |
public static ICdmDataSource cdm_test_local_fdac(){ |
62 | 62 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
63 | 63 |
String cdmServer = "127.0.0.1"; |
64 |
String cdmDB = "fdac";
|
|
64 |
String cdmDB = "fdac"; |
|
65 | 65 |
String cdmUserName = "root"; |
66 | 66 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
67 | 67 |
} |
... | ... | |
74 | 74 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
75 | 75 |
} |
76 | 76 |
|
77 |
|
|
77 |
|
|
78 | 78 |
public static ICdmDataSource cdm_campanulaceae_production(){ |
79 | 79 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
80 | 80 |
String cdmServer = "160.45.63.171"; |
... | ... | |
82 | 82 |
String cdmUserName = "edit"; |
83 | 83 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
84 | 84 |
} |
85 |
|
|
85 |
|
|
86 | 86 |
public static ICdmDataSource cdm_flora_malesiana_preview(){ |
87 | 87 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
88 | 88 |
String cdmServer = "160.45.63.175"; |
... | ... | |
107 | 107 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
108 | 108 |
} |
109 | 109 |
|
110 |
|
|
110 |
|
|
111 | 111 |
public static ICdmDataSource cdm_flora_guianas_preview(){ |
112 | 112 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
113 | 113 |
String cdmServer = "160.45.63.175"; |
... | ... | |
123 | 123 |
String cdmUserName = "edit"; |
124 | 124 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
125 | 125 |
} |
126 |
|
|
126 |
|
|
127 | 127 |
public static ICdmDataSource cdm_flore_gabon_preview(){ |
128 | 128 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
129 | 129 |
String cdmServer = "160.45.63.175"; |
... | ... | |
131 | 131 |
String cdmUserName = "edit"; |
132 | 132 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
133 | 133 |
} |
134 |
|
|
134 |
|
|
135 | 135 |
public static ICdmDataSource cdm_flore_gabon_production(){ |
136 | 136 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
137 | 137 |
String cdmServer = "160.45.63.171"; |
... | ... | |
140 | 140 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
141 | 141 |
} |
142 | 142 |
|
143 |
|
|
143 |
|
|
144 | 144 |
public static ICdmDataSource cdm_flora_central_africa_local(){ |
145 | 145 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
146 | 146 |
String cdmServer = "localhost"; |
... | ... | |
148 | 148 |
String cdmUserName = "edit"; |
149 | 149 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
150 | 150 |
} |
151 |
|
|
151 |
|
|
152 | 152 |
public static ICdmDataSource cdm_flora_central_africa_preview(){ |
153 | 153 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
154 | 154 |
String cdmServer = "160.45.63.175"; |
... | ... | |
156 | 156 |
String cdmUserName = "edit"; |
157 | 157 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
158 | 158 |
} |
159 |
|
|
159 |
|
|
160 | 160 |
public static ICdmDataSource cdm_flora_central_africa_production(){ |
161 | 161 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
162 | 162 |
String cdmServer = "160.45.63.171"; |
... | ... | |
164 | 164 |
String cdmUserName = "edit"; |
165 | 165 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
166 | 166 |
} |
167 |
|
|
167 |
|
|
168 | 168 |
public static ICdmDataSource cdm_portal_test_localhost(){ |
169 | 169 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
170 | 170 |
String cdmServer = "127.0.0.1"; |
... | ... | |
172 | 172 |
String cdmUserName = "edit"; |
173 | 173 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
174 | 174 |
} |
175 |
|
|
175 |
|
|
176 | 176 |
public static ICdmDataSource cdm_portal_test_localhost2(){ |
177 | 177 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
178 | 178 |
String cdmServer = "127.0.0.1"; |
... | ... | |
180 | 180 |
String cdmUserName = "edit"; |
181 | 181 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
182 | 182 |
} |
183 |
|
|
183 |
|
|
184 | 184 |
public static ICdmDataSource cdm_local_postgres_CdmTest(){ |
185 | 185 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.PostgreSQL; |
186 | 186 |
String cdmServer = "127.0.0.1"; |
... | ... | |
189 | 189 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
190 | 190 |
} |
191 | 191 |
|
192 |
|
|
193 |
|
|
192 |
|
|
193 |
|
|
194 | 194 |
public static ICdmDataSource NULL(){ |
195 | 195 |
return null; |
196 | 196 |
} |
197 |
|
|
198 |
|
|
197 |
|
|
198 |
|
|
199 | 199 |
public static ICdmDataSource localH2(){ |
200 | 200 |
return CdmDataSource.NewH2EmbeddedInstance("cdm", "sa", ""); |
201 | 201 |
} |
202 |
|
|
202 |
|
|
203 | 203 |
public static ICdmDataSource localH2(String database, String username, String filePath){ |
204 |
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath, null);
|
|
204 |
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath); |
|
205 | 205 |
} |
206 |
|
|
206 |
|
|
207 | 207 |
public static ICdmDataSource localH2Salvador(){ |
208 | 208 |
return CdmDataSource.NewH2EmbeddedInstance("salvador", "sa", ""); |
209 | 209 |
} |
210 |
|
|
210 |
|
|
211 | 211 |
public static ICdmDataSource localH2Diptera(){ |
212 | 212 |
return CdmDataSource.NewH2EmbeddedInstance("diptera", "sa", ""); |
213 | 213 |
} |
214 |
|
|
215 |
|
|
214 |
|
|
215 |
|
|
216 | 216 |
public static ICdmDataSource localH2Cichorieae(){ |
217 | 217 |
return CdmDataSource.NewH2EmbeddedInstance("cichorieae", "sa", ""); |
218 | 218 |
} |
219 |
|
|
219 |
|
|
220 | 220 |
public static ICdmDataSource localH2Palmae(){ |
221 | 221 |
return CdmDataSource.NewH2EmbeddedInstance("palmae", "sa", ""); |
222 | 222 |
} |
223 |
|
|
223 |
|
|
224 | 224 |
public static ICdmDataSource localH2EuroMed(){ |
225 | 225 |
return CdmDataSource.NewH2EmbeddedInstance("euroMed", "sa", ""); |
226 | 226 |
} |
227 |
|
|
227 |
|
|
228 | 228 |
public static ICdmDataSource localH2Erms(){ |
229 | 229 |
return CdmDataSource.NewH2EmbeddedInstance("erms", "sa", ""); |
230 | 230 |
} |
231 |
|
|
231 |
|
|
232 | 232 |
public static ICdmDataSource localH2_viola(){ |
233 | 233 |
return CdmDataSource.NewH2EmbeddedInstance("testViola", "sa", ""); |
234 | 234 |
} |
235 |
|
|
235 |
|
|
236 | 236 |
public static ICdmDataSource localH2_LIAS(){ |
237 | 237 |
return CdmDataSource.NewH2EmbeddedInstance("testLIAS", "sa", ""); |
238 | 238 |
} |
239 |
|
|
239 |
|
|
240 | 240 |
public static ICdmDataSource localH2_Erythroneura(){ |
241 | 241 |
return CdmDataSource.NewH2EmbeddedInstance("testErythroneura", "sa", ""); |
242 | 242 |
} |
243 |
|
|
243 |
|
|
244 | 244 |
public static ICdmDataSource localH2_Cicad(){ |
245 | 245 |
return CdmDataSource.NewH2EmbeddedInstance("testCicad", "sa", ""); |
246 | 246 |
} |
247 |
|
|
247 |
|
|
248 | 248 |
public static ICdmDataSource localH2_ValRosandraFRIDAKey(){ |
249 | 249 |
return CdmDataSource.NewH2EmbeddedInstance("testValRosandraFRIDAKey", "sa", ""); |
250 | 250 |
} |
251 |
|
|
251 |
|
|
252 | 252 |
public static ICdmDataSource localH2_FreshwaterAquaticInsects(){ |
253 | 253 |
return CdmDataSource.NewH2EmbeddedInstance("testFreshwaterAquaticInsects", "sa", ""); |
254 | 254 |
} |
255 |
|
|
255 |
|
|
256 | 256 |
public static ICdmDataSource cdm_portal_test_pollux(){ |
257 | 257 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
258 | 258 |
String cdmServer = "192.168.2.11"; |
... | ... | |
264 | 264 |
public static ICdmDataSource cdm_algaterra_preview(){ |
265 | 265 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
266 | 266 |
String cdmServer = "160.45.63.201"; |
267 |
String cdmDB = "cdm_edit_algaterra";
|
|
267 |
String cdmDB = "cdm_edit_algaterra"; |
|
268 | 268 |
String cdmUserName = "edit"; |
269 | 269 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
270 | 270 |
} |
271 |
|
|
271 |
|
|
272 | 272 |
public static ICdmDataSource cdm_edit_cichorieae_PG(){ |
273 | 273 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.PostgreSQL; |
274 | 274 |
String cdmServer = "127.0.0.1"; |
275 |
String cdmDB = "cdm_edit_cichorieae_a";
|
|
275 |
String cdmDB = "cdm_edit_cichorieae_a"; |
|
276 | 276 |
String cdmUserName = "edit"; |
277 | 277 |
int port = 15432; |
278 | 278 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
... | ... | |
281 | 281 |
public static ICdmDataSource cdm_cichorieae_preview(){ |
282 | 282 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
283 | 283 |
String cdmServer = "160.45.63.201"; |
284 |
String cdmDB = "cdm_edit_cichorieae";
|
|
284 |
String cdmDB = "cdm_edit_cichorieae"; |
|
285 | 285 |
String cdmUserName = "edit"; |
286 | 286 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
287 | 287 |
} |
288 |
|
|
288 |
|
|
289 | 289 |
public static ICdmDataSource cdm_production_cichorieae(){ |
290 | 290 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
291 | 291 |
String cdmServer = "160.45.63.151"; |
292 | 292 |
// String cdmServer = "127.0.0.1"; |
293 |
String cdmDB = "cdm_production_cichorieae";
|
|
293 |
String cdmDB = "cdm_production_cichorieae"; |
|
294 | 294 |
String cdmUserName = "edit"; |
295 | 295 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
296 | 296 |
} |
297 |
|
|
297 |
|
|
298 | 298 |
public static ICdmDataSource cdm_production_palmae(){ |
299 | 299 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
300 | 300 |
String cdmServer = "160.45.63.151"; |
301 |
String cdmDB = "cdm_production_palmae";
|
|
301 |
String cdmDB = "cdm_production_palmae"; |
|
302 | 302 |
String cdmUserName = "edit"; |
303 | 303 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
304 | 304 |
} |
305 |
|
|
306 |
|
|
305 |
|
|
306 |
|
|
307 | 307 |
public static ICdmDataSource cdm_production_diptera(){ |
308 | 308 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
309 | 309 |
String cdmServer = "160.45.63.151"; |
310 |
String cdmDB = "cdm_production_diptera";
|
|
310 |
String cdmDB = "cdm_production_diptera"; |
|
311 | 311 |
String cdmUserName = "edit"; |
312 | 312 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
313 | 313 |
} |
314 |
|
|
314 |
|
|
315 | 315 |
public static ICdmDataSource local_cdm_edit_cichorieae_a(){ |
316 | 316 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
317 | 317 |
String cdmServer = "127.0.0.1"; |
318 |
String cdmDB = "cdm_edit_cichorieae_a";
|
|
318 |
String cdmDB = "cdm_edit_cichorieae_a"; |
|
319 | 319 |
String cdmUserName = "edit"; |
320 | 320 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
321 | 321 |
} |
322 |
|
|
322 |
|
|
323 | 323 |
public static ICdmDataSource local_cdm_edit_cichorieae_b(){ |
324 | 324 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
325 | 325 |
String cdmServer = "127.0.0.1"; |
326 |
String cdmDB = "cdm_edit_cichorieae_b";
|
|
326 |
String cdmDB = "cdm_edit_cichorieae_b"; |
|
327 | 327 |
String cdmUserName = "edit"; |
328 | 328 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
329 | 329 |
} |
... | ... | |
339 | 339 |
public static ICdmDataSource cdm_edit_diptera_preview_B(){ |
340 | 340 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
341 | 341 |
String cdmServer = "127.0.0.1"; |
342 |
String cdmDB = "cdm_edit_diptera_b";
|
|
342 |
String cdmDB = "cdm_edit_diptera_b"; |
|
343 | 343 |
String cdmUserName = "edit"; |
344 | 344 |
int port = 13306; |
345 | 345 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
346 | 346 |
} |
347 |
|
|
347 |
|
|
348 | 348 |
public static ICdmDataSource cdm_edit_cichorieae_preview(){ |
349 | 349 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
350 | 350 |
String cdmServer = "127.0.0.1"; |
351 |
String cdmDB = "cdm_edit_cichorieae";
|
|
351 |
String cdmDB = "cdm_edit_cichorieae"; |
|
352 | 352 |
String cdmUserName = "edit"; |
353 | 353 |
int port = 13306; |
354 | 354 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
... | ... | |
357 | 357 |
public static ICdmDataSource cdm_edit_palmae_preview(){ |
358 | 358 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
359 | 359 |
String cdmServer = "127.0.0.1"; |
360 |
String cdmDB = "cdm_edit_palmae";
|
|
360 |
String cdmDB = "cdm_edit_palmae"; |
|
361 | 361 |
String cdmUserName = "edit"; |
362 | 362 |
int port = 13306; |
363 | 363 |
return makeDestination(dbType, cdmServer, cdmDB, port, cdmUserName, null); |
364 |
}
|
|
365 |
|
|
364 |
} |
|
365 |
|
|
366 | 366 |
public static ICdmDataSource cdm_edit_salvador(){ |
367 | 367 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
368 | 368 |
String cdmServer = "192.168.2.10"; |
369 |
String cdmDB = "cdm_edit_salvador";
|
|
369 |
String cdmDB = "cdm_edit_salvador"; |
|
370 | 370 |
String cdmUserName = "edit"; |
371 | 371 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
372 | 372 |
} |
373 |
|
|
373 |
|
|
374 | 374 |
public static ICdmDataSource cdm_import_salvador() { |
375 | 375 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
376 | 376 |
String cdmServer = "192.168.2.10"; |
377 |
String cdmDB = "cdm_import_salvador";
|
|
377 |
String cdmDB = "cdm_import_salvador"; |
|
378 | 378 |
String cdmUserName = "edit"; |
379 | 379 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
380 | 380 |
} |
381 |
|
|
381 |
|
|
382 | 382 |
public static ICdmDataSource cdm_salvador_production() { |
383 | 383 |
DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL; |
384 | 384 |
String cdmServer = "192.168.2.10"; |
385 |
String cdmDB = "salvador_cdm";
|
|
385 |
String cdmDB = "salvador_cdm"; |
|
386 | 386 |
String cdmUserName = "salvador"; |
387 | 387 |
return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null); |
388 | 388 |
} |
389 |
|
|
390 |
|
|
389 |
|
|
390 |
|
|
391 | 391 |
// public static ICdmDataSource LAPTOP_HP(){ |
392 | 392 |
// DatabaseTypeEnum dbType = DatabaseTypeEnum.SqlServer2005; |
393 | 393 |
// String cdmServer = "LAPTOPHP"; |
394 |
// String cdmDB = "cdmTest";
|
|
394 |
// String cdmDB = "cdmTest"; |
|
395 | 395 |
// String cdmUserName = "edit"; |
396 | 396 |
// return makeDestination(cdmServer, cdmDB, -1, cdmUserName, null); |
397 | 397 |
// } |
398 |
|
|
399 |
|
|
400 | 398 |
|
401 |
|
|
399 |
|
|
400 |
|
|
401 |
|
|
402 | 402 |
/** |
403 | 403 |
* initializes source |
404 | 404 |
* TODO only supports MySQL and PostgreSQL |
405 |
*
|
|
405 |
* |
|
406 | 406 |
* @param dbType |
407 | 407 |
* @param cdmServer |
408 | 408 |
* @param cdmDB |
... | ... | |
416 | 416 |
pwd = AccountStore.readOrStorePassword(cdmServer, cdmDB, cdmUserName, pwd); |
417 | 417 |
ICdmDataSource destination; |
418 | 418 |
if(dbType.equals(DatabaseTypeEnum.MySQL)){ |
419 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
419 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd);
|
|
420 | 420 |
} else if(dbType.equals(DatabaseTypeEnum.PostgreSQL)){ |
421 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
421 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd);
|
|
422 | 422 |
} else { |
423 | 423 |
//TODO others |
424 | 424 |
throw new RuntimeException("Unsupported DatabaseType"); |
... | ... | |
429 | 429 |
|
430 | 430 |
|
431 | 431 |
/** |
432 |
* Accepts a string array and tries to find a method returning an ICdmDataSource with
|
|
432 |
* Accepts a string array and tries to find a method returning an ICdmDataSource with |
|
433 | 433 |
* the name of the given first string in the array |
434 |
*
|
|
434 |
* |
|
435 | 435 |
* @param args |
436 | 436 |
* @return |
437 | 437 |
*/ |
438 | 438 |
public static ICdmDataSource chooseDestination(String[] args) { |
439 |
if(args == null) |
|
440 |
return null; |
|
441 |
|
|
442 |
if(args.length != 1) |
|
443 |
return null; |
|
444 |
|
|
439 |
if(args == null) { |
|
440 |
return null; |
|
441 |
} |
|
442 |
|
|
443 |
if(args.length != 1) { |
|
444 |
return null; |
|
445 |
} |
|
446 |
|
|
445 | 447 |
String possibleDestination = args[0]; |
446 |
|
|
448 |
|
|
447 | 449 |
Method[] methods = CdmDestinations.class.getMethods(); |
448 |
|
|
450 |
|
|
449 | 451 |
for (Method method : methods){ |
450 | 452 |
if(method.getName().equals(possibleDestination)){ |
451 | 453 |
try { |
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/common/CdmDestinations.java | ||
---|---|---|
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
public static ICdmDataSource localH2(String database, String username, String filePath){ |
112 |
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath, null);
|
|
112 |
return CdmDataSource.NewH2EmbeddedInstance(database, "sa", "", filePath); |
|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
|
... | ... | |
173 | 173 |
pwd = AccountStore.readOrStorePassword(cdmServer, cdmDB, cdmUserName, pwd); |
174 | 174 |
ICdmDataSource destination; |
175 | 175 |
if(dbType.equals(DatabaseTypeEnum.MySQL)){ |
176 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
176 |
destination = CdmDataSource.NewMySqlInstance(cdmServer, cdmDB, port, cdmUserName, pwd); |
|
177 | 177 |
} else if(dbType.equals(DatabaseTypeEnum.PostgreSQL)){ |
178 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd, null);
|
|
178 |
destination = CdmDataSource.NewPostgreSQLInstance(cdmServer, cdmDB, port, cdmUserName, pwd); |
|
179 | 179 |
} else { |
180 | 180 |
//TODO others |
181 | 181 |
throw new RuntimeException("Unsupported DatabaseType"); |
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/common/TestDatabase.java | ||
---|---|---|
38 | 38 |
import eu.etaxonomy.cdm.model.location.Country; |
39 | 39 |
import eu.etaxonomy.cdm.model.location.NamedAreaType; |
40 | 40 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
41 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
42 | 41 |
import eu.etaxonomy.cdm.model.name.Rank; |
43 | 42 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
44 | 43 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
... | ... | |
67 | 66 |
|
68 | 67 |
logger.info("Setting DB " + dbname); |
69 | 68 |
String password = AccountStore.readOrStorePassword(dbname, server, username, null); |
70 |
ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password, NomenclaturalCode.ICNAFP);
|
|
69 |
ICdmDataSource datasource = CdmDataSource.NewMySqlInstance(server, dbname, username, password); |
|
71 | 70 |
return datasource; |
72 | 71 |
} |
73 | 72 |
|
Also available in: Unified diff
ref #3658 remove nomenclaturalCode