\r
package eu.etaxonomy.cdm.app.wp6.palmae;\r
\r
+import java.io.File;\r
import java.util.UUID;\r
\r
import org.apache.log4j.Logger;\r
\r
import eu.etaxonomy.cdm.api.application.CdmApplicationController;\r
import eu.etaxonomy.cdm.app.common.CdmDestinations;\r
+import eu.etaxonomy.cdm.app.images.ImageImportConfigurator;\r
import eu.etaxonomy.cdm.app.tcs.TcsSources;\r
+import eu.etaxonomy.cdm.app.wp6.palmae.config.PalmaeProtologueImportConfigurator;\r
import eu.etaxonomy.cdm.database.DbSchemaValidation;\r
import eu.etaxonomy.cdm.database.ICdmDataSource;\r
+import eu.etaxonomy.cdm.io.PalmaeImageImport;\r
+import eu.etaxonomy.cdm.io.PalmaeProtologueImport;\r
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;\r
+import eu.etaxonomy.cdm.io.common.IImportConfigurator;\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.tcsrdf.TcsRdfImportConfigurator;\r
* @version 1.0\r
*/\r
public class PalmaeActivator {\r
- private static Logger logger = Logger.getLogger(PalmaeActivator.class);\r
+ private static final Logger logger = Logger.getLogger(PalmaeActivator.class);\r
\r
//database validation status (create, update, validate ...)\r
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;\r
static final String tcsSource = TcsSources.arecaceae_local();\r
- static final ICdmDataSource cdmDestination = CdmDestinations.localH2();\r
-// static final ICdmDataSource cdmDestination = CdmDestinations.localH2();\r
+ static final ICdmDataSource cdmDestination = CdmDestinations.localH2Palmae();\r
\r
static final UUID featureTreeUuid = UUID.fromString("72ccce05-7cc8-4dab-8e47-bf3f5fd848a0");\r
\r
+ static final UUID treeUuid = UUID.fromString("1adb71d4-cce6-45e1-b578-e668778d9ec6");\r
static final UUID secUuid = UUID.fromString("5f32b8af-0c97-48ac-8d33-6099ed68c625");\r
static final String sourceSecId = "palm_pub_ed_999999";\r
- //should the taxonX import run as well?\r
+ static final boolean pubishReferencesInBibliography = false;\r
+ \r
+ //should the other imports run as well?\r
static final boolean includeTaxonX = false;\r
+ static final boolean includeImages = true;\r
+ static final boolean includeExcelProtologue = false;\r
+ static final boolean includeMediaProtologue = false;\r
\r
//check - import\r
- static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;\r
+ static final CHECK check = CHECK.CHECK_AND_IMPORT;\r
+ \r
+ static boolean useTaxonomicTree = true;\r
\r
//authors\r
static final boolean doAuthors = true;\r
//names\r
static final boolean doTaxonNames = true;\r
static final boolean doRelNames = true;\r
-\r
- //static final boolean doTypes = true;\r
- //static final boolean doNameFacts = true;\r
\r
//taxa\r
static final boolean doTaxa = true;\r
static final boolean doRelTaxa = true;\r
static final boolean doFacts = true;\r
- \r
\r
\r
private boolean doImport(){\r
\r
TcsRdfImportConfigurator tcsImportConfigurator = TcsRdfImportConfigurator.NewInstance(source, destination);\r
\r
+ tcsImportConfigurator.setTreeUuid(treeUuid);\r
tcsImportConfigurator.setSecUuid(secUuid);\r
tcsImportConfigurator.setSourceSecId(sourceSecId);\r
\r
tcsImportConfigurator.setDoReferences(doReferences);\r
tcsImportConfigurator.setDoTaxonNames(doTaxonNames);\r
tcsImportConfigurator.setDoRelNames(doRelNames);\r
- //tcsImportConfigurator.setDoNameStatus(doNameStatus);\r
- //tcsImportConfigurator.setDoTypes(doTypes);\r
- //tcsImportConfigurator.setDoNameFacts(doNameFacts);\r
\r
tcsImportConfigurator.setDoTaxa(doTaxa);\r
tcsImportConfigurator.setDoRelTaxa(doRelTaxa);\r
tcsImportConfigurator.setDoFacts(doFacts);\r
+ tcsImportConfigurator.setUseTaxonomicTree(useTaxonomicTree);\r
+ tcsImportConfigurator.setPublishReferences(pubishReferencesInBibliography);\r
\r
tcsImportConfigurator.setCheck(check);\r
tcsImportConfigurator.setDbSchemaValidation(hbm2dll);\r
//new Test().invoke(tcsImportConfigurator);\r
success &= tcsImport.invoke(tcsImportConfigurator);\r
\r
- \r
//make feature tree\r
logger.info("Make feature tree");\r
- CdmApplicationController app = tcsImport.getCdmApp();\r
- \r
-\r
+ CdmApplicationController app = tcsImport.getCdmAppController();\r
\r
FeatureTree tree = getFeatureTree();\r
app.getDescriptionService().saveFeatureTree(tree);\r
boolean success = true;\r
\r
logger.debug("start");\r
+ \r
PalmaeActivator me = new PalmaeActivator();\r
me.doImport();\r
\r
+ if (includeImages){\r
+ System.out.println("Start importing images ...");\r
+ CdmDefaultImport<IImportConfigurator> imageImporter = new CdmDefaultImport<IImportConfigurator>();\r
+ ImageImportConfigurator imageConfigurator = ImageImportConfigurator.NewInstance(\r
+ PalmaeImageActivator.sourceFolder, cdmDestination, PalmaeImageImport.class);\r
+ imageConfigurator.setSecUuid(secUuid);\r
+ success &= imageImporter.invoke(imageConfigurator);\r
+ System.out.println("End importing images ...");\r
+ }\r
+\r
+ if (includeExcelProtologue){\r
+ System.out.println("Start importing protologues ...");\r
+ ImageImportConfigurator imageConfigurator = ImageImportConfigurator.NewInstance(\r
+ PalmaeProtologueActivator.sourceFile, cdmDestination, PalmaeProtologueImport.class);\r
+ imageConfigurator.setSecUuid(secUuid);\r
+ \r
+ CdmDefaultImport<IImportConfigurator> imageImporter = new CdmDefaultImport<IImportConfigurator>();\r
+ imageImporter.invoke(imageConfigurator);\r
+ System.out.println("End importing protologues ...");\r
+ }\r
+ if (includeMediaProtologue){\r
+ System.out.println("Start importing protologues from \\\\media...");\r
+ String protologueSource = "\\\\media\\EditWP6\\palmae\\protologe";\r
+ String urlString = "http://wp5.e-taxonomy.eu/media/palmae/protologe/";\r
+ File source = new File (protologueSource);\r
+\r
+ PalmaeProtologueImportConfigurator protologConfig = PalmaeProtologueImportConfigurator.NewInstance(protologueSource, cdmDestination, urlString);\r
+ CdmDefaultImport<IImportConfigurator> cdmImport = new CdmDefaultImport<IImportConfigurator>();\r
+ \r
+ //protologConfig.setDoFacts(doDescriptions);\r
+ protologConfig.setCheck(check);\r
+ protologConfig.setDbSchemaValidation(DbSchemaValidation.UPDATE);\r
+\r
+ protologConfig.setSource(source);\r
+ success &= cdmImport.invoke(protologConfig);\r
+\r
+ System.out.println("End importing protologues ...");\r
+ }\r
+ \r
if (includeTaxonX){\r
+ System.out.println("Start importing taxonX ...");\r
PalmaeTaxonXImportActivator taxonXimporter = new PalmaeTaxonXImportActivator();\r
PalmaeTaxonXImportActivator.cdmDestination = cdmDestination;\r
- PalmaeTaxonXImportActivator.secUuid = secUuid;\r
success &= taxonXimporter.runImport();\r
+ System.out.println("End importing taxonX ...");\r
}\r
\r
String strSuccess = "";\r