This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/sis.git
commit d4690f7f41a20128f65257cf5d092aafd27f7823 Merge: 6e63051a6f 06e105fa45 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Jun 7 12:34:40 2024 +0200 Merge branch 'geoapi-3.1'. .../apache/sis/metadata/iso/DefaultMetadata.java | 32 ++++++-- .../sis/metadata/iso/acquisition/DefaultEvent.java | 35 ++++++-- .../iso/acquisition/DefaultRequestedDate.java | 50 +++++++++++- .../iso/acquisition/DefaultRequirement.java | 25 +++++- .../sis/metadata/iso/acquisition/package-info.java | 1 + .../sis/metadata/iso/citation/DefaultCitation.java | 26 +++++- .../metadata/iso/citation/DefaultCitationDate.java | 47 ++++++++--- .../sis/metadata/iso/citation/package-info.java | 1 + .../distribution/DefaultStandardOrderProcess.java | 40 +++++++++- .../metadata/iso/distribution/package-info.java | 2 +- .../metadata/iso/identification/DefaultUsage.java | 93 +++++++++++++++++++--- .../sis/metadata/iso/quality/AbstractResult.java | 6 +- .../sis/pending/temporal/TemporalUtilities.java | 8 +- .../apache/sis/metadata/TreeNodeChildrenTest.java | 5 +- .../iso/citation/DefaultCitationDateTest.java | 8 +- .../metadata/iso/citation/DefaultCitationTest.java | 15 ++-- .../DefaultDataIdentificationTest.java | 5 +- .../sis/xml/test/AnnotationConsistencyCheck.java | 7 ++ .../sis/storage/netcdf/MetadataReaderTest.java | 32 ++++++-- .../apache/sis/storage/netcdf/NetcdfStoreTest.java | 2 +- .../main/org/apache/sis/storage/gpx/Copyright.java | 12 ++- .../apache/sis/storage/base/MetadataBuilder.java | 2 +- .../main/org/apache/sis/io/CompoundFormat.java | 66 +++++++++++++-- .../sis/util/collection/TreeTableFormat.java | 7 +- 24 files changed, 439 insertions(+), 88 deletions(-) diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/DefaultMetadata.java index b7340ebbeb,bb0f817aff..d5876d71b9 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/DefaultMetadata.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/DefaultMetadata.java @@@ -358,10 -354,30 +360,30 @@@ public class DefaultMetadata extends IS * @param contact party responsible for the metadata information. * @param dateStamp date that the metadata was created. * @param identificationInfo basic information about the resource to which the metadata applies. + * + * @deprecated Replaced by {@link #DefaultMetadata(ResponsibleParty, Temporal, Identification)}. */ + @Deprecated(since="1.5", forRemoval=true) public DefaultMetadata(final ResponsibleParty contact, - final Date dateStamp, - final Identification identificationInfo) + final Date dateStamp, + final Identification identificationInfo) + { + this(contact, TemporalDate.toTemporal(dateStamp), identificationInfo); + } + + /** + * Creates a meta data initialized to the specified values. + * + * @param contact party responsible for the metadata information. + * @param dateStamp date that the metadata was created. + * @param identificationInfo basic information about the resource to which the metadata applies. + * + * @since 1.5 + */ + @SuppressWarnings("this-escape") + public DefaultMetadata(final ResponsibleParty contact, + final Temporal dateStamp, + final Identification identificationInfo) { this.contacts = singleton(contact, ResponsibleParty.class); this.identificationInfo = singleton(identificationInfo, Identification.class); diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java index f318350ada,3f61f355ef..1b72a5ab4d --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/acquisition/DefaultEvent.java @@@ -33,6 -33,6 +33,11 @@@ import org.opengis.metadata.acquisition import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.util.privy.TemporalDate; ++// Specific to the main branch: ++import org.opengis.annotation.UML; ++import static org.opengis.annotation.Obligation.MANDATORY; ++import static org.opengis.annotation.Specification.ISO_19115_2; ++ /** * Identification of a significant collection point within an operation. @@@ -274,9 -272,25 +277,25 @@@ public class DefaultEvent extends ISOMe * Sets the time the event occurred. * * @param newValue the new time value. + * + * @deprecated Replaced by {@link #setDateOfOccurrence(Temporal)}. */ + @Deprecated(since="1.5") public void setTime(final Date newValue) { - setTime(TemporalDate.toTemporal(newValue)); + setDateOfOccurrence(TemporalDate.toTemporal(newValue)); + } + + /** + * Returns the time the event occurred. + * + * @return time the event occurred, or {@code null}. + * + * @since 1.5 + */ - @Override + @XmlElement(name = "time", required = true) ++ @UML(identifier="time", obligation=MANDATORY, specification=ISO_19115_2) + public Temporal getDateOfOccurrence() { + return time; } /** diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java index 42b24c4042,2db4683608..107f978fea --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java @@@ -27,6 -27,6 +27,11 @@@ import org.apache.sis.metadata.TitlePro import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.util.privy.TemporalDate; ++// Specific to the main branch: ++import org.opengis.annotation.UML; ++import static org.opengis.annotation.Obligation.MANDATORY; ++import static org.opengis.annotation.Specification.ISO_19115; ++ /** * Reference date and event used to describe it. @@@ -119,8 -119,8 +124,12 @@@ public class DefaultCitationDate extend public DefaultCitationDate(final CitationDate object) { super(object); if (object != null) { -- date = TemporalDate.toTemporal(object.getDate()); dateType = object.getDateType(); ++ if (object instanceof DefaultCitationDate) { ++ date = ((DefaultCitationDate) object).getReferenceDate(); ++ } else { ++ date = TemporalDate.toTemporal(object.getDate()); ++ } } } @@@ -168,9 -166,25 +175,25 @@@ * Sets the reference date for the cited resource. * * @param newValue the new date. + * + * @deprecated Replaced by {@link #setReferenceDate(Temporal)}. */ + @Deprecated(since="1.5") public void setDate(final Date newValue) { - setDate(TemporalDate.toTemporal(newValue)); + setReferenceDate(TemporalDate.toTemporal(newValue)); + } + + /** + * Returns the reference date for the cited resource. + * + * @return reference date for the cited resource, or {@code null}. + * + * @since 1.5 + */ - @Override + @XmlElement(name = "date", required = true) ++ @UML(identifier="date", obligation=MANDATORY, specification=ISO_19115) + public Temporal getReferenceDate() { + return date; } /** diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java index 6689ee1496,985cfdb18e..d2f256f7de --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/distribution/DefaultStandardOrderProcess.java @@@ -247,10 -243,40 +249,40 @@@ public class DefaultStandardOrderProces * Sets the date and time when the dataset will be available. * * @param newValue the new planned available time. + * + * @deprecated Replaced by {@link #setPlannedAvailableDate(Temporal)}. */ + @Deprecated(since="1.5") public void setPlannedAvailableDateTime(final Date newValue) { + setPlannedAvailableDate(TemporalDate.toTemporal(newValue)); + } + + /** + * Returns the date and time when the dataset will be available. + * + * @return date and time when the dataset will be available, or {@code null}. + * + * @since 1.5 + */ - @Override + @XmlElement(name = "plannedAvailableDateTime") ++ @UML(identifier="plannedAvailableDateTime", obligation=OPTIONAL, specification=ISO_19115) + public Temporal getPlannedAvailableDate() { + return plannedAvailableDateTime; + } + + /** + * Sets the date and time when the dataset will be available. + * The specified value should be an instance of {@link java.time.LocalDate}, {@link java.time.LocalDateTime}, + * {@link java.time.OffsetDateTime} or {@link java.time.ZonedDateTime}, depending whether hours are defined + * and how the timezone (if any) is defined. But other types are also allowed. + * + * @param newValue the new planned available time. + * + * @since 1.5 + */ + public void setPlannedAvailableDate(final Temporal newValue) { checkWritePermission(plannedAvailableDateTime); - plannedAvailableDateTime = TemporalDate.toTemporal(newValue); + plannedAvailableDateTime = newValue; } /** diff --cc endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/identification/DefaultUsage.java index 8c6ea0c521,02574b2e61..06b4b7afc0 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/identification/DefaultUsage.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/identification/DefaultUsage.java @@@ -34,11 -41,6 +41,12 @@@ import org.apache.sis.util.privy.Tempor // Specific to the main and geoapi-3.1 branches: import org.opengis.metadata.citation.ResponsibleParty; +// Specific to the main branch: +import org.opengis.annotation.UML; +import static org.opengis.annotation.Obligation.OPTIONAL; +import static org.opengis.annotation.Specification.ISO_19115; ++import org.apache.sis.pending.temporal.DefaultPeriod; + /** * Brief description of ways in which the resource(s) is/are currently or has been used. @@@ -164,15 -167,12 +173,20 @@@ public class DefaultUsage extends ISOMe super(object); if (object != null) { specificUsage = object.getSpecificUsage(); - usageDate = TemporalDate.toTemporal(object.getUsageDate()); - usageDates = copyCollection(object.getUsageDates(), TemporalPrimitive.class); userDeterminedLimitations = object.getUserDeterminedLimitations(); userContactInfo = copyCollection(object.getUserContactInfo(), ResponsibleParty.class); - responses = copyCollection(object.getResponses(), InternationalString.class); - additionalDocumentation = copyCollection(object.getAdditionalDocumentation(), Citation.class); - identifiedIssues = copyCollection(object.getIdentifiedIssues(), Citation.class); + if (object instanceof DefaultUsage) { - final DefaultUsage c = (DefaultUsage) object; ++ final var c = (DefaultUsage) object; ++ usageDates = copyCollection(c.getUsageDates(), TemporalPrimitive.class); + responses = copyCollection(c.getResponses(), InternationalString.class); + additionalDocumentation = copyCollection(c.getAdditionalDocumentation(), Citation.class); + identifiedIssues = copyCollection(c.getIdentifiedIssues(), Citation.class); ++ } else { ++ TemporalPrimitive t = TemporalUtilities.createInstant(TemporalDate.toTemporal(object.getUsageDate())); ++ if (t != null) { ++ usageDates = List.of(t); ++ } + } } } @@@ -226,21 -226,80 +240,82 @@@ * Returns the date and time of the first use or range of uses of the resource and/or resource series. * * @return date of the first use of the resource, or {@code null}. + * + * @deprecated Replaced by {@link #getUsageDates()}. */ @Override - @XmlElement(name = "usageDateTime") + @Deprecated(since="1.5") + @Dependencies("getUsageDates") + @XmlElement(name = "usageDateTime", namespace = LegacyNamespaces.GMD) public Date getUsageDate() { - return TemporalDate.toDate(usageDate); + if (FilterByVersion.LEGACY_METADATA.accept()) { + @SuppressWarnings("LocalVariableHidesMemberVariable") + final Collection<TemporalPrimitive> usageDates = getUsageDates(); + if (usageDates != null) { + for (TemporalPrimitive t : usageDates) { - Date p = TemporalDate.toDate(t.position().orElse(null)); - if (p != null) { - return p; ++ if (t instanceof DefaultPeriod) { ++ Date p = TemporalDate.toDate(((DefaultPeriod) t).getBeginning()); ++ if (p != null) { ++ return p; ++ } + } + } + } + } + return null; } /** * Sets the date and time of the first use. * * @param newValue the new usage date. + * + * @deprecated Replaced by {@link #setUsageDates(Collection)}. */ + @Deprecated(since="1.5") public void setUsageDate(final Date newValue) { - checkWritePermission(usageDate); - usageDate = TemporalDate.toTemporal(newValue); + setUsageDates(newValue == null ? List.of() : List.of(TemporalUtilities.createInstant(TemporalDate.toTemporal(newValue)))); + } + + /** + * Returns the date and time of the first use or range of uses of the resource and/or resource series. + * + * @return date of the first use of the resource. + * + * @since 1.5 + */ - @Override + @XmlElement(name = "usageDateTime") + @XmlJavaTypeAdapter(TM_Primitive.Since2014.class) ++ @UML(identifier="usageDateTime", obligation=OPTIONAL, specification=ISO_19115) + public Collection<TemporalPrimitive> getUsageDates() { + return usageDates = nonNullCollection(usageDates, TemporalPrimitive.class); + } + + /** + * Sets the date and time of the first use or range of uses of the resource and/or resource series. + * + * @param newValues date of the first use of the resource. + * + * @since 1.5 + */ + public void setUsageDates(final Collection<TemporalPrimitive> newValues) { + usageDates = writeCollection(usageDates, newValues, TemporalPrimitive.class); + } + + /** + * Adds a period for the range of uses of the resource and/or resource series. + * This is a convenience method for adding a temporal period. + * + * @param beginning the begin instant (inclusive), or {@code null}. + * @param ending the end instant (inclusive), or {@code null}. + * + * @since 1.5 + */ + public void addUsageDates(final Temporal beginning, final Temporal ending) { + TemporalPrimitive period = TemporalUtilities.createPeriod(beginning, ending); + if (period != null) { + getUsageDates().add(period); + } } /** diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationDateTest.java index 4788d6caf9,5545fd5921..ba41a58185 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationDateTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationDateTest.java @@@ -16,11 -16,14 +16,14 @@@ */ package org.apache.sis.metadata.iso.citation; - import java.util.Date; ++import java.time.Instant; import org.opengis.metadata.citation.DateType; import org.opengis.metadata.citation.CitationDate; import org.apache.sis.util.ComparisonMode; -// Specific to the geoapi-4.0 branch: -import java.time.Instant; -import java.time.temporal.Temporal; ++// Specific to the main branch: ++import java.util.Date; + // Test dependencies import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; @@@ -45,13 -48,13 +48,12 @@@ public final class DefaultCitationDateT @Test public void testCopyConstructor() { final CitationDate original = new CitationDate() { - @Override public Temporal getReferenceDate() {return Instant.ofEpochMilli(1305716658508L);} - @Override public DateType getDateType() {return DateType.CREATION;} + @Override public Date getDate() {return new Date(1305716658508L);} + @Override public DateType getDateType() {return DateType.CREATION;} }; final DefaultCitationDate copy = new DefaultCitationDate(original); - assertEquals(new Date(1305716658508L), copy.getDate()); + assertEquals(Instant.ofEpochMilli(1305716658508L), copy.getReferenceDate()); assertEquals(DateType.CREATION, copy.getDateType()); -- assertTrue (copy.equals(original, ComparisonMode.BY_CONTRACT)); assertFalse(copy.equals(original, ComparisonMode.STRICT)); // Opportunist test. } } diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java index 4dc32ca905,ece19ad314..fc40401f9f --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java @@@ -251,14 -253,14 +252,14 @@@ public final class DefaultCitationTest final var contact = new DefaultContact(rs); contact.setContactInstructions(new SimpleInternationalString("Send carrier pigeon.")); contact.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "ip-protocol"); - final DefaultCitation c = new DefaultCitation("Fight against poverty"); - final DefaultResponsibleParty r1 = new DefaultResponsibleParty(Role.ORIGINATOR); - final DefaultResponsibleParty r2 = new DefaultResponsibleParty(Role.valueOf("funder")); + final var c = new DefaultCitation("Fight against poverty"); + final var r1 = new DefaultResponsibleParty(Role.ORIGINATOR); - final var r2 = new DefaultResponsibleParty(Role.FUNDER); ++ final var r2 = new DefaultResponsibleParty(Role.valueOf("funder")); r1.setParties(Set.of(new DefaultIndividual("Maid Marian", null, contact))); r2.setParties(Set.of(new DefaultIndividual("Robin Hood", null, contact))); c.setCitedResponsibleParties(List.of(r1, r2)); - c.getDates().add(new DefaultCitationDate(TestUtilities.date("2015-10-17 00:00:00"), DateType.valueOf("adopted"))); - c.getDates().add(new DefaultCitationDate(OffsetDateTime.of(2015, 10, 17, 2, 0, 0, 0, ZoneOffset.ofHours(2)), DateType.ADOPTED)); - c.getPresentationForms().add(PresentationForm.PHYSICAL_OBJECT); ++ c.getDates().add(new DefaultCitationDate(OffsetDateTime.of(2015, 10, 17, 2, 0, 0, 0, ZoneOffset.ofHours(2)), DateType.valueOf("adopted"))); + c.getPresentationForms().add(PresentationForm.valueOf("physicalObject")); /* * Check that XML file built by the marshaller is the same as the example file. */ @@@ -305,12 -307,12 +306,12 @@@ public static void verifyUnmarshalledCitation(final Citation c) { assertTitleEquals("Fight against poverty", c, "citation"); -- final CitationDate date = getSingleton(c.getDates()); - assertEquals(date.getDate(), TestUtilities.date("2015-10-17 00:00:00")); ++ final var date = (DefaultCitationDate) getSingleton(c.getDates()); + assertEquals(date.getReferenceDate(), OffsetDateTime.of(2015, 10, 17, 2, 0, 0, 0, ZoneOffset.ofHours(2))); - assertEquals(DateType.ADOPTED, date.getDateType()); - assertEquals(PresentationForm.PHYSICAL_OBJECT, getSingleton(c.getPresentationForms())); + assertEquals(DateType.valueOf("adopted"), date.getDateType()); + assertEquals(PresentationForm.valueOf("physicalObject"), getSingleton(c.getPresentationForms())); - final Iterator<? extends Responsibility> it = c.getCitedResponsibleParties().iterator(); + final Iterator<? extends ResponsibleParty> it = c.getCitedResponsibleParties().iterator(); final Contact contact = assertResponsibilityEquals(Role.ORIGINATOR, "Maid Marian", it.next()); assertEquals("Send carrier pigeon.", String.valueOf(contact.getContactInstructions())); diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java index 3627078887,4c11f61a32..3e481db041 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java @@@ -609,8 -591,15 +609,15 @@@ public abstract class AnnotationConsist * We do not duplicate the Java methods only for that. */ case "getDerivedElements": { - return org.opengis.metadata.quality.Metaquality.class.isAssignableFrom(method.getDeclaringClass()); + return true; } + /* + * Property which exists in a deprecated and a non-deprecated version, + * with the same name but different namespace. + */ + case "usageDateTime": { + return method.isAnnotationPresent(Deprecated.class); + } /* * - "resultContent" is a property in the ISO 10157 model but not yet in the XML schema. * - "resultFormat" and "resultFile" differ in XML schema compared to abstract model (different obligation). diff --cc endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/MetadataReaderTest.java index e1e6b7da98,3550322273..da4760b701 --- a/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/MetadataReaderTest.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/MetadataReaderTest.java @@@ -36,11 -39,10 +39,10 @@@ import org.junit.jupiter.api.Test import static org.junit.jupiter.api.Assertions.*; import org.apache.sis.storage.netcdf.base.TestCase; import org.apache.sis.storage.netcdf.classic.ChannelDecoderTest; - import static org.apache.sis.test.TestUtilities.date; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.test.dataset.ContentVerifier; -import org.opengis.test.dataset.TestData; +// Specific to the main branch: +import org.apache.sis.storage.netcdf.base.TestData; +import org.apache.sis.test.ContentVerifier; /** @@@ -77,7 -79,7 +79,7 @@@ public final class MetadataReaderTest e final Decoder input = ChannelDecoderTest.createChannelDecoder(TestData.NETCDF_2D_GEOGRAPHIC); final Metadata metadata = new MetadataReader(input).read(); input.close(new DataStoreMock("lock")); - compareToExpected(metadata); - compareToExpected(metadata, false).assertMetadataEquals(); ++ compareToExpected(metadata, false); } /** @@@ -92,14 -94,30 +94,28 @@@ final Decoder input = createDecoder(TestData.NETCDF_2D_GEOGRAPHIC); final Metadata metadata = new MetadataReader(input).read(); input.close(new DataStoreMock("lock")); - compareToExpected(metadata); - final ContentVerifier verifier = compareToExpected(metadata, true); - verifier.addExpectedValue("identificationInfo[0].resourceFormat[0].formatSpecificationCitation.alternateTitle[1]", "NetCDF-3/CDM"); - verifier.assertMetadataEquals(); ++ compareToExpected(metadata, true); } /** - * Compares the string representation of the given metadata object with the expected one. + * Converts the given object to the actual type stored in the metadata. + * + * @param expected the expected date to convert. + * @param ucar whether the UCAR wrapper is used. + * @return the given date converted to the expected type. + */ + private static Temporal actual(final LocalDateTime expected, final boolean ucar) { + return ucar ? expected.toInstant(ZoneOffset.UTC) : expected; + } + + /** + * Creates comparator for the string representation of the given metadata object with the expected one. * The given metadata shall have been created from the {@link TestData#NETCDF_2D_GEOGRAPHIC} dataset. + * + * @param actual the metadata which have been read. + * @param ucar whether the UCAR wrapper is used. */ - static void compareToExpected(final Metadata actual) { - static ContentVerifier compareToExpected(final Metadata actual, final boolean ucar) { ++ static void compareToExpected(final Metadata actual, final boolean ucar) { final ContentVerifier verifier = new ContentVerifier(); verifier.addPropertyToIgnore(Metadata.class, "metadataStandard"); verifier.addPropertyToIgnore(Metadata.class, "referenceSystemInfo"); diff --cc endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/NetcdfStoreTest.java index 3aa4af465d,a2ea937da1..43f4498715 --- a/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/NetcdfStoreTest.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/test/org/apache/sis/storage/netcdf/NetcdfStoreTest.java @@@ -66,7 -66,7 +66,7 @@@ public final class NetcdfStoreTest exte metadata = store.getMetadata(); assertSame(metadata, store.getMetadata(), "Should be cached."); } - MetadataReaderTest.compareToExpected(metadata); - MetadataReaderTest.compareToExpected(metadata, false).assertMetadataEquals(); ++ MetadataReaderTest.compareToExpected(metadata, false); loggings.skipNextLogIfContains("EPSG:4019"); // Deprecated EPSG code. loggings.assertNoUnexpectedLog(); } diff --cc endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Copyright.java index ddc9e23d27,88bc82ca4e..4ea89e49c1 --- a/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Copyright.java +++ b/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Copyright.java @@@ -20,9 -20,11 +20,12 @@@ import java.net.URI import java.util.List; import java.util.Collection; import java.util.Collections; - import java.util.Date; import java.util.Locale; import java.util.Objects; ++import java.util.Date; + import java.time.Year; + import java.time.temporal.Temporal; + import java.time.temporal.ChronoField; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; import org.opengis.metadata.Identifier; @@@ -37,14 -39,11 +40,15 @@@ import org.opengis.metadata.constraint. import org.opengis.util.InternationalString; import org.apache.sis.util.iso.Types; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.metadata.citation.Party; -import org.opengis.metadata.citation.Responsibility; -import org.opengis.metadata.identification.BrowseGraphic; -import org.apache.sis.util.SimpleInternationalString; +// Specific to the main branch: +import org.opengis.metadata.citation.Contact; +import org.opengis.metadata.citation.Series; +import org.opengis.metadata.citation.ResponsibleParty; ++import org.apache.sis.util.privy.TemporalDate; +import org.apache.sis.metadata.iso.citation.AbstractParty; +import org.apache.sis.metadata.iso.citation.DefaultCitation; +import org.apache.sis.metadata.iso.citation.DefaultResponsibility; +import org.apache.sis.metadata.iso.constraint.DefaultConstraints; /** @@@ -109,11 -111,11 +113,11 @@@ resp: for (final DefaultResponsibilit if (author != null) break resp; } } - for (final Citation ci : c.getReferences()) { + for (final Citation ci : ((DefaultConstraints) c).getReferences()) { for (final CitationDate d : ci.getDates()) { - final Date date = d.getDate(); - final Temporal date = d.getReferenceDate(); ++ final Temporal date = TemporalDate.toTemporal(d.getDate()); if (date != null) { - year = date.getYear() + 1900; + year = date.get(ChronoField.YEAR); break; } } @@@ -303,9 -301,9 +307,9 @@@ * @return reference date for the cited resource. */ @Override - public Temporal getReferenceDate() { + public Date getDate() { if (year != null) { - return new Date(year - 1900, 0, 1); - return Year.of(year); ++ return TemporalDate.toDate(Year.of(year)); } return null; }