latest changes to Gabon and Guiana activators
[cdmlib-apps.git] / cdm-eflora / src / main / java / eu / etaxonomy / cdm / app / eflora / FloraGuianasActivator.java
index 8b0306e38f8dad9e9680c90bc21c639daebe87d4..1c8f1e0b0e8d9838e783903303b4045dff4f9209 100644 (file)
@@ -27,8 +27,8 @@ import eu.etaxonomy.cdm.io.common.events.IIoObserver;
 import eu.etaxonomy.cdm.io.common.events.LoggingIoObserver;\r
 import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;\r
 import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;\r
-import eu.etaxonomy.cdm.io.eflora.floraMalesiana.FloraMalesianaTransformer;\r
 import eu.etaxonomy.cdm.io.markup.MarkupImportConfigurator;\r
+import eu.etaxonomy.cdm.io.markup.MarkupTransformer;\r
 import eu.etaxonomy.cdm.model.description.Feature;\r
 import eu.etaxonomy.cdm.model.description.FeatureNode;\r
 import eu.etaxonomy.cdm.model.description.FeatureTree;\r
@@ -55,8 +55,8 @@ public class FloraGuianasActivator {
        \r
 //     static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_guianas_preview();\r
 //     static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_guianas_production();\r
-//     static final ICdmDataSource cdmDestination = CdmDestinations.localH2();\r
-       static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();\r
+       static final ICdmDataSource cdmDestination = CdmDestinations.localH2();\r
+//     static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();\r
        \r
 \r
        //feature tree uuid\r
@@ -65,6 +65,9 @@ public class FloraGuianasActivator {
        //classification\r
        static final UUID classificationUuid = UUID.fromString("5e3a1b07-2609-4597-bbda-7b02dfe8c2b3");\r
        \r
+       private static final String SOURCE_REFERENCE_TITLE = "Flora of the Guianas";\r
+       private static final String FEATURE_TREE_TITLE = "Flora of the Guianas Feature Tree";\r
+\r
        //check - import\r
        private boolean h2ForCheck = true;\r
        static CHECK check = CHECK.IMPORT_WITHOUT_CHECK;\r
@@ -80,7 +83,7 @@ public class FloraGuianasActivator {
        private boolean includeFgu4 = false;\r
        \r
                \r
-       private boolean replaceStandardKeyTitles = false;\r
+       private boolean replaceStandardKeyTitles = true;\r
 \r
        private IIoObserver observer = new LoggingIoObserver();\r
        private Set<IIoObserver> observerList = new HashSet<IIoObserver>();\r
@@ -104,7 +107,7 @@ public class FloraGuianasActivator {
                markupConfig.setReplaceStandardKeyTitles(replaceStandardKeyTitles);\r
                \r
                \r
-               markupConfig.setSourceReference(getSourceReference("Flore du Gabon"));\r
+               markupConfig.setSourceReference(getSourceReference(SOURCE_REFERENCE_TITLE));\r
                \r
                CdmDefaultImport<MarkupImportConfigurator> myImport = new CdmDefaultImport<MarkupImportConfigurator>(); \r
                \r
@@ -167,10 +170,10 @@ public class FloraGuianasActivator {
        }\r
 \r
        private FeatureTree makeFeatureNode(ITermService service){\r
-               FloraMalesianaTransformer transformer = new FloraMalesianaTransformer();\r
+               MarkupTransformer transformer = new MarkupTransformer();\r
                \r
                FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);\r
-               result.setTitleCache("Flore Gabon Presentation Feature Tree");\r
+               result.setTitleCache(FEATURE_TREE_TITLE);\r
                FeatureNode root = result.getRoot();\r
                FeatureNode newNode;\r
                \r
@@ -192,6 +195,12 @@ public class FloraGuianasActivator {
                newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());\r
                root.addChild(newNode);\r
 \r
+               newNode = FeatureNode.NewInstance(Feature.COMMON_NAME());\r
+               root.addChild(newNode);\r
+\r
+               newNode = FeatureNode.NewInstance(Feature.PHENOLOGY());\r
+               root.addChild(newNode);\r
+               \r
                newNode = FeatureNode.NewInstance(Feature.ECOLOGY());\r
                root.addChild(newNode);\r
                addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);\r
@@ -204,6 +213,14 @@ public class FloraGuianasActivator {
                newNode = FeatureNode.NewInstance(Feature.CITATION());\r
                root.addChild(newNode);\r
                \r
+               String sql = "\nSELECT feature.titleCache " +\r
+                               " FROM DescriptionElementBase deb INNER JOIN DefinedTermBase feature ON deb.feature_id = feature.id " + \r
+                               " GROUP BY feature.id " + \r
+                               " HAVING feature.id NOT IN (SELECT DISTINCT fn.feature_id " +\r
+                               " FROM FeatureNode fn " +\r
+                               " WHERE fn.feature_id IS NOT NULL) ";\r
+               logger.warn("Check for missing features in feature tree: " + sql);\r
+               \r
                return result;\r
        }\r
        \r
@@ -267,6 +284,7 @@ public class FloraGuianasActivator {
        \r
        private static String [] descriptionFeatureList = new String[]{\r
                "lifeform", \r
+               "Juvenile parts",\r
                "Bark",\r
                //new\r
                "wood",\r
@@ -283,10 +301,13 @@ public class FloraGuianasActivator {
                "Stems",  \r
                "stem leaves", \r
                "Leaves",\r
+               "extraxylary sclerenchyma",\r
                "flower-bearing stems",  \r
                "Petiole",  \r
                "Petiolules",  \r
                "Leaflets", \r
+               "Lamina",\r
+               "Veins",\r
                "Thyrsus",  \r
                "Thyrses",  \r
                "Inflorescences",  \r
@@ -294,8 +315,9 @@ public class FloraGuianasActivator {
                "Young inflorescences", \r
                "Male inflorescences", \r
                "Female inflorescences", \r
-               "Bracts",  \r
+               "rachises",\r
                "Pedicels",  \r
+               "Bracts",  \r
                "flowering buds",  \r
                "scales",  \r
                "Buds",  \r