Merge branch 'master' of ssh://dev.e-taxonomy.eu/var/git/cdmlib-apps
authora.mueller <a.mueller@bgbm.org>
Sun, 5 Apr 2020 06:19:13 +0000 (08:19 +0200)
committera.mueller <a.mueller@bgbm.org>
Sun, 5 Apr 2020 06:19:13 +0000 (08:19 +0200)
app-import/src/main/java/eu/etaxonomy/cdm/app/greece/GreeceGenusAuthorActivator.java
app-import/src/main/java/eu/etaxonomy/cdm/app/greece/GreeceStatusUpdaterActivator.java [new file with mode: 0644]
app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceGenusAuthorImport.java
app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceGenusAuthorImportConfigurator.java
app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceStatusUpdaterConfigurator.java [new file with mode: 0644]
app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceStatusUpdaterImport.java [new file with mode: 0644]
app-import/src/main/java/eu/etaxonomy/cdm/io/lichenes/LichenesGeneraTaxonImport.java

index e38b2ca0edb7ca7a87e95a331a8c111a9d9e050c..c31973119c3e610e1cfbf919474c6f86b05de922 100644 (file)
@@ -28,9 +28,9 @@ import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
 /**
  * @author a.mueller
  * @since 08.12.2017
- *
  */
 public class GreeceGenusAuthorActivator {
+       
     @SuppressWarnings("unused")
     private static final Logger logger = Logger.getLogger(GreeceGenusAuthorActivator.class);
 
@@ -65,12 +65,10 @@ public class GreeceGenusAuthorActivator {
 
     }
 
-
     private URI greekChecklist(){
         return URI.create("file:////BGBM-PESIHPC/Greece/" + fileName);
     }
 
-
     private Reference getSourceReference(){
         Reference result = ReferenceFactory.newDatabase();
         result.setTitle(fileName);
@@ -79,14 +77,9 @@ public class GreeceGenusAuthorActivator {
         return result;
     }
 
-    /**
-     * @param args
-     */
     public static void main(String[] args) {
         GreeceGenusAuthorActivator me = new GreeceGenusAuthorActivator();
         me.doImport(cdmDestination);
         System.exit(0);
     }
-
-
 }
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/app/greece/GreeceStatusUpdaterActivator.java b/app-import/src/main/java/eu/etaxonomy/cdm/app/greece/GreeceStatusUpdaterActivator.java
new file mode 100644 (file)
index 0000000..29aeb96
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.app.greece;
+
+import java.net.URI;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+
+import eu.etaxonomy.cdm.app.common.CdmDestinations;
+import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
+import eu.etaxonomy.cdm.io.common.ImportResult;
+import eu.etaxonomy.cdm.io.greece.GreeceStatusUpdaterConfigurator;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
+
+/**
+ * @author a.mueller
+ * @since 08.12.2017
+ */
+public class GreeceStatusUpdaterActivator {
+       
+    @SuppressWarnings("unused")
+    private static final Logger logger = Logger.getLogger(GreeceStatusUpdaterActivator.class);
+
+    static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
+//  static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
+//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_greece_checklist();
+
+    private static final UUID sourceUuid = UUID.fromString("7f898cf8-5eef-4321-ba17-64983cf7ea26");
+    private static final String fileName = "xxx.xlsx";
+
+
+    //check - import
+    static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
+
+    private void doImport(ICdmDataSource cdmDestination){
+
+        DbSchemaValidation schemaVal = cdmDestination.getDatabaseType() == DatabaseTypeEnum.H2 ? DbSchemaValidation.CREATE : DbSchemaValidation.VALIDATE;
+        URI source = greekChecklist();  //just any
+        //make Source
+        GreeceStatusUpdaterConfigurator config = GreeceStatusUpdaterConfigurator.NewInstance(source, cdmDestination);
+        config.setCheck(check);
+        config.setDbSchemaValidation(schemaVal);
+        config.setSourceReference(getSourceReference());
+        config.setNomenclaturalCode(NomenclaturalCode.ICNAFP);
+
+        CdmDefaultImport<GreeceStatusUpdaterConfigurator> myImport = new CdmDefaultImport<>();
+        ImportResult result = myImport.invoke(config);
+        System.out.println(result.createReport());
+
+    }
+
+    private URI greekChecklist(){
+        return URI.create("file:////BGBM-PESIHPC/Greece/" + fileName);
+    }
+
+    private Reference getSourceReference(){
+        Reference result = ReferenceFactory.newDatabase();
+        result.setTitle(fileName);
+        result.setUuid(sourceUuid);
+
+        return result;
+    }
+
+    public static void main(String[] args) {
+        GreeceStatusUpdaterActivator me = new GreeceStatusUpdaterActivator();
+        me.doImport(cdmDestination);
+        System.exit(0);
+    }
+}
index 0f0c0793be19f0541d2df790fc6f9ac68d87aec4..3b51ad73b3f5632e57823b741a17f0204b502356 100644 (file)
@@ -24,22 +24,17 @@ import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
 /**
  * @author a.mueller
  * @since 08.12.2017
- *
  */
 @Component
 public class GreeceGenusAuthorImport
-    extends SimpleExcelTaxonImport<GreeceGenusAuthorImportConfigurator>{
+       extends SimpleExcelTaxonImport<GreeceGenusAuthorImportConfigurator>{
 
+       private static final long serialVersionUID = 1173327042682886814L;
     private static final Logger logger = Logger.getLogger(GreeceGenusAuthorImport.class);
 
-    private static final long serialVersionUID = 1173327042682886814L;
-    private ImportDeduplicationHelper<SimpleExcelTaxonImportState> dedupHelper;
+    private ImportDeduplicationHelper<SimpleExcelTaxonImportState<?>> dedupHelper;
     private NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance();
 
-
-    /**
-     * {@inheritDoc}
-     */
     @Override
     protected void firstPass(SimpleExcelTaxonImportState<GreeceGenusAuthorImportConfigurator> state) {
         String genus = state.getOriginalRecord().get("Genus");
@@ -56,23 +51,15 @@ public class GreeceGenusAuthorImport
                 getDedupHelper(state).replaceAuthorNamesAndNomRef(state, name);
                 name.addImportSource(null, null, state.getConfig().getSourceReference(), String.valueOf(state.getCurrentLine()));
             } catch (StringNotParsableException e) {
-                // TODO Auto-generated catch block
                 e.printStackTrace();
-//                throw new RuntimeException(e);
             }
         }
-
     }
 
-    /**
-     * @param state
-     * @return
-     */
-    private ImportDeduplicationHelper<SimpleExcelTaxonImportState> getDedupHelper(SimpleExcelTaxonImportState<GreeceGenusAuthorImportConfigurator> state) {
+    private ImportDeduplicationHelper<SimpleExcelTaxonImportState<?>> getDedupHelper(SimpleExcelTaxonImportState<GreeceGenusAuthorImportConfigurator> state) {
         if (this.dedupHelper == null){
             dedupHelper = ImportDeduplicationHelper.NewInstance(this, state);
         }
         return this.dedupHelper;
     }
-
-}
+}
\ No newline at end of file
index ec9984217206b548af97f026ee1b50c30e1d5236..76af71bdc8b69d10294d053ac67b06d6ecafceac 100644 (file)
@@ -18,10 +18,9 @@ import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
 /**
  * @author a.mueller
  * @since 08.12.2017
- *
  */
 public class GreeceGenusAuthorImportConfigurator
-    extends ExcelImportConfiguratorBase{
+       extends ExcelImportConfiguratorBase{
 
     private static final long serialVersionUID = 2036787279608394173L;
 
@@ -29,10 +28,6 @@ public class GreeceGenusAuthorImportConfigurator
         return new GreeceGenusAuthorImportConfigurator(source, destination);
     }
 
-    /**
-     * @param uri
-     * @param destination
-     */
     protected GreeceGenusAuthorImportConfigurator(URI uri, ICdmDataSource destination) {
         super(uri, destination);
     }
@@ -43,14 +38,11 @@ public class GreeceGenusAuthorImportConfigurator
         return new SimpleExcelTaxonImportState<>(this);
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
+    @SuppressWarnings("unchecked")
+       @Override
     protected void makeIoClassList() {
         ioClassList = new Class[]{
                 GreeceGenusAuthorImport.class,
         };
     }
-
-}
+}
\ No newline at end of file
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceStatusUpdaterConfigurator.java b/app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceStatusUpdaterConfigurator.java
new file mode 100644 (file)
index 0000000..c718c4e
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.io.greece;
+
+import java.net.URI;
+
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.io.common.ImportStateBase;
+import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
+import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
+
+/**
+ * @author a.mueller
+ * @since 08.12.2017
+ */
+public class GreeceStatusUpdaterConfigurator
+       extends ExcelImportConfiguratorBase{
+
+    private static final long serialVersionUID = 2036787279608394173L;
+
+    public static GreeceStatusUpdaterConfigurator NewInstance(URI source, ICdmDataSource destination) {
+        return new GreeceStatusUpdaterConfigurator(source, destination);
+    }
+
+    protected GreeceStatusUpdaterConfigurator(URI uri, ICdmDataSource destination) {
+        super(uri, destination);
+    }
+
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @Override
+    public ImportStateBase getNewState() {
+        return new SimpleExcelTaxonImportState<>(this);
+    }
+
+    @SuppressWarnings("unchecked")
+       @Override
+    protected void makeIoClassList() {
+        ioClassList = new Class[]{
+                       GreeceStatusUpdaterImport.class,
+        };
+    }
+}
diff --git a/app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceStatusUpdaterImport.java b/app-import/src/main/java/eu/etaxonomy/cdm/io/greece/GreeceStatusUpdaterImport.java
new file mode 100644 (file)
index 0000000..4608ae6
--- /dev/null
@@ -0,0 +1,222 @@
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.cdm.io.greece;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImport;
+import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.CategoricalData;
+import eu.etaxonomy.cdm.model.description.Distribution;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
+import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+
+/**
+ * @author a.mueller
+ * @since 08.12.2017
+ */
+@Component
+public class GreeceStatusUpdaterImport
+       extends SimpleExcelTaxonImport<GreeceStatusUpdaterConfigurator>{
+
+    private static final UUID UUID_STATE_ALIEN_ESTABLISHED = UUID.fromString("0df082b1-d38a-455e-9406-8d5ca58c1df9");
+    private static final UUID UUID_STATE_ALIEN_NON_ESTABLISHED = UUID.fromString("0642289d-3f7a-408f-b84f-335fb720d952");
+    private static final UUID UUID_STATE_DOUBT_ALIEN_ESTABLISHEMENT_UNKNOWN = UUID.fromString("d2ff3b0c-d8b2-4f0c-9ed9-12455e22fb17");
+    private static final UUID UUID_STATE_NATIVE_RANGE_RESTRICTED = UUID.fromString("6a646be7-df29-4594-93bb-af3fa1c83c72");
+    private static final UUID UUID_STATE_NATIVE_NON_RANGE_RESTRICTED = UUID.fromString("fbfa2d04-5d3b-4e22-8c6e-6d1cb9902141");
+    private static final UUID UUID_STATE_NATIVE_RANGE_RESTRICTION_UNKNWON = UUID.fromString("711d62a8-0763-4cd1-902a-f340612f8e8b");
+    private static final UUID UUID_STATE_DOUBT_NATIVE_NON_RANGE_RESTRICTED = UUID.fromString("7291a253-3020-4207-807c-4dacae486b4e");
+
+    private static final UUID UUID_IUCN_FEATURE = UUID.fromString("fc2b07a7-febe-4f8a-8713-da198e19bd69");
+    private static final UUID UUID_IUCN_EXTINCT = UUID.fromString("4e2244ca-5858-4efb-9a24-57d18a24f1ef");
+    private static final UUID UUID_IUCN_CRITICALLY_ENDANGERED = UUID.fromString("cbbde993-1acc-4dfb-bc3c-4f3a11592d3d");
+    private static final UUID UUID_IUCN_ENDANGERED = UUID.fromString("39b0d998-9e4b-4ee6-990a-0b8b334f1c4d");
+    private static final UUID UUID_IUCN_VULNERABLE = UUID.fromString("bd116f8d-2b1f-489b-9ba6-690fed6088aa");
+    private static final UUID UUID_IUCN_NEAR_THREATENED = UUID.fromString("acb4f244-9fe0-4bcb-91e2-e9237c4f8165");
+    private static final UUID UUID_IUCN_LEAST_CONCERN = UUID.fromString("40656435-0749-4ea6-ad10-071d8eddc332");
+    private static final UUID UUID_IUCN_DATA_DEFICIENT = UUID.fromString("43518936-4bae-4fbc-a69b-5ccde7849bb3");
+    private static final UUID UUID_IUCN_NOT_EVALUATED = UUID.fromString("ac0f2fe8-a7c9-4724-9d2e-cbe3d213d5d4");
+
+
+    private static final UUID UUID_PD_FEATURE = UUID.fromString("3b08be3b-e3cc-41f2-8784-87414679f87d");
+    private static final UUID UUID_PD_NO = UUID.fromString("7ba99117-fadc-40fe-8961-3f805ec8035a");
+    private static final UUID UUID_PD_YES = UUID.fromString("60a5b995-b497-4813-9e7f-c1a49333b84f");
+    private static final String PRESIDENTIAL_DECREE_67_81 = "Presidential Decree 67/81";
+    private static final String STATUS = "Status";
+    private static final String ESTABLISHMENT = "Establishment";
+    private static final String RANGE_RESTRICTION = "Range-restriction";
+    private static final String REDLIST_CATEGORY = "IUCN RedlistCategory";
+    private static final String SCIENTIFIC_NAME = "scientificName";
+    private static final String TAXON_UUID = "taxon uid";
+    private static final long serialVersionUID = 1017757693469612631L;
+       private static final Logger logger = Logger.getLogger(GreeceStatusUpdaterImport.class);
+
+    @Override
+    protected void firstPass(SimpleExcelTaxonImportState<GreeceStatusUpdaterConfigurator> state) {
+
+       Map<String, String> record = state.getOriginalRecord();
+       String line = "line" + state.getCurrentLine() + ": ";
+
+       UUID taxonUuid = UUID.fromString(getValue(record, TAXON_UUID));
+       TaxonBase<?> taxonBase = getTaxonService().find(taxonUuid);
+       if (taxonBase == null) {
+               logger.warn(line+"no taxon " + taxonUuid);
+               return;
+       }else if (!taxonBase.isInstanceOf(Taxon.class)) {
+               logger.warn(line + "is not accepted " + taxonUuid);
+               return;
+       }
+       if(!checkTaxonName(state, taxonBase, line)) {
+               return;
+       }
+       Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
+
+       //delete absent distribution status
+       Set<Distribution> distributions = taxon.getDescriptionItems(Feature.DISTRIBUTION(), Distribution.class);
+       for (Distribution distribution : distributions) {
+           if (PresenceAbsenceTerm.ABSENT().equals(distribution.getStatus())) {
+               logger.info("Remove distribution");
+               distribution.getInDescription().removeElement(distribution);
+           }
+       }
+
+       //delete old status
+       Set<CategoricalData> statuss = taxon.getDescriptionItems(Feature.STATUS(), CategoricalData.class);
+        for (CategoricalData status : statuss) {
+            if (Feature.uuidStatus.equals(status.getFeature().getUuid())) {
+                logger.info("Remove status");
+                status.getInDescription().removeElement(status);
+            }
+        }
+
+        //new data
+        TaxonDescription newDescription = TaxonDescription.NewInstance(taxon);
+        String redListCategoryStr = getValue(record, REDLIST_CATEGORY);
+        String presidentialDecreeStr = getValue(record, PRESIDENTIAL_DECREE_67_81);
+        String statusStr = getValue(record, STATUS);
+        String establishmentStr = getValue(record, ESTABLISHMENT);
+        String rangeRestrictionStr = getValue(record, RANGE_RESTRICTION);
+
+        CategoricalData presidentialDecree = getPresidentialDecree(state, line, presidentialDecreeStr);
+        CategoricalData redListCategory = getRedListCategory(state, line, redListCategoryStr);
+        CategoricalData newStatus = getNewStatus(state, line, statusStr, establishmentStr, rangeRestrictionStr);
+        newDescription.addElement(presidentialDecree);
+        newDescription.addElement(redListCategory);
+        newDescription.addElement(newStatus);
+    }
+
+    private CategoricalData getNewStatus(SimpleExcelTaxonImportState<GreeceStatusUpdaterConfigurator> state,
+            String line, String statusStr, String establishmentStr, String rangeRestrictionStr) {
+
+        CategoricalData result;
+        State state2;
+        Feature stateFeature = Feature.STATUS();
+        if ("Alien".equalsIgnoreCase(statusStr) || "? Alien".equalsIgnoreCase(statusStr)) {
+            if("Established".equalsIgnoreCase(establishmentStr)) {
+                state2 = getStateTerm(state, UUID_STATE_ALIEN_ESTABLISHED);
+            }else if("Non-established".equalsIgnoreCase(establishmentStr)) {
+                state2 = getStateTerm(state, UUID_STATE_ALIEN_NON_ESTABLISHED);
+            }else if("Establishment unknown".equalsIgnoreCase(establishmentStr)) {
+                state2 = getStateTerm(state, UUID_STATE_DOUBT_ALIEN_ESTABLISHEMENT_UNKNOWN);
+            }else{
+                logger.warn(line+"Establishement not recognized: " + establishmentStr);
+                state2 = null;
+            }
+        }else if ("Native".equalsIgnoreCase(statusStr)) {
+            if("Range-Restricted".equalsIgnoreCase(rangeRestrictionStr)) {
+                state2 = getStateTerm(state, UUID_STATE_NATIVE_RANGE_RESTRICTED);
+            }else if("Non Range-Restricted".equalsIgnoreCase(rangeRestrictionStr)) {
+                state2 = getStateTerm(state, UUID_STATE_NATIVE_NON_RANGE_RESTRICTED);
+            }else if("Range-Restriction unknown".equalsIgnoreCase(rangeRestrictionStr)) {
+                state2 = getStateTerm(state, UUID_STATE_NATIVE_RANGE_RESTRICTION_UNKNWON);
+            }else{
+                logger.warn(line+"Range restricted not recognized: " + rangeRestrictionStr);
+                state2 = null;
+            }
+        }else if ("? Native".equalsIgnoreCase(statusStr)) {
+            if("Non Range-Restricted".equalsIgnoreCase(rangeRestrictionStr)) {
+                state2 = getStateTerm(state, UUID_STATE_DOUBT_NATIVE_NON_RANGE_RESTRICTED);
+            }else{
+                logger.warn(line+"Range restricted for doubtful native not recognized: " + rangeRestrictionStr);
+                state2 = null;
+            }
+        }else {
+            logger.warn(line+"Red list category not recognized: " + statusStr);
+            state2 = null;
+        }
+        result = CategoricalData.NewInstance(state2, stateFeature);
+        return result;
+    }
+
+    private CategoricalData getRedListCategory(SimpleExcelTaxonImportState<GreeceStatusUpdaterConfigurator> state,
+            String line, String redListCategoryStr) {
+        CategoricalData result;
+        State state2;
+        Feature redListCategoryFeature = getFeature(state, UUID_IUCN_FEATURE);
+        if ("Extinct".equals(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_EXTINCT);
+        }else if ("Critically Endangered".equalsIgnoreCase(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_CRITICALLY_ENDANGERED);
+        }else if ("Endangered".equalsIgnoreCase(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_ENDANGERED);
+        }else if ("Vulnerable".equalsIgnoreCase(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_VULNERABLE);
+        }else if ("Near Threatened".equalsIgnoreCase(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_NEAR_THREATENED);
+        }else if ("Least Concern".equalsIgnoreCase(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_LEAST_CONCERN);
+        }else if ("Data Deficient".equalsIgnoreCase(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_DATA_DEFICIENT);
+        }else if ("Not Evaluated".equalsIgnoreCase(redListCategoryStr)) {
+            state2 = getStateTerm(state, UUID_IUCN_NOT_EVALUATED);
+        }else {
+            logger.warn(line+"Red list category not recognized: " + redListCategoryStr);
+            state2 = null;
+        }
+        result = CategoricalData.NewInstance(state2, redListCategoryFeature);
+        return result;
+    }
+
+    private CategoricalData getPresidentialDecree(SimpleExcelTaxonImportState<GreeceStatusUpdaterConfigurator> state,
+            String line, String presidentialDecreeStr) {
+        CategoricalData result;
+        State state2;
+        Feature presidentialDecreeFature = getFeature(state, UUID_PD_FEATURE);
+        if ("No".equals(presidentialDecreeStr)) {
+            state2 = getStateTerm(state, UUID_PD_NO);
+        }else if ("Yes".equalsIgnoreCase(presidentialDecreeStr)) {
+            state2 = getStateTerm(state, UUID_PD_YES);
+        }else {
+            logger.warn(line+"PresidentialDegree not recognized: " + presidentialDecreeStr);
+            state2 = null;
+        }
+        result = CategoricalData.NewInstance(state2, presidentialDecreeFature);
+        return result;
+    }
+
+    private boolean checkTaxonName(SimpleExcelTaxonImportState<GreeceStatusUpdaterConfigurator> state,
+                       TaxonBase<?> taxonBase, String line) {
+               String nameStr = getValue(state.getOriginalRecord(), SCIENTIFIC_NAME);
+               boolean equals = (nameStr.equals(taxonBase.getName().getTitleCache()));
+               if (!equals) {
+                   logger.warn(line + "Name does not match: " + nameStr + "<->" + taxonBase.getName().getTitleCache());
+               }
+               return true;
+       }
+}
index 93c4d60df71a67177db1f5bc695ed14bedf4451c..bcc62cee654a2ca1df55d5aa2f584cef7f3d9f39 100644 (file)
@@ -163,7 +163,7 @@ public class LichenesGeneraTaxonImport<CONFIG extends LichenesGeneraImportConfig
        String notesStr = getValue(record, "NOTES");
        if (isNotBlank(notesStr)) {
                if (notesStr.startsWith("Notes.")) {
-                       notesStr = notesStr.substring(6);
+                       notesStr = notesStr.substring(6).trim();
                }
                //TODO or handle as fact of type "Notes"
                genusTaxon.addAnnotation(Annotation.NewInstance(notesStr, AnnotationType.EDITORIAL(), Language.ENGLISH()));