UUIDs changed in FaEu database. Changed hard coded uuid accordingly.
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / faunaEuropaea / FaunaEuropaeaRelTaxonIncludeImport.java
index 43348dd19eed3fa8aac3000a94344d72d40eab87..0e5c266ad91d7fcae4c14d1616521634c41f7170 100644 (file)
@@ -49,7 +49,9 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
        \r
        public static final String OS_NAMESPACE_TAXON = "Taxon";\r
        private static final Logger logger = Logger.getLogger(FaunaEuropaeaRelTaxonIncludeImport.class);\r
+       private static final String acceptedTaxonUUID = "A9C24E42-69F5-4681-9399-041E652CF338"; // any accepted taxon uuid, taken from original fauna europaea database\r
        \r
+       private ReferenceBase<?> sourceRef;\r
        private static String ALL_SYNONYM_FROM_CLAUSE = " FROM Taxon INNER JOIN Taxon AS Parent " +\r
        " ON Taxon.TAX_TAX_IDPARENT = Parent.TAX_ID " +\r
        " WHERE (Taxon.TAX_VALID = 0) " +\r
@@ -94,9 +96,7 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
                boolean success = true;\r
 \r
                Map<String, MapWrapper<? extends CdmBase>> stores = state.getStores();\r
-               MapWrapper<TaxonBase> taxonStore = (MapWrapper<TaxonBase>)stores.get(ICdmIO.TAXON_STORE);\r
-//             taxonStore.makeEmpty();\r
-               taxonStore = null;\r
+\r
                MapWrapper<TeamOrPersonBase> authorStore = (MapWrapper<TeamOrPersonBase>)stores.get(ICdmIO.TEAM_STORE);\r
                authorStore.makeEmpty();\r
 \r
@@ -104,28 +104,29 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
 \r
                TransactionStatus txStatus = startTransaction();\r
                \r
-               TaxonBase taxon = getTaxonService().find(UUID.fromString("ac7b30dc-6207-4c71-9752-ee0fb838a271"));\r
-               ReferenceBase<?> sourceRef = taxon.getSec();\r
+               // the uuid of an accepted taxon is needed here. any accepted taxon will do.\r
+               TaxonBase taxon = getTaxonService().find(UUID.fromString(acceptedTaxonUUID));\r
+               sourceRef = taxon.getSec();\r
 \r
                TaxonomicTree tree = getTaxonomicTreeFor(state, sourceRef);\r
                commitTransaction(txStatus);\r
                \r
-               ProfilerController.memorySnapshot();\r
+               //ProfilerController.memorySnapshot();\r
                if (state.getConfig().isDoTaxonomicallyIncluded()) {\r
                        success = processParentsChildren(state);\r
                }\r
-               ProfilerController.memorySnapshot();\r
+               //ProfilerController.memorySnapshot();\r
                if (state.getConfig().isDoMisappliedNames()) {\r
                        success = processMisappliedNames(state);\r
                }\r
-               ProfilerController.memorySnapshot();\r
+               //ProfilerController.memorySnapshot();\r
                if (state.getConfig().isDoHeterotypicSynonyms()) {\r
                        if(logger.isInfoEnabled()) { \r
                                logger.info("Start making heterotypic synonym relationships..."); \r
                        }\r
                        success = processHeterotypicSynonyms(state, ALL_SYNONYM_FROM_CLAUSE);\r
                }\r
-               ProfilerController.memorySnapshot();\r
+               //ProfilerController.memorySnapshot();\r
 \r
                logger.info("End making taxa...");\r
 \r
@@ -223,8 +224,8 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
                }\r
                return success;         \r
        }\r
-\r
        \r
+\r
        /** Retrieve misapplied name / accepted taxon uuid map from CDM DB */\r
        private boolean processMisappliedNames(FaunaEuropaeaImportState state) {\r
 \r
@@ -319,6 +320,7 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
        }\r
 \r
 \r
+\r
        /** Retrieve synonyms from FauEuDB DB */\r
        private boolean processHeterotypicSynonyms(FaunaEuropaeaImportState state, String fromClause) {\r
 \r
@@ -362,6 +364,8 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
                }\r
                return success;         \r
        }\r
+       \r
+       \r
 \r
        \r
        private boolean storeSynonymRelationships(ResultSet rs, int count, FaunaEuropaeaImportState state) \r
@@ -416,13 +420,16 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
        }\r
        \r
        \r
+       \r
+       \r
+\r
        /* Creates parent-child relationships.\r
         * Parent-child pairs are retrieved in blocks via findByUUID(Set<UUID>) from CDM DB. \r
         */\r
        private boolean createParentChildRelationships(FaunaEuropaeaImportState state, Map<UUID, UUID> childParentMap) {\r
-\r
-               TaxonBase taxon = getTaxonService().find(UUID.fromString("ac7b30dc-6207-4c71-9752-ee0fb838a271"));\r
-               ReferenceBase<?> sourceRef = taxon.getSec();\r
+               //gets the taxon "Hydroscaphidae"(family)\r
+               TaxonBase taxon = getTaxonService().find(UUID.fromString(acceptedTaxonUUID));\r
+               sourceRef = taxon.getSec();\r
                boolean success = true;\r
                int limit = state.getConfig().getLimitSave();\r
                \r
@@ -539,8 +546,10 @@ public class FaunaEuropaeaRelTaxonIncludeImport extends FaunaEuropaeaImportBase
         */\r
        private boolean createMisappliedNameRelationships(FaunaEuropaeaImportState state, Map<UUID, UUID> fromToMap) {\r
 \r
-               TaxonBase taxon = getTaxonService().find(UUID.fromString("ac7b30dc-6207-4c71-9752-ee0fb838a271"));\r
-               ReferenceBase<?> sourceRef = taxon.getSec();\r
+               //gets the taxon "Hydroscaphidae" (family)\r
+               \r
+               TaxonBase taxon = getTaxonService().find(UUID.fromString(acceptedTaxonUUID));\r
+               sourceRef = taxon.getSec();\r
                boolean success = true;\r
                int limit = state.getConfig().getLimitSave();\r
                \r