\r
package eu.etaxonomy.cdm.app.dwca;\r
\r
+import java.io.File;\r
+import java.net.URI;\r
+import java.util.Arrays;\r
+import java.util.List;\r
+import java.util.UUID;\r
+\r
import org.apache.log4j.Logger;\r
+import org.joda.time.DateTime;\r
\r
import eu.etaxonomy.cdm.app.common.CdmDestinations;\r
+import eu.etaxonomy.cdm.common.monitor.DefaultProgressMonitor;\r
+import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;\r
import eu.etaxonomy.cdm.database.ICdmDataSource;\r
import eu.etaxonomy.cdm.io.common.CdmDefaultExport;\r
import eu.etaxonomy.cdm.io.common.IExportConfigurator.CHECK;\r
+import eu.etaxonomy.cdm.io.dwca.out.DwcaEmlRecord;\r
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;\r
+import eu.etaxonomy.cdm.model.agent.Institution;\r
+import eu.etaxonomy.cdm.model.agent.InstitutionalMembership;\r
+import eu.etaxonomy.cdm.model.agent.Person;\r
\r
\r
/**\r
private static final Logger logger = Logger.getLogger(DwcaExportActivator.class);\r
\r
//database validation status (create, update, validate ...)\r
- private static final String fileDestination = "C:\\tmp\\dwcaTmp";\r
+ private static final String fileDestination = "C:\\tmp\\dwcaTmp\\";\r
+// private static final ICdmDataSource cdmSource = CdmDestinations.cdm_local_cichorieae();\r
// private static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql();\r
private static final ICdmDataSource cdmSource = CdmDestinations.cdm_production_cichorieae();\r
+// private static final ICdmDataSource cdmSource = CdmDestinations.cdm_flora_central_africa_production();\r
+\r
+ private IProgressMonitor monitor = DefaultProgressMonitor.NewInstance();\r
+ \r
+ private static DateTime dateTime = new DateTime();\r
+ private static String date = dateTime.getYear() + "-" + dateTime.getMonthOfYear() + "-" + dateTime.getDayOfMonth();\r
+ \r
+ private static final String defaultBibliographicCitation = "ICN (Hand, R., Kilian, N. & Raab-Straube, E. von; general editors) 2009+ (continuously updated): International Cichorieae Network: Cichorieae Portal. Published on the Internet at http://wp6-cichorieae.e-taxonomy.eu/portal/; " + \r
+ "accessed ["+date+"].";\r
+\r
+ private static final String taxonSourceDefault = "http://wp6-cichorieae.e-taxonomy.eu/portal/?q=cdm_dataportal/taxon/{id}";\r
\r
//check - import\r
private static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;\r
\r
+ private static List<UUID> featureExclusions = Arrays.asList(new UUID[]{\r
+ UUID.fromString("5deff505-1a32-4817-9a74-50e6936fd630"), //occurrences\r
+ UUID.fromString("8075074c-ace8-496b-ac82-47c14553f7fd"), //Editor_Parenthesis\r
+ UUID.fromString("c0cc5ebe-1f0c-4c31-af53-d486858ea415"), //Image Sources\r
+ UUID.fromString("9f6c551d-0f19-45ea-a855-4946f6fc1093"), //Credits\r
+ UUID.fromString("cbf12c6c-94e6-4724-9c48-0f6f10d83e1c"), //Editor Brackets\r
+ UUID.fromString("0508114d-4158-48b5-9100-369fa75120d3") //inedited\r
+ });\r
+ \r
+ \r
// ****************** ALL *****************************************\r
- private boolean doTaxa = false;\r
- private boolean doResourceRelation = true;\r
- private boolean doTypesAndSpecimen = true;\r
- private boolean doVernacularNames = true;\r
- private boolean doReferences = false;\r
- private boolean doDescription = true;\r
- private boolean doDistributions = true;\r
- private boolean doImages = true;\r
-\r
-\r
-// ************************ NONE **************************************** //\r
-// private boolean doTaxa = false;\r
-// private boolean doResourceRelation = false;\r
-// private boolean doTypesAndSpecimen = false;\r
-// private boolean doVernacularNames = false;\r
-// private boolean doReferences = false;\r
-// private boolean doDescription = false;\r
-// private boolean doDistributions = false;\r
+ \r
+// private boolean doTaxa = true;\r
+// private boolean doResourceRelation = true;\r
+// private boolean doTypesAndSpecimen = true;\r
+// private boolean doVernacularNames = true;\r
+// private boolean doReferences = true;\r
+// private boolean doDescription = true;\r
+// private boolean doDistributions = true;\r
// private boolean doImages = false;\r
+// private boolean doMetaData = true;\r
+// private boolean doEml = true;\r
\r
+// ************************ NONE **************************************** //\r
+ \r
+ private boolean doTaxa = true;\r
+ private boolean doResourceRelation = false;\r
+ private boolean doTypesAndSpecimen = false;\r
+ private boolean doVernacularNames = false;\r
+ private boolean doReferences = false;\r
+ private boolean doDescription = false;\r
+ private boolean doDistributions = false;\r
+ private boolean doImages = false;\r
+ private boolean doMetaData = true;\r
+ private boolean doEml = false;\r
\r
public boolean doExport(ICdmDataSource source){\r
System.out.println("Start export to DWC-A ("+ fileDestination + ") ...");\r
\r
//make file destination\r
String destination = fileDestination;\r
+ DwcaEmlRecord emlRecord = getEmlRecord();\r
\r
- DwcaTaxExportConfigurator config = DwcaTaxExportConfigurator.NewInstance(source, destination);\r
+ DwcaTaxExportConfigurator config = DwcaTaxExportConfigurator.NewInstance(source, new File(destination), emlRecord);\r
\r
config.setDoTaxa(doTaxa);\r
config.setDoResourceRelation(doResourceRelation);\r
config.setDoDescription(doDescription);\r
config.setDoDistributions(doDistributions);\r
config.setDoImages(doImages);\r
+ config.setDoMetaData(doMetaData);\r
+ config.setDoEml(doEml);\r
config.setCheck(check);\r
+ config.setProgressMonitor(monitor);\r
+ config.setDefaultBibliographicCitation(defaultBibliographicCitation);\r
+ config.setDefaultTaxonSource(taxonSourceDefault);\r
+ monitor.beginTask("DwcA-Export", 10);\r
\r
+ config.setFeatureExclusions(featureExclusions);\r
// invoke import\r
CdmDefaultExport<DwcaTaxExportConfigurator> bmExport = new CdmDefaultExport<DwcaTaxExportConfigurator>();\r
boolean result = bmExport.invoke(config);\r
return result;\r
}\r
\r
- \r
- \r
+\r
+ private DwcaEmlRecord getEmlRecord() {\r
+ DwcaEmlRecord emlRecord = new DwcaEmlRecord();\r
+ emlRecord.setIdentifier("My Identifier");\r
+ emlRecord.setTitle("Cich DB");\r
+ emlRecord.setPublicationDate(new DateTime());\r
+ emlRecord.setExpectedCitation("Expected Citation");\r
+ emlRecord.setAbstractInfo("The abstract");\r
+ emlRecord.setAdditionalInformation("Add info");\r
+ emlRecord.setResourceLanguage(null);\r
+ emlRecord.setResourceUrl(URI.create("http://wp6-cichorieae.e-taxonomy.eu/portal/"));\r
+ emlRecord.setMetaDataLanguage(null);\r
+ emlRecord.setResourceLogoUri(null);\r
+ emlRecord.setCreativeCommonsLicensing(null);\r
+ emlRecord.setProjectTitle("Projekt tit");\r
+ emlRecord.setProjectLead("Proj Lead");\r
+ emlRecord.setProjectDescription("Proj Desc");\r
+ \r
+ Person person = Person.NewInstance();\r
+ Institution institution = Institution.NewInstance();\r
+ \r
+ InstitutionalMembership m = person.addInstitutionalMembership(institution, null, null, null);\r
+ emlRecord.setResourceCreator(m);\r
+ \r
+ return emlRecord;\r
+ }\r
+\r
+\r
/**\r
* @param args\r
*/\r