/**\r
* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
\r
import org.apache.log4j.Logger;\r
\r
-import eu.etaxonomy.cdm.api.application.ICdmApplicationDefaultConfiguration;\r
+import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;\r
import eu.etaxonomy.cdm.app.common.CdmDestinations;\r
-import eu.etaxonomy.cdm.app.berlinModelImport.TreeCreator;\r
import eu.etaxonomy.cdm.database.DbSchemaValidation;\r
import eu.etaxonomy.cdm.database.ICdmDataSource;\r
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;\r
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;\r
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;\r
import eu.etaxonomy.cdm.io.common.IImportConfigurator.EDITOR;\r
+import eu.etaxonomy.cdm.io.common.ImportResult;\r
import eu.etaxonomy.cdm.io.common.Source;\r
import eu.etaxonomy.cdm.model.description.Feature;\r
import eu.etaxonomy.cdm.model.description.FeatureNode;\r
\r
/**\r
* TODO add the following to a wiki page:\r
- * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data base under another operation systen \r
+ * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data base under another operation systen\r
* you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.\r
- * \r
- * \r
+ *\r
+ *\r
* @author a.mueller\r
*\r
*/\r
static final UUID secUuid = UUID.fromString("ed7dd0ea-fcdd-405d-9fe1-52652aa06119");\r
static final UUID classificationUuid = UUID.fromString("e305ddac-7200-4293-aa5d-d3426133ed9f");\r
static final int sourceSecId = 100000;\r
- \r
+\r
static final UUID featureTreeUuid = UUID.fromString("231809ce-ad9e-4a50-8a48-668bd336cb7e");\r
- static final Object[] featureKeyList = new Integer[]{}; \r
- \r
- \r
+ static final Object[] featureKeyList = new Integer[]{};\r
+\r
+\r
// set to zero for unlimited nameFacts\r
static final int maximumNumberOfNameFacts = 0;\r
static final int recordsPerTransaction = 2000;\r
- \r
+\r
//check - import\r
static final CHECK check = CHECK.CHECK_AND_IMPORT;\r
\r
//editor - import\r
static final EDITOR editor = EDITOR.EDITOR_AS_EDITOR;\r
- \r
- //NomeclaturalCode\r
+\r
+ //NomenclaturalCode\r
static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICNAFP;\r
\r
//ignore null\r
static final boolean ignoreNull = true;\r
- \r
+\r
static boolean useClassification = true;\r
- \r
- static boolean includesEmCode = false; \r
\r
+ static boolean includesEmCode = false;\r
\r
-// **************** ALL ********************* \r
+\r
+// **************** ALL *********************\r
\r
static final boolean doUser = true;\r
//authors\r
static final boolean doNameStatus = true;\r
static final boolean doTypes = true;\r
static final boolean doNameFacts = true;\r
- \r
+\r
//taxa\r
static final boolean doTaxa = true;\r
static final boolean doRelTaxa = true;\r
//etc.\r
static final boolean doMarker = true;\r
\r
- \r
+\r
// **************** SELECTED *********************\r
//\r
// static final boolean doUser = false;\r
// static final boolean doNameStatus = false;\r
// static final boolean doTypes = false;\r
// static final boolean doNameFacts = false;\r
-// \r
-// //taxa \r
+//\r
+// //taxa\r
// static final boolean doTaxa = false;\r
// static final boolean doRelTaxa = false;\r
// static final boolean doCommonNames = false;\r
// static final boolean doFacts = false;\r
// static final boolean doOccurences = false;\r
-// \r
+//\r
// //etc.\r
// static final boolean doMarker = false;\r
- \r
- \r
- private boolean doInvoke(ICdmDataSource destination){\r
- boolean success = true;\r
+\r
+\r
+ private ImportResult doInvoke(ICdmDataSource destination){\r
+ ImportResult success ;\r
Source source = berlinModelSource;\r
- \r
+\r
BerlinModelImportConfigurator bmImportConfigurator = BerlinModelImportConfigurator.NewInstance(source, destination);\r
- \r
+\r
bmImportConfigurator.setClassificationUuid(classificationUuid);\r
bmImportConfigurator.setSourceSecId(sourceSecId);\r
- \r
+\r
bmImportConfigurator.setNomenclaturalCode(nomenclaturalCode);\r
\r
bmImportConfigurator.setIgnoreNull(ignoreNull);\r
bmImportConfigurator.setDoTypes(doTypes);\r
bmImportConfigurator.setDoNameFacts(doNameFacts);\r
bmImportConfigurator.setUseClassification(useClassification);\r
- \r
+\r
bmImportConfigurator.setDoTaxa(doTaxa);\r
bmImportConfigurator.setDoRelTaxa(doRelTaxa);\r
bmImportConfigurator.setDoFacts(doFacts);\r
bmImportConfigurator.setDoOccurrence(doOccurences);\r
bmImportConfigurator.setDoCommonNames(doCommonNames);\r
- \r
+\r
bmImportConfigurator.setDoMarker(doMarker);\r
bmImportConfigurator.setDoUser(doUser);\r
bmImportConfigurator.setEditor(editor);\r
bmImportConfigurator.setDbSchemaValidation(hbm2dll);\r
bmImportConfigurator.setRecordsPerTransaction(recordsPerTransaction);\r
- \r
+\r
bmImportConfigurator.setIncludesEmCode(includesEmCode);\r
\r
// maximum number of name facts to import\r
bmImportConfigurator.setMaximumNumberOfNameFacts(maximumNumberOfNameFacts);\r
- \r
- \r
+\r
+\r
bmImportConfigurator.setCheck(check);\r
bmImportConfigurator.setEditor(editor);\r
- \r
+\r
// invoke import\r
CdmDefaultImport<BerlinModelImportConfigurator> bmImport = new CdmDefaultImport<BerlinModelImportConfigurator>();\r
- success &= bmImport.invoke(bmImportConfigurator);\r
- \r
+ success = bmImport.invoke(bmImportConfigurator);\r
+\r
if (doFacts && (bmImportConfigurator.getCheck().equals(CHECK.CHECK_AND_IMPORT) || bmImportConfigurator.getCheck().equals(CHECK.IMPORT_WITHOUT_CHECK) ) ){\r
- ICdmApplicationDefaultConfiguration app = bmImport.getCdmAppController();\r
- \r
+ ICdmApplicationConfiguration app = bmImport.getCdmAppController();\r
+\r
//make feature tree\r
FeatureTree tree = TreeCreator.flatTree(featureTreeUuid, bmImportConfigurator.getFeatureMap(), featureKeyList);\r
FeatureNode distributionNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());\r
- tree.getRoot().addChild(distributionNode, 1); \r
+ tree.getRoot().addChild(distributionNode, 1);\r
app.getFeatureTreeService().saveOrUpdate(tree);\r
}\r
- \r
+\r
System.out.println("End import from BerlinModel ("+ source.getDatabase() + ")...");\r
\r
\r
logger.warn("!!!! NOTE: RefDetail notes and RelPTaxon notes are not imported automatically. Please check for these notes and import them manually.");\r
- \r
+\r
return success;\r
- \r
+\r
}\r
- \r
+\r
/**\r
* @param args\r
*/\r
public static void main(String[] args) {\r
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;\r
- \r
+\r
System.out.println("Start import from BerlinModel("+ berlinModelSource.getDatabase() + ") to " + destination.getDatabase() + " ...");\r
CampanulaceaeActivator me = new CampanulaceaeActivator();\r
me.doInvoke(destination);\r
- \r
+\r
}\r
\r
}\r