fix #9126 implement phenology import
authorAndreas Müller <a.mueller@bgbm.org>
Wed, 15 Jul 2020 12:04:16 +0000 (14:04 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Wed, 15 Jul 2020 12:19:32 +0000 (14:19 +0200)
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelFormatAnalyzer.java [new file with mode: 0644]
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImport.java [new file with mode: 0644]
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportConfigurator.java [new file with mode: 0644]
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportState.java [new file with mode: 0644]
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelFormatAnalyzer.java [new file with mode: 0644]
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImport.java [new file with mode: 0644]
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportConfigurator.java [new file with mode: 0644]
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportState.java [new file with mode: 0644]
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/Feature.java
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TemporalData.java

diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelFormatAnalyzer.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelFormatAnalyzer.java
new file mode 100644 (file)
index 0000000..fd0186b
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+* Copyright (C) 2020 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.fact.temporal.in;
+
+/**
+ * Analyzer for taxon based phenology import.
+ *
+ * TODO not yet implemented
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+public class PhenologyExcelFormatAnalyzer
+            extends TemporalDataExcelFormatAnalyzer<PhenologyExcelImportConfigurator> {
+
+    protected PhenologyExcelFormatAnalyzer(PhenologyExcelImportConfigurator config) {
+        super(config, requiredWorksheets(), requiredColumns(), optionalColumns(), optionalMultiColumns());
+    }
+
+    private static String[] requiredWorksheets() {
+        return new String[]{"Data","Vocabulary"};
+    }
+
+    private static String[] requiredColumns() {
+        return new String[]{"taxonUuid", "xxx", "xxx"};
+    }
+
+    private static String[] optionalColumns() {
+        return new String[]{"nameCache", "nameFullCache"};
+    }
+    private static String[] optionalMultiColumns() {
+        return new String[]{};
+    }
+
+
+}
diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImport.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImport.java
new file mode 100644 (file)
index 0000000..f667c9a
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+* 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.fact.temporal.in;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+
+/**
+ * Import for taxon based phenology data.
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+@Component
+public class PhenologyExcelImport
+        extends TemporalDataExcelImport<PhenologyExcelImportState, PhenologyExcelImportConfigurator>{
+
+    private static final long serialVersionUID = 1050528888222978429L;
+
+    public static final String FLOWERING_START = "Flowering start";
+    public static final String FLOWERING_END = "Flowering end";
+    public static final String FRUITING_START = "Fruiting start";
+    public static final String FRUITING_END = "Fruiting end";
+
+    @Override
+    protected void doFirstPass(PhenologyExcelImportState state, Taxon taxon,
+            String line, String linePure){
+
+        super.doFirstPass(state, taxon, line, linePure);
+
+        if (taxon == null){
+//            return;
+            taxon = Taxon.NewInstance(null, null);
+        }
+
+        Map<String, String> record = state.getOriginalRecord();
+
+        UUID uuidFeatureFruiting = state.getConfig().getFruitingFeatureUuid();
+        Feature featureFruiting = (Feature)getTermService().find(uuidFeatureFruiting);
+        String colFruitingStart = state.getConfig().getFruitingStartColumnLabel();
+        String colFruitingEnd = state.getConfig().getFruitingEndColumnLabel();
+
+        handleFeature(state, taxon, line, linePure, record, featureFruiting, colFruitingStart, colFruitingEnd);
+    }
+}
\ No newline at end of file
diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportConfigurator.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportConfigurator.java
new file mode 100644 (file)
index 0000000..79aabe7
--- /dev/null
@@ -0,0 +1,120 @@
+/**
+* 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.fact.temporal.in;
+
+import java.net.URI;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
+import eu.etaxonomy.cdm.model.description.Feature;
+
+/**
+ * Configurator for taxon based phenology import.
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+public class PhenologyExcelImportConfigurator
+        extends TemporalDataExcelImportConfigurator<PhenologyExcelFormatAnalyzer>{
+
+    private static final long serialVersionUID = 2413575026028295925L;
+
+    private String floweringStartColumnLabel = PhenologyExcelImport.FLOWERING_START;
+    private String floweringEndColumnLabel = PhenologyExcelImport.FLOWERING_END;
+    private String fruitingStartColumnLabel = PhenologyExcelImport.FRUITING_START;
+    private String fruitingEndColumnLabel = PhenologyExcelImport.FRUITING_END;
+
+    public static PhenologyExcelImportConfigurator NewInstance(URI uri, ICdmDataSource destination){
+        return new PhenologyExcelImportConfigurator(uri, destination, null);
+    }
+
+    private PhenologyExcelImportConfigurator(URI uri, ICdmDataSource destination, IInputTransformer transformer) {
+        super(uri, destination, transformer);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public PhenologyExcelImportState getNewState() {
+        return new PhenologyExcelImportState(this);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void makeIoClassList() {
+        ioClassList = new Class[]{
+                PhenologyExcelImport.class,
+        };
+    }
+
+    @Override
+    public PhenologyExcelFormatAnalyzer getAnalyzer() {
+        return new PhenologyExcelFormatAnalyzer(this);
+    }
+
+    @Override
+    //Used for flowering uuid
+    public UUID getFeatureUuid() {
+        return Feature.uuidFloweringPeriod;
+    }
+
+    public UUID getFruitingFeatureUuid() {
+        return Feature.uuidFruitingPeriod;
+    }
+
+    @Override
+    @Deprecated
+    public String getColumnLabelStart() {
+        return getFloweringStartColumnLabel();
+    }
+    @Override
+    @Deprecated
+    public void setColumnLabelStart(String columnLabelStart) {
+        setFloweringStartColumnLabel(columnLabelStart);
+    }
+
+    @Override
+    @Deprecated
+    public String getColumnLabelEnd() {
+        return getFloweringEndColumnLabel();
+    }
+    @Override
+    @Deprecated
+    public void setColumnLabelEnd(String columnLabelEnd) {
+        setFloweringEndColumnLabel(columnLabelEnd);
+    }
+
+    public String getFloweringStartColumnLabel() {
+        return floweringStartColumnLabel;
+    }
+    public void setFloweringStartColumnLabel(String floweringStartColumnLabel) {
+        this.floweringStartColumnLabel = floweringStartColumnLabel;
+    }
+
+    public String getFloweringEndColumnLabel() {
+        return floweringEndColumnLabel;
+    }
+    public void setFloweringEndColumnLabel(String floweringEndColumnLabel) {
+        this.floweringEndColumnLabel = floweringEndColumnLabel;
+    }
+
+    public String getFruitingStartColumnLabel() {
+        return fruitingStartColumnLabel;
+    }
+    public void setFruitingStartColumnLabel(String fruitingStartColumnLabel) {
+        this.fruitingStartColumnLabel = fruitingStartColumnLabel;
+    }
+
+    public String getFruitingEndColumnLabel() {
+        return fruitingEndColumnLabel;
+    }
+    public void setFruitingEndColumnLabel(String fruitingEndColumnLabel) {
+        this.fruitingEndColumnLabel = fruitingEndColumnLabel;
+    }
+}
diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportState.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportState.java
new file mode 100644 (file)
index 0000000..20896ca
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+* 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.fact.temporal.in;
+
+/**
+ * State for taxon based phenology import.
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+public class PhenologyExcelImportState
+        extends TemporalDataExcelImportState<PhenologyExcelImportConfigurator>{
+
+    public PhenologyExcelImportState(PhenologyExcelImportConfigurator config) {
+        super(config);
+    }
+}
diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelFormatAnalyzer.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelFormatAnalyzer.java
new file mode 100644 (file)
index 0000000..6bbbf0e
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+* Copyright (C) 2020 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.fact.temporal.in;
+
+import eu.etaxonomy.cdm.io.fact.altitude.in.analyze.ExcelFormatAnalyzer;
+
+/**
+ * Analyzer for taxon based temporal data import.
+ *
+ * TODO not yet implemented
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+public class TemporalDataExcelFormatAnalyzer<CONFIG extends TemporalDataExcelImportConfigurator<?>>
+            extends ExcelFormatAnalyzer<CONFIG> {
+
+    public TemporalDataExcelFormatAnalyzer(CONFIG config,
+            String[] requiredWorksheets,
+            String[] requiredColumns,
+            String[] optionalColumns,
+            String[] optionalMultiColumns) {
+        super(config, requiredWorksheets, requiredColumns, optionalColumns, optionalMultiColumns);
+    }
+
+    protected TemporalDataExcelFormatAnalyzer(CONFIG config) {
+        super(config, requiredWorksheets(), requiredColumns(), optionalColumns(), optionalMultiColumns());
+    }
+
+    private static String[] requiredWorksheets() {
+        return new String[]{"Data","Vocabulary"};
+    }
+
+    private static String[] requiredColumns() {
+        return new String[]{"taxonUuid", "xxx", "xxx"};
+    }
+
+    private static String[] optionalColumns() {
+        return new String[]{"nameCache", "nameFullCache"};
+    }
+    private static String[] optionalMultiColumns() {
+        return new String[]{};
+    }
+
+
+}
diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImport.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImport.java
new file mode 100644 (file)
index 0000000..5d18982
--- /dev/null
@@ -0,0 +1,145 @@
+/**
+* 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.fact.temporal.in;
+
+import java.util.Map;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase;
+import eu.etaxonomy.cdm.io.fact.in.FactExcelImportBase;
+import eu.etaxonomy.cdm.model.common.ExtendedTimePeriod;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.description.TemporalData;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+
+/**
+ * Import for taxon based temporal data.
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+@Component
+public class TemporalDataExcelImport<STATE extends TemporalDataExcelImportState<CONFIG>, CONFIG extends TemporalDataExcelImportConfigurator<?>>
+        extends FactExcelImportBase<STATE, CONFIG, ExcelRowBase>{
+
+    private static final long serialVersionUID = -2885338554616141176L;
+
+    @Override
+    protected String getWorksheetName(CONFIG config) {
+        return "Data";
+    }
+
+    @Override
+    protected void doFirstPass(STATE state, Taxon taxon,
+            String line, String linePure){
+
+        if (taxon == null){
+//            return;
+            taxon = Taxon.NewInstance(null, null);
+        }
+
+        Map<String, String> record = state.getOriginalRecord();
+
+        Feature feature = null;
+        UUID uuidFeature = state.getConfig().getFeatureUuid();
+        if (uuidFeature != null){
+            feature = (Feature)getTermService().find(uuidFeature);
+        }
+        if (feature == null){
+            String message = "Feature could not be defined. Import not possible.";
+            state.addError(message);
+            return;
+        }
+
+        String colLabelStart = state.getConfig().getColumnLabelStart();
+        String colLabelEnd = state.getConfig().getColumnLabelEnd();
+
+        handleFeature(state, taxon, line, linePure, record, feature, colLabelStart, colLabelEnd);
+
+    }
+
+    protected void handleFeature(STATE state, Taxon taxon, String line, String linePure,
+            Map<String, String> record, Feature feature, String startColLabel, String endColLabel) {
+
+        TemporalData temporalData = TemporalData.NewInstance(feature);
+        String startMonthStr = getValue(record, startColLabel);
+        String endMonthStr = getValue(record, endColLabel);
+        Integer startMonth = monthToInteger(state, startMonthStr, startColLabel, false);
+        Integer startMonthExtreme = monthToInteger(state, startMonthStr, startColLabel, true);
+        Integer endMonth = monthToInteger(state, endMonthStr, endColLabel, false);
+        Integer endMonthExtreme = monthToInteger(state, endMonthStr, endColLabel, true);
+        ExtendedTimePeriod period = ExtendedTimePeriod.NewExtendedMonthInstance(startMonth, endMonth, startMonthExtreme, endMonthExtreme);
+        temporalData.setPeriod(period);
+
+        //source
+        String id = null;
+        String idNamespace = getWorksheetName(state.getConfig());
+        Reference reference = getSourceReference(state);
+
+        //description
+        if (!temporalData.getPeriod().isEmpty()){
+            TaxonDescription taxonDescription = this.getTaxonDescription(taxon, reference, !IMAGE_GALLERY, true);
+            taxonDescription.addElement(temporalData);
+            temporalData.addImportSource(id, idNamespace, reference, linePure);
+        }
+    }
+
+    private Integer monthToInteger(STATE state, String monthStr, String colLabel, boolean isExtreme) {
+        if(StringUtils.isBlank(monthStr)){
+            return null;
+        }else {
+            Matcher matcher = getPattern().matcher(monthStr);
+            if (matcher.matches()){
+                if(isExtreme){
+                    if (matcher.group(2) != null){
+                        String extreme = matcher.group(2);
+                        return Integer.valueOf(extreme);
+                    }else{
+                        return null; //extreme value does not exist
+                    }
+                }else{
+                    String normal = matcher.group(1);
+                    return Integer.valueOf(normal);
+                }
+            }else{
+                if (!isExtreme){  //we have to record this only once
+                    String message = "Value " + monthStr + " for " + colLabel + " could not be transformed to a valid month number. Value not imported." ;
+                    state.addError(message);
+                }
+            }
+        }
+        return null;
+    }
+
+    private Pattern monthPattern;
+    private Pattern getPattern() {
+        if (monthPattern == null){
+            String nr = "(0?[1-9]|1[0-2])";
+            monthPattern = Pattern.compile(nr + "\\s*(?:\\(" + nr + "\\))?");
+        }
+        return monthPattern;
+    }
+
+    @Override
+    protected boolean requiresNomenclaturalCode() {
+        return false;
+    }
+
+    @Override
+    protected boolean isIgnore(STATE state) {
+        return false;
+    }
+}
\ No newline at end of file
diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportConfigurator.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportConfigurator.java
new file mode 100644 (file)
index 0000000..9b25369
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+* 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.fact.temporal.in;
+
+import java.net.URI;
+
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
+import eu.etaxonomy.cdm.io.fact.in.FactExcelImportConfiguratorBase;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+
+/**
+ * Configurator for taxon based temporal data import.
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+public class TemporalDataExcelImportConfigurator<ANALYZE extends TemporalDataExcelFormatAnalyzer<?>>
+        extends FactExcelImportConfiguratorBase<ANALYZE>{
+
+    private static final long serialVersionUID = 2413575026028295925L;
+
+    private String columnLabelStart = "Start";
+    private String columnLabelEnd = "End";
+
+    public static final TemporalDataExcelImportConfigurator<TemporalDataExcelFormatAnalyzer<?>> NewTemporalInstance(URI uri, ICdmDataSource destination){
+        return new TemporalDataExcelImportConfigurator<TemporalDataExcelFormatAnalyzer<?>>(uri, destination, null);
+    }
+
+    protected TemporalDataExcelImportConfigurator(URI uri, ICdmDataSource destination, IInputTransformer transformer) {
+        super(uri, destination, transformer);
+    }
+
+    @SuppressWarnings({ "unchecked" })
+    @Override
+    public TemporalDataExcelImportState<?> getNewState() {
+        return new TemporalDataExcelImportState<>(this);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void makeIoClassList() {
+        ioClassList = new Class[]{
+                TemporalDataExcelImport.class,
+        };
+    }
+
+    /**
+     * Note: This method needs to be overriden by potential subclasses.
+     */
+    @SuppressWarnings("unchecked")
+    @Override
+    public ANALYZE getAnalyzer() {
+        return (ANALYZE)new TemporalDataExcelFormatAnalyzer(this);
+    }
+
+    @Override
+    public NomenclaturalCode getNomenclaturalCode() {
+        NomenclaturalCode result = super.getNomenclaturalCode();
+        if (result == null){
+            result = NomenclaturalCode.ICNAFP;
+        }
+        return result;
+    }
+
+    public void setRowToNeglect(int row){
+
+    }
+
+    public String getColumnLabelStart() {
+        return columnLabelStart;
+    }
+    public void setColumnLabelStart(String columnLabelStart) {
+        this.columnLabelStart = columnLabelStart;
+    }
+
+    public String getColumnLabelEnd() {
+        return columnLabelEnd;
+    }
+    public void setColumnLabelEnd(String columnLabelEnd) {
+        this.columnLabelEnd = columnLabelEnd;
+    }
+
+}
diff --git a/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportState.java b/cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportState.java
new file mode 100644 (file)
index 0000000..d6d2b56
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+* 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.fact.temporal.in;
+
+import eu.etaxonomy.cdm.io.fact.in.FactExcelImportStateBase;
+
+/**
+ * State for taxon based temporal data import.
+ *
+ * @author a.mueller
+ * @since 15.07.2020
+ */
+public class TemporalDataExcelImportState<CONFIG extends TemporalDataExcelImportConfigurator>
+        extends FactExcelImportStateBase<CONFIG>{
+
+    public TemporalDataExcelImportState(CONFIG config) {
+        super(config);
+    }
+}
index 02df1566018ac724af34c171350b2a484de84070..c5fc88df1c21695befd49f80a9f86b454825e95e 100644 (file)
@@ -204,8 +204,8 @@ public class Feature extends DefinedTermBase<Feature> {
     private static final UUID uuidUseRecord = UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599");
     private static final UUID uuidNotes = UUID.fromString("b5780b45-6439-4f3c-9818-d89d26d36eb2");
     public static final UUID uuidLifeform = UUID.fromString("db9228d3-8bbf-4460-abfe-0b1326c82f8e");
-    private static final UUID uuidFloweringPeriod = UUID.fromString("03710cb5-606e-444a-a3e6-594268e3cc47");
-    private static final UUID uuidFruitingPeriod = UUID.fromString("04aa8993-24b4-43e3-888c-5afaa733376e");
+    public static final UUID uuidFloweringPeriod = UUID.fromString("03710cb5-606e-444a-a3e6-594268e3cc47");
+    public static final UUID uuidFruitingPeriod = UUID.fromString("04aa8993-24b4-43e3-888c-5afaa733376e");
     public static final UUID uuidAltitude = UUID.fromString("1a28ed59-e15f-4001-b5c2-ea89f0012671");
 
 /* ***************** CONSTRUCTOR AND FACTORY METHODS **********************************/
index 3b41dc00eaa80ad46ed308a7a8618ee2ed001848..4e0b3d45e9ceaf40b526ff3eee07190d1b02e1fa 100644 (file)
@@ -47,9 +47,8 @@ public class TemporalData extends DescriptionElementBase {
     @XmlElement(name = "Period")
     private ExtendedTimePeriod period = ExtendedTimePeriod.NewExtendedInstance();
 
-
     /**
-     * Creates a period fact with the given period.
+     * Creates a temporal fact with the given period.
      */
     public static TemporalData NewInstance(ExtendedTimePeriod period){
         TemporalData result = new TemporalData();
@@ -57,6 +56,19 @@ public class TemporalData extends DescriptionElementBase {
         return result;
     }
 
+    public static TemporalData NewInstance(Feature feature){
+        TemporalData result = new TemporalData();
+        result.setFeature(feature);
+        return result;
+    }
+
+    public static TemporalData NewInstance(Feature feature, ExtendedTimePeriod period){
+        TemporalData result = new TemporalData();
+        result.setFeature(feature);
+        result.setPeriod(period);
+        return result;
+    }
+
 // *************************** CONSTRUCTOR *************************************/
 
     /**