Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/package-info.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -86,21 +86,24 @@ * * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ -@XmlSchema(location=Schemas.METADATA_XSD, elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.GMI, xmlns = { - @XmlNs(prefix = "gmi", namespaceURI = Namespaces.GMI), - @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD), - @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO), - @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI) +@XmlSchema(location="http://standards.iso.org/iso/19115/-3/mac/1.0/mac.xsd", + elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.MAC, + xmlns = { + @XmlNs(prefix = "mac", namespaceURI = Namespaces.MAC), // Metadata for Acquisition + @XmlNs(prefix = "mcc", namespaceURI = Namespaces.MCC) // Metadata Common Classes }) @XmlAccessorType(XmlAccessType.NONE) @XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(CI_Citation.class), @XmlJavaTypeAdapter(CI_Responsibility.class), @XmlJavaTypeAdapter(EX_Extent.class), + @XmlJavaTypeAdapter(GO_DateTime.class), + @XmlJavaTypeAdapter(GO_Real.class), @XmlJavaTypeAdapter(GM_Object.class), @XmlJavaTypeAdapter(MD_Identifier.class), @XmlJavaTypeAdapter(MD_ProgressCode.class), @@ -123,8 +126,6 @@ @XmlJavaTypeAdapter(MI_TriggerCode.class), // Java types, primitive types and basic OGC types handling - @XmlJavaTypeAdapter(GO_DateTime.class), - @XmlJavaTypeAdapter(StringAdapter.class), @XmlJavaTypeAdapter(InternationalStringAdapter.class) }) package org.apache.sis.metadata.iso.acquisition; @@ -137,7 +138,6 @@ import javax.xml.bind.annotation.XmlAcce import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; import org.apache.sis.xml.Namespaces; -import org.apache.sis.internal.jaxb.Schemas; import org.apache.sis.internal.jaxb.gco.*; import org.apache.sis.internal.jaxb.code.*; import org.apache.sis.internal.jaxb.metadata.*;
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -50,7 +50,7 @@ import org.apache.sis.util.iso.Types; * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.5 * @module */ @@ -60,7 +60,7 @@ import org.apache.sis.util.iso.Types; "name", "contactInfo" }) -@XmlRootElement(name = "CI_Party") +@XmlRootElement(name = "AbstractCI_Party") @XmlSeeAlso({ DefaultIndividual.class, DefaultOrganisation.class Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultAddress.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -40,7 +40,7 @@ import org.apache.sis.metadata.iso.ISOMe * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -31,6 +31,8 @@ import org.opengis.metadata.citation.Ser import org.opengis.metadata.identification.BrowseGraphic; import org.opengis.util.InternationalString; import org.apache.sis.util.iso.Types; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.jaxb.NonMarshalledAuthority; import org.apache.sis.metadata.TitleProperty; import org.apache.sis.metadata.iso.ISOMetadata; @@ -54,7 +56,7 @@ import static org.apache.sis.internal.me * The ISO 19115 model provides specific attributes for the {@linkplain #getISBN() ISBN} and * {@linkplain #getISSN() ISSN} codes. However the SIS library handles those codes like any * other identifiers. Consequently the ISBN and ISSN codes are included in the collection - * returned by {@link #getIdentifiers()}, except at XML marshalling time (for ISO 19139 compliance). + * returned by {@link #getIdentifiers()}, except at XML marshalling time (for ISO 19115-3 compliance). * * <div class="section">Limitations</div> * <ul> @@ -68,7 +70,8 @@ import static org.apache.sis.internal.me * @author Martin Desruisseaux (IRD, Geomatys) * @author Cédric Briançon (Geomatys) * @author Rémi Maréchal (Geomatys) - * @version 0.7 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @@ -87,7 +90,9 @@ import static org.apache.sis.internal.me "otherCitationDetails", "collectiveTitle", "ISBN", - "ISSN" + "ISSN", + "onlineResource", // New in ISO 19115:2014 + "graphic" // Ibid. }) @XmlRootElement(name = "CI_Citation") public class DefaultCitation extends ISOMetadata implements Citation { @@ -292,7 +297,7 @@ public class DefaultCitation extends ISO * @return the reference date. */ @Override - @XmlElement(name = "date", required = true) + @XmlElement(name = "date") public Collection<CitationDate> getDates() { return dates = nonNullCollection(dates, CitationDate.class); } @@ -361,7 +366,7 @@ public class DefaultCitation extends ISO * * <div class="note"><b>XML note:</b> * The {@code <gmd:identifier>} element marshalled to XML will exclude all the above cited identifiers, - * for ISO 19139 compliance. Those identifiers will appear in other XML elements or attributes.</div> + * for ISO 19115-3 compliance. Those identifiers will appear in other XML elements or attributes.</div> * * @return the identifiers, or an empty collection if none. * @@ -485,9 +490,9 @@ public class DefaultCitation extends ISO */ @Override @Deprecated - @XmlElement(name = "collectiveTitle") + @XmlElement(name = "collectiveTitle", namespace = LegacyNamespaces.GMD) public InternationalString getCollectiveTitle() { - return collectiveTitle; + return FilterByVersion.LEGACY_METADATA.accept() ? collectiveTitle : null; } /** @@ -590,7 +595,7 @@ public class DefaultCitation extends ISO * @since 0.5 */ @Override -/// @XmlElement(name = "onlineResource") + // @XmlElement at the end of this class. public Collection<OnlineResource> getOnlineResources() { return onlineResources = nonNullCollection(onlineResources, OnlineResource.class); } @@ -614,7 +619,7 @@ public class DefaultCitation extends ISO * @since 0.5 */ @Override -/// @XmlElement(name = "graphic") + // @XmlElement at the end of this class. public Collection<BrowseGraphic> getGraphics() { return graphics = nonNullCollection(graphics, BrowseGraphic.class); } @@ -629,4 +634,33 @@ public class DefaultCitation extends ISO public void setGraphics(final Collection<? extends BrowseGraphic> newValues) { graphics = writeCollection(newValues, graphics, BrowseGraphic.class); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked by JAXB at both marshalling and unmarshalling time. + * This attribute has been added by ISO 19115:2014 standard. + * If (and only if) marshalling an older standard version, we omit this attribute. + */ + @XmlElement(name = "onlineResource") + private Collection<OnlineResource> getOnlineResource() { + return FilterByVersion.CURRENT_METADATA.accept() ? getOnlineResources() : null; + } + + @XmlElement(name = "graphic") + private Collection<BrowseGraphic> getGraphic() { + return FilterByVersion.CURRENT_METADATA.accept() ? getGraphics() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitationDate.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -48,7 +48,7 @@ import static org.apache.sis.internal.me * * @author Martin Desruisseaux (IRD, Geomatys) * @author Cédric Briançon (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,6 +22,7 @@ import java.util.Collection; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.util.InternationalString; import org.opengis.metadata.citation.Address; import org.opengis.metadata.citation.Contact; @@ -31,6 +32,9 @@ import org.opengis.metadata.citation.Tel import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.util.resources.Messages; import org.apache.sis.internal.jaxb.Context; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.gco.InternationalStringAdapter; import org.apache.sis.internal.metadata.Dependencies; import org.apache.sis.internal.metadata.LegacyPropertyAdapter; @@ -51,17 +55,22 @@ import org.apache.sis.internal.metadata. * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) * @author Rémi Maréchal (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "CI_Contact_Type", propOrder = { "phone", + "phoneList", "address", + "addressList", "onlineResource", + "onlineResourceList", "hoursOfService", - "contactInstructions" + "contactInstructions", + "contactType" }) @XmlRootElement(name = "CI_Contact") public class DefaultContact extends ISOMetadata implements Contact { @@ -170,6 +179,7 @@ public class DefaultContact extends ISOM * @since 0.5 */ @Override + // @XmlElement at the end of this class. public Collection<Telephone> getPhones() { return phones = nonNullCollection(phones, Telephone.class); } @@ -185,9 +195,9 @@ public class DefaultContact extends ISOM phones = writeCollection(newValues, phones, Telephone.class); /* * Code below this point will be deleted after we removed the deprecated methods in DefaultTelephone. - * This code notifies all DefaultTelephone instances about the the list of phones in order to allow - * the deprecated Telephone.getVoices() and Telephone.getFacsimiles() methods to fetches information - * from the phones list. + * This code notifies all DefaultTelephone instances about the list of phones in order to allow the + * deprecated Telephone.getVoices() and Telephone.getFacsimiles() methods to fetches information from + * the phones list. */ if (phones != null) { boolean modified = false; @@ -217,26 +227,28 @@ public class DefaultContact extends ISOM */ @Override @Deprecated - @XmlElement(name = "phone") @Dependencies("getPhones") + @XmlElement(name = "phone", namespace = LegacyNamespaces.GMD) public Telephone getPhone() { Telephone phone = null; - final Collection<Telephone> phones = getPhones(); - if (phones != null) { // May be null on marshalling. - TelephoneType ignored = null; - for (final Telephone c : phones) { - final TelephoneType type = c.getNumberType(); - if (TelephoneType.VOICE.equals(type) || TelephoneType.FACSIMILE.equals(type)) { - if (phone == null) { - phone = c; + if (FilterByVersion.LEGACY_METADATA.accept()) { + final Collection<Telephone> phones = getPhones(); + if (phones != null) { // May be null on marshalling. + TelephoneType ignored = null; + for (final Telephone c : phones) { + final TelephoneType type = c.getNumberType(); + if (TelephoneType.VOICE.equals(type) || TelephoneType.FACSIMILE.equals(type)) { + if (phone == null) { + phone = c; + } + } else if (ignored == null) { + ignored = type; } - } else if (ignored == null) { - ignored = type; } - } - if (ignored != null) { - Context.warningOccured(Context.current(), DefaultContact.class, "getPhone", - Messages.class, Messages.Keys.IgnoredPropertyAssociatedTo_1, ignored.toString()); + if (ignored != null) { + Context.warningOccured(Context.current(), DefaultContact.class, "getPhone", + Messages.class, Messages.Keys.IgnoredPropertyAssociatedTo_1, ignored.toString()); + } } } return phone; @@ -277,6 +289,7 @@ public class DefaultContact extends ISOM * @since 0.5 */ @Override + // @XmlElement at the end of this class. public Collection<Address> getAddresses() { return addresses = nonNullCollection(addresses, Address.class); } @@ -302,10 +315,13 @@ public class DefaultContact extends ISOM */ @Override @Deprecated - @XmlElement(name = "address") @Dependencies("getAddresses") + @XmlElement(name = "address", namespace = LegacyNamespaces.GMD) public Address getAddress() { - return LegacyPropertyAdapter.getSingleton(getAddresses(), Address.class, null, DefaultContact.class, "getAddress"); + if (FilterByVersion.LEGACY_METADATA.accept()) { + return LegacyPropertyAdapter.getSingleton(getAddresses(), Address.class, null, DefaultContact.class, "getAddress"); + } + return null; // Marshalling newer ISO 19115-3 } /** @@ -329,6 +345,7 @@ public class DefaultContact extends ISOM * @since 0.5 */ @Override + // @XmlElement at the end of this class. public Collection<OnlineResource> getOnlineResources() { return onlineResources = nonNullCollection(onlineResources, OnlineResource.class); } @@ -354,10 +371,13 @@ public class DefaultContact extends ISOM */ @Override @Deprecated - @XmlElement(name = "onlineResource") @Dependencies("getOnlineResources") + @XmlElement(name = "onlineResource", namespace = LegacyNamespaces.GMD) public OnlineResource getOnlineResource() { - return LegacyPropertyAdapter.getSingleton(getOnlineResources(), OnlineResource.class, null, DefaultContact.class, "getOnlineResource"); + if (FilterByVersion.LEGACY_METADATA.accept()) { + return LegacyPropertyAdapter.getSingleton(getOnlineResources(), OnlineResource.class, null, DefaultContact.class, "getOnlineResource"); + } + return null; // Marshalling newer ISO 19115-3 } /** @@ -423,7 +443,8 @@ public class DefaultContact extends ISOM * @since 0.5 */ @Override -/// @XmlElement(name = "contactType") + @XmlElement(name = "contactType") + @XmlJavaTypeAdapter(InternationalStringAdapter.Since2014.class) public InternationalString getContactType() { return contactType; } @@ -439,4 +460,38 @@ public class DefaultContact extends ISOM checkWritePermission(); contactType = newValue; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked by JAXB at both marshalling and unmarshalling time. + * This attribute has been added by ISO 19115:2014 standard. + * If (and only if) marshalling an older standard version, we omit this attribute. + */ + @XmlElement(name = "phone") + private Collection<Telephone> getPhoneList() { + return FilterByVersion.CURRENT_METADATA.accept() ? getPhones() : null; + } + + @XmlElement(name = "address") + private Collection<Address> getAddressList() { + return FilterByVersion.CURRENT_METADATA.accept() ? getAddresses() : null; + } + + @XmlElement(name = "onlineResource") + private Collection<OnlineResource> getOnlineResourceList() { + return FilterByVersion.CURRENT_METADATA.accept() ? getOnlineResources() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultIndividual.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultIndividual.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultIndividual.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultIndividual.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -39,7 +39,7 @@ import org.apache.sis.util.iso.Types; * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.5 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -20,9 +20,12 @@ import java.net.URI; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.util.InternationalString; import org.opengis.metadata.citation.OnLineFunction; import org.opengis.metadata.citation.OnlineResource; +import org.apache.sis.internal.jaxb.gco.StringAdapter; +import org.apache.sis.internal.jaxb.gco.URIAdapter; import org.apache.sis.metadata.iso.ISOMetadata; @@ -46,7 +49,8 @@ import org.apache.sis.metadata.iso.ISOMe * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @@ -57,7 +61,8 @@ import org.apache.sis.metadata.iso.ISOMe "applicationProfile", "name", "description", - "function" + "function", + "protocolRequest" }) @XmlRootElement(name = "CI_OnlineResource") public class DefaultOnlineResource extends ISOMetadata implements OnlineResource { @@ -259,6 +264,7 @@ public class DefaultOnlineResource exten */ @Override @XmlElement(name = "linkage", required = true) + @XmlJavaTypeAdapter(URIAdapter.AsURL.class) public URI getLinkage() { return linkage; } @@ -318,6 +324,8 @@ public class DefaultOnlineResource exten * @since 0.5 */ @Override + @XmlElement(name = "protocolRequest") + @XmlJavaTypeAdapter(StringAdapter.Since2014.class) public String getProtocolRequest() { return protocolRequest; } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOrganisation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOrganisation.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOrganisation.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOrganisation.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -40,7 +40,7 @@ import org.opengis.metadata.identificati * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.5 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -21,11 +21,14 @@ import javax.xml.bind.annotation.XmlType import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.metadata.citation.Party; import org.opengis.metadata.citation.Responsibility; import org.opengis.metadata.citation.Role; import org.opengis.metadata.extent.Extent; import org.apache.sis.metadata.iso.ISOMetadata; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.code.CI_RoleCode; /** @@ -49,15 +52,16 @@ import org.apache.sis.metadata.iso.ISOMe * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.5 * @module */ -@SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. +@SuppressWarnings({"CloneableClassWithoutClone", "deprecation"}) // ModifiableMetadata needs shallow clones. @XmlType(name = "CI_Responsibility_Type", propOrder = { -/// "role", -/// "extents", -/// "parties" + "role", + "extent", + "party" }) @XmlRootElement(name = "CI_Responsibility") @XmlSeeAlso({ @@ -152,7 +156,8 @@ public class DefaultResponsibility exten * @return function performed by the responsible party. */ @Override -/// @XmlElement(name = "role", required = true) + @XmlElement(name = "role", required = true) + @XmlJavaTypeAdapter(CI_RoleCode.Since2014.class) public Role getRole() { return role; } @@ -173,7 +178,7 @@ public class DefaultResponsibility exten * @return the spatial or temporal extents of the role. */ @Override -/// @XmlElement(name = "extent") + // @XmlElement at the end of this class. public Collection<Extent> getExtents() { return extents = nonNullCollection(extents, Extent.class); } @@ -193,7 +198,7 @@ public class DefaultResponsibility exten * @return information about the parties. */ @Override -/// @XmlElement(name = "party", required = true) + // @XmlElement at the end of this class. public Collection<Party> getParties() { return parties = nonNullCollection(parties, Party.class); } @@ -206,4 +211,33 @@ public class DefaultResponsibility exten public void setParties(final Collection<? extends Party> newValues) { parties = writeCollection(newValues, parties, Party.class); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked by JAXB at both marshalling and unmarshalling time. + * This attribute has been added by ISO 19115:2014 standard. + * If (and only if) marshalling an older standard version, we omit this attribute. + */ + @XmlElement(name = "extent") + private Collection<Extent> getExtent() { + return FilterByVersion.CURRENT_METADATA.accept() ? getExtents() : null; + } + + @XmlElement(name = "party", required = true) + private Collection<Party> getParty() { + return FilterByVersion.CURRENT_METADATA.accept() ? getParties() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibleParty.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -31,6 +31,7 @@ import org.opengis.metadata.citation.Res import org.opengis.metadata.citation.Role; import org.opengis.util.InternationalString; import org.apache.sis.util.iso.Types; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.metadata.Dependencies; import org.apache.sis.internal.metadata.LegacyPropertyAdapter; @@ -52,20 +53,20 @@ import org.apache.sis.internal.metadata. * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ @Deprecated @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. -@XmlType(name = "CI_ResponsibleParty_Type", propOrder = { +@XmlType(name = "CI_ResponsibleParty_Type", namespace = LegacyNamespaces.GMD, propOrder = { "individualName", "organisationName", "positionName", "contactInfo", "role" }) -@XmlRootElement(name = "CI_ResponsibleParty") +@XmlRootElement(name = "CI_ResponsibleParty", namespace = LegacyNamespaces.GMD) public class DefaultResponsibleParty extends DefaultResponsibility implements ResponsibleParty { /** * Serial number for inter-operability with different versions. @@ -222,8 +223,8 @@ public class DefaultResponsibleParty ext */ @Override @Deprecated - @XmlElement(name = "individualName") @Dependencies("getParties") + @XmlElement(name = "individualName") public String getIndividualName() { final InternationalString name = getIndividual(false); return (name != null) ? name.toString() : null; @@ -262,8 +263,8 @@ public class DefaultResponsibleParty ext */ @Override @Deprecated - @XmlElement(name = "organisationName") @Dependencies("getParties") + @XmlElement(name = "organisationName") public InternationalString getOrganisationName() { return getName(getParties(), Organisation.class, false); } @@ -302,8 +303,8 @@ public class DefaultResponsibleParty ext */ @Override @Deprecated - @XmlElement(name = "positionName") @Dependencies("getParties") + @XmlElement(name = "positionName") public InternationalString getPositionName() { return getIndividual(true); } @@ -339,16 +340,16 @@ public class DefaultResponsibleParty ext */ @Override @Deprecated - @XmlElement(name = "contactInfo") @Dependencies("getParties") + @XmlElement(name = "contactInfo") public Contact getContactInfo() { final Collection<Party> parties = getParties(); - if (parties != null) { // May be null on marshalling. + if (parties != null) { // May be null on marshalling. for (final Party party : parties) { final Collection<? extends Contact> contacts = party.getContactInfo(); - if (contacts != null) { // May be null on marshalling. + if (contacts != null) { // May be null on marshalling. for (final Contact contact : contacts) { - if (contact != null) { // Paranoiac check. + if (contact != null) { // Paranoiac check. return contact; } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultSeries.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -39,7 +39,7 @@ import org.apache.sis.util.iso.Types; * * @author Martin Desruisseaux (IRD, Geomatys) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultTelephone.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,10 +22,15 @@ import java.util.Collections; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.metadata.citation.Telephone; import org.opengis.metadata.citation.TelephoneType; -import org.apache.sis.internal.util.CollectionsExt; import org.apache.sis.metadata.iso.ISOMetadata; +import org.apache.sis.internal.util.CollectionsExt; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.gco.StringAdapter; +import org.apache.sis.internal.jaxb.code.CI_TelephoneTypeCode; import org.apache.sis.internal.metadata.Dependencies; @@ -61,7 +66,8 @@ import org.apache.sis.internal.metadata. * @author Martin Desruisseaux (IRD, Geomatys) * @author Cédric Briançon (Geomatys) * @author Rémi Maréchal (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * * @see DefaultContact#getPhones() * @@ -70,8 +76,10 @@ import org.apache.sis.internal.metadata. */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "CI_Telephone_Type", propOrder = { - "voices", - "facsimiles" + "number", // New in ISO 19115:2014 + "numberType", // Ibid. + "voices", // Legacy ISO 19115:2003 + "facsimiles" // Ibid. }) @XmlRootElement(name = "CI_Telephone") public class DefaultTelephone extends ISOMetadata implements Telephone { @@ -159,7 +167,8 @@ public class DefaultTelephone extends IS * @since 0.5 */ @Override -/// @XmlElement(name = "number", required = true) + @XmlElement(name = "number", required = true) + @XmlJavaTypeAdapter(StringAdapter.Since2014.class) public String getNumber() { return number; } @@ -184,7 +193,8 @@ public class DefaultTelephone extends IS * @since 0.5 */ @Override -/// @XmlElement(name = "numberType") + @XmlElement(name = "numberType") + @XmlJavaTypeAdapter(CI_TelephoneTypeCode.Since2014.class) public TelephoneType getNumberType() { return numberType; } @@ -268,10 +278,13 @@ public class DefaultTelephone extends IS */ @Override @Deprecated - @XmlElement(name = "voice") @Dependencies({"getNumber", "getNumberType"}) + @XmlElement(name = "voice", namespace = LegacyNamespaces.GMD) public final Collection<String> getVoices() { - return new LegacyTelephones(getOwner(), TelephoneType.VOICE); + if (FilterByVersion.LEGACY_METADATA.accept()) { + return new LegacyTelephones(getOwner(), TelephoneType.VOICE); + } + return null; // Marshalling newer ISO 19115-3 document. } /** @@ -301,10 +314,13 @@ public class DefaultTelephone extends IS */ @Override @Deprecated - @XmlElement(name = "facsimile") @Dependencies({"getNumber", "getNumberType"}) + @XmlElement(name = "facsimile", namespace = LegacyNamespaces.GMD) public final Collection<String> getFacsimiles() { - return new LegacyTelephones(getOwner(), TelephoneType.FACSIMILE); + if (FilterByVersion.LEGACY_METADATA.accept()) { + return new LegacyTelephones(getOwner(), TelephoneType.FACSIMILE); + } + return null; // Marshalling newer ISO 19115-3 document. } /** Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/package-info.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -66,7 +66,7 @@ * Apache SIS provides a unified view of all metadata identifiers. This view includes the citation * {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitation#getISBN() ISBN} and * {@linkplain org.apache.sis.metadata.iso.citation.DefaultCitation#getISSN() ISSN} codes, - * except at XML marshalling time (for ISO 19139 compliance). + * except at XML marshalling time (for ISO 19115-3 compliance). * See {@link org.apache.sis.xml.IdentifierMap} for more information. * * <div class="section">Null values, nil objects and collections</div> @@ -86,14 +86,17 @@ * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.7 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ -@XmlSchema(location=Schemas.METADATA_XSD, elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.GMD, xmlns = { - @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD), - @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO), - @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI) +@XmlSchema(location="http://standards.iso.org/iso/19115/-3/cit/1.0/cit.xsd", + elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.CIT, + xmlns = { + @XmlNs(prefix = "cit", namespaceURI = Namespaces.CIT), // Citation and responsible party information + @XmlNs(prefix = "mcc", namespaceURI = Namespaces.MCC), // Metadata Common Classes + @XmlNs(prefix = "gmd", namespaceURI = LegacyNamespaces.GMD) }) @XmlAccessorType(XmlAccessType.NONE) @XmlJavaTypeAdapters({ @@ -110,11 +113,11 @@ @XmlJavaTypeAdapter(CI_Series.class), @XmlJavaTypeAdapter(CI_Telephone.class), @XmlJavaTypeAdapter(EX_Extent.class), + @XmlJavaTypeAdapter(GO_DateTime.class), + @XmlJavaTypeAdapter(MD_BrowseGraphic.class), @XmlJavaTypeAdapter(MD_Identifier.class), // Java types, primitive types and basic OGC types handling - @XmlJavaTypeAdapter(GO_URL.class), - @XmlJavaTypeAdapter(GO_DateTime.class), @XmlJavaTypeAdapter(StringAdapter.class), @XmlJavaTypeAdapter(InternationalStringAdapter.class) }) @@ -128,8 +131,7 @@ import javax.xml.bind.annotation.XmlAcce import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; import org.apache.sis.xml.Namespaces; -import org.apache.sis.internal.jaxb.Schemas; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.jaxb.gco.*; -import org.apache.sis.internal.jaxb.gmd.*; import org.apache.sis.internal.jaxb.code.*; import org.apache.sis.internal.jaxb.metadata.*; Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlType import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.util.InternationalString; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.citation.Responsibility; @@ -30,6 +31,9 @@ import org.opengis.metadata.constraint.C import org.opengis.metadata.constraint.LegalConstraints; import org.opengis.metadata.constraint.SecurityConstraints; import org.opengis.metadata.maintenance.Scope; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.metadata.MD_Releasability; +import org.apache.sis.internal.jaxb.metadata.MD_Scope; import org.apache.sis.metadata.iso.ISOMetadata; import org.apache.sis.util.iso.Types; @@ -50,19 +54,20 @@ import org.apache.sis.util.iso.Types; * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) * @author Rémi Maréchal (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. -@XmlType(name = "MD_Constraints_Type" /*, propOrder = { - "useLimitation", +@XmlType(name = "MD_Constraints_Type", propOrder = { + "useLimitations", "constraintApplicationScope", - "graphic", - "reference", - "releasability", - "responsibleParty" -} */) + "graphic", // New in ISO 19115:2014 + "reference", // Ibid. + "releasability", // Ibid. + "responsibleParty" // Ibid. +}) @XmlRootElement(name = "MD_Constraints") @XmlSeeAlso({ DefaultLegalConstraints.class, @@ -209,7 +214,8 @@ public class DefaultConstraints extends * @since 0.5 */ @Override -/// @XmlElement(name = "constraintApplicationScope") + @XmlElement(name = "constraintApplicationScope") + @XmlJavaTypeAdapter(MD_Scope.Since2014.class) public Scope getConstraintApplicationScope() { return constraintApplicationScope; } @@ -234,7 +240,7 @@ public class DefaultConstraints extends * @since 0.5 */ @Override -/// @XmlElement(name = "graphic") + // @XmlElement at the end of this class. public Collection<BrowseGraphic> getGraphics() { return graphics = nonNullCollection(graphics, BrowseGraphic.class); } @@ -259,7 +265,7 @@ public class DefaultConstraints extends * @since 0.5 */ @Override -/// @XmlElement(name = "reference") + // @XmlElement at the end of this class. public Collection<Citation> getReferences() { return references = nonNullCollection(references, Citation.class); } @@ -283,7 +289,8 @@ public class DefaultConstraints extends * @since 0.5 */ @Override -/// @XmlElement(name = "releasability") + @XmlElement(name = "releasability") + @XmlJavaTypeAdapter(MD_Releasability.Since2014.class) public Releasability getReleasability() { return releasability; } @@ -308,7 +315,7 @@ public class DefaultConstraints extends * @since 0.5 */ @Override -/// @XmlElement(name = "responsibleParty") + // @XmlElement at the end of this class. public Collection<Responsibility> getResponsibleParties() { return responsibleParties = nonNullCollection(responsibleParties, Responsibility.class); } @@ -323,4 +330,38 @@ public class DefaultConstraints extends public void setResponsibleParties(final Collection<? extends Responsibility> newValues) { responsibleParties = writeCollection(newValues, responsibleParties, Responsibility.class); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked by JAXB at both marshalling and unmarshalling time. + * This attribute has been added by ISO 19115:2014 standard. + * If (and only if) marshalling an older standard version, we omit this attribute. + */ + @XmlElement(name = "graphic") + private Collection<BrowseGraphic> getGraphic() { + return FilterByVersion.CURRENT_METADATA.accept() ? getGraphics() : null; + } + + @XmlElement(name = "reference") + private Collection<Citation> getReference() { + return FilterByVersion.CURRENT_METADATA.accept() ? getReferences() : null; + } + + @XmlElement(name = "responsibleParty") + private Collection<Responsibility> getResponsibleParty() { + return FilterByVersion.CURRENT_METADATA.accept() ? getResponsibleParties() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraints.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -51,7 +51,7 @@ import org.opengis.metadata.constraint.L * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -40,7 +40,7 @@ import org.apache.sis.metadata.iso.ISOMe * </ul> * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.5 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultSecurityConstraints.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -43,7 +43,7 @@ import org.opengis.metadata.constraint.S * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/package-info.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -63,17 +63,22 @@ * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ -@XmlSchema(location=Schemas.METADATA_XSD, elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.GMD, xmlns = { - @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD), - @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO), - @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI) +@XmlSchema(location="http://standards.iso.org/iso/19115/-3/mco/1.0/mco.xsd", + elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.MCO, + xmlns = { + @XmlNs(prefix = "mco", namespaceURI = Namespaces.MCO), // Metadata for Constraints + @XmlNs(prefix = "mcc", namespaceURI = Namespaces.MCC) // Metadata Common Classes }) @XmlAccessorType(XmlAccessType.NONE) @XmlJavaTypeAdapters({ + @XmlJavaTypeAdapter(CI_Citation.class), + @XmlJavaTypeAdapter(CI_Responsibility.class), + @XmlJavaTypeAdapter(MD_BrowseGraphic.class), @XmlJavaTypeAdapter(MD_ClassificationCode.class), @XmlJavaTypeAdapter(MD_RestrictionCode.class), @XmlJavaTypeAdapter(InternationalStringAdapter.class) @@ -88,6 +93,6 @@ import javax.xml.bind.annotation.XmlAcce import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; import org.apache.sis.xml.Namespaces; -import org.apache.sis.internal.jaxb.Schemas; import org.apache.sis.internal.jaxb.gco.*; import org.apache.sis.internal.jaxb.code.*; +import org.apache.sis.internal.jaxb.metadata.*; Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/AbstractContentInformation.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -40,13 +40,13 @@ import org.apache.sis.metadata.iso.ISOMe * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.3 + * @version 1.0 * @since 0.3 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "AbstractMD_ContentInformation_Type") -@XmlRootElement(name = "MD_ContentInformation") +@XmlRootElement(name = "AbstractMD_ContentInformation") @XmlSeeAlso({ DefaultCoverageDescription.class, DefaultFeatureCatalogueDescription.class Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultAttributeGroup.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -45,14 +45,15 @@ import org.apache.sis.metadata.iso.ISOMe * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.5 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "MD_AttributeGroup_Type", propOrder = { - "contentType", - "attribute" + "contentTypes", + "attributes" }) @XmlRootElement(name = "MD_AttributeGroup") public class DefaultAttributeGroup extends ISOMetadata implements AttributeGroup { Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultBand.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,12 +22,14 @@ import javax.xml.bind.annotation.XmlElem import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.metadata.content.Band; import org.opengis.metadata.content.BandDefinition; import org.opengis.metadata.content.PolarizationOrientation; import org.opengis.metadata.content.TransferFunctionType; -import org.apache.sis.xml.Namespaces; import org.apache.sis.measure.ValueRange; +import org.apache.sis.internal.jaxb.gco.GO_Real; +import org.apache.sis.internal.jaxb.gco.UnitAdapter; import static org.apache.sis.internal.metadata.MetadataUtilities.ensurePositive; @@ -53,17 +55,18 @@ import static org.apache.sis.internal.me * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) * @author Rémi Maréchal (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "MD_Band_Type", propOrder = { + "boundMax", + "boundMin", + "boundUnits", "peakResponse", - "bitsPerValue", "toneGradation", - "scaleFactor", - "offset", "bandBoundaryDefinition", "nominalSpatialResolution", "transferFunctionType", @@ -190,7 +193,8 @@ public class DefaultBand extends Default */ @Override @ValueRange(minimum = 0) -/// @XmlElement(name = "boundMin") + @XmlElement(name = "boundMin") + @XmlJavaTypeAdapter(GO_Real.Since2014.class) public Double getBoundMin() { return boundMin; } @@ -221,7 +225,8 @@ public class DefaultBand extends Default */ @Override @ValueRange(minimum = 0) -/// @XmlElement(name = "boundMax") + @XmlElement(name = "boundMax") + @XmlJavaTypeAdapter(GO_Real.Since2014.class) public Double getBoundMax() { return boundMax; } @@ -251,7 +256,8 @@ public class DefaultBand extends Default * @see org.apache.sis.measure.Units#NANOMETRE */ @Override -/// @XmlElement(name = "boundUnits") + @XmlElement(name = "boundUnits") + @XmlJavaTypeAdapter(UnitAdapter.Since2014.class) public Unit<Length> getBoundUnits() { return boundUnits; } @@ -274,7 +280,7 @@ public class DefaultBand extends Default * @return criterion for defining maximum and minimum wavelengths, or {@code null}. */ @Override - @XmlElement(name = "bandBoundaryDefinition", namespace = Namespaces.GMI) + @XmlElement(name = "bandBoundaryDefinition") public BandDefinition getBandBoundaryDefinition() { return bandBoundaryDefinition; } @@ -316,24 +322,6 @@ public class DefaultBand extends Default } /** - * {@inheritDoc} - */ - @Override - @ValueRange(minimum = 1) - @XmlElement(name = "bitsPerValue") - public Integer getBitsPerValue() { - return super.getBitsPerValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setBitsPerValue(final Integer newValue) { - super.setBitsPerValue(newValue); - } - - /** * Returns the number of discrete numerical values in the grid data. * * @return number of discrete numerical values in the grid data, or {@code null} if none. @@ -358,45 +346,14 @@ public class DefaultBand extends Default } /** - * {@inheritDoc} - */ - @Override - @XmlElement(name = "scaleFactor") - public Double getScaleFactor() { - return super.getScaleFactor(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setScaleFactor(final Double newValue) { - super.setScaleFactor(newValue); - } - - /** - * {@inheritDoc} - */ - @Override - @XmlElement(name = "offset") - public Double getOffset() { - return super.getOffset(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setOffset(final Double newValue) { - super.setOffset(newValue); - } - - /** - * {@inheritDoc} + * Returns the smallest distance between which separate points can be distinguished, + * as specified in instrument design. + * + * @return {@inheritDoc} */ @Override @ValueRange(minimum = 0, isMinIncluded = false) - @XmlElement(name = "nominalSpatialResolution", namespace = Namespaces.GMI) + @XmlElement(name = "nominalSpatialResolution") public Double getNominalSpatialResolution() { return super.getNominalSpatialResolution(); } @@ -410,10 +367,12 @@ public class DefaultBand extends Default } /** - * {@inheritDoc} + * Returns type of transfer function to be used when scaling a physical value for a given element. + * + * @return {@inheritDoc} */ @Override - @XmlElement(name = "transferFunctionType", namespace = Namespaces.GMI) + @XmlElement(name = "transferFunctionType") public TransferFunctionType getTransferFunctionType() { return super.getTransferFunctionType(); } @@ -432,7 +391,7 @@ public class DefaultBand extends Default * @return polarization of the radiation transmitted, or {@code null}. */ @Override - @XmlElement(name = "transmittedPolarization", namespace = Namespaces.GMI) + @XmlElement(name = "transmittedPolarisation") public PolarizationOrientation getTransmittedPolarization() { return transmittedPolarization; } @@ -453,7 +412,7 @@ public class DefaultBand extends Default * @return polarization of the radiation detected, or {@code null}. */ @Override - @XmlElement(name = "detectedPolarization", namespace = Namespaces.GMI) + @XmlElement(name = "detectedPolarisation") public PolarizationOrientation getDetectedPolarization() { return detectedPolarization; } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultCoverageDescription.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlType import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.metadata.Identifier; import org.opengis.metadata.content.AttributeGroup; import org.opengis.metadata.content.CoverageContentType; @@ -30,9 +31,11 @@ import org.opengis.metadata.content.Imag import org.opengis.metadata.content.RangeDimension; import org.opengis.metadata.content.RangeElementDescription; import org.opengis.util.RecordType; -import org.apache.sis.xml.Namespaces; import org.apache.sis.internal.metadata.Dependencies; import org.apache.sis.internal.metadata.LegacyPropertyAdapter; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.metadata.MD_Identifier; /** @@ -54,15 +57,18 @@ import org.apache.sis.internal.metadata. * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "MD_CoverageDescription_Type", propOrder = { "attributeDescription", - "contentType", - "dimensions", + "processingLevelCode", // New in ISO 19115:2014 + "attributeGroup", // Ibid. + "contentType", // Legacy ISO 19115:2003 + "dimensions", // Ibid. "rangeElementDescriptions" }) @XmlRootElement(name = "MD_CoverageDescription") @@ -175,13 +181,16 @@ public class DefaultCoverageDescription /** * Returns an identifier for the level of processing that has been applied to the resource, or {@code null} if none. + * For {@linkplain DefaultImageDescription image descriptions}, this is the image distributor's code that identifies + * the level of radiometric and geometric processing that has been applied. * * @return identifier for the level of processing that has been applied to the resource, or {@code null} if none. * * @since 0.5 */ @Override -/// @XmlElement(name = "processingLevelCode") + @XmlElement(name = "processingLevelCode") + @XmlJavaTypeAdapter(MD_Identifier.Since2014.class) public Identifier getProcessingLevelCode() { return processingLevelCode; } @@ -206,7 +215,7 @@ public class DefaultCoverageDescription * @since 0.5 */ @Override -/// @XmlElement(name = "attributeGroup") + // @XmlElement at the end of this class. public Collection<AttributeGroup> getAttributeGroups() { return attributeGroups = nonNullCollection(attributeGroups, AttributeGroup.class); } @@ -232,22 +241,24 @@ public class DefaultCoverageDescription */ @Override @Deprecated - @XmlElement(name = "contentType", required = true) @Dependencies("getAttributeGroups") + @XmlElement(name = "contentType", namespace = LegacyNamespaces.GMD) public CoverageContentType getContentType() { CoverageContentType type = null; - final Collection<AttributeGroup> groups = getAttributeGroups(); - if (groups != null) { // May be null on marshalling. - for (final AttributeGroup g : groups) { - final Collection<? extends CoverageContentType> contentTypes = g.getContentTypes(); - if (contentTypes != null) { // May be null on marshalling. - for (final CoverageContentType t : contentTypes) { - if (type == null) { - type = t; - } else { - LegacyPropertyAdapter.warnIgnoredExtraneous(CoverageContentType.class, - DefaultCoverageDescription.class, "getContentType"); - break; + if (FilterByVersion.LEGACY_METADATA.accept()) { + final Collection<AttributeGroup> groups = getAttributeGroups(); + if (groups != null) { // May be null on marshalling. + for (final AttributeGroup g : groups) { + final Collection<? extends CoverageContentType> contentTypes = g.getContentTypes(); + if (contentTypes != null) { // May be null on marshalling. + for (final CoverageContentType t : contentTypes) { + if (type == null) { + type = t; + } else { + LegacyPropertyAdapter.warnIgnoredExtraneous(CoverageContentType.class, + DefaultCoverageDescription.class, "getContentType"); + break; + } } } } @@ -297,9 +308,10 @@ public class DefaultCoverageDescription */ @Override @Deprecated - @XmlElement(name = "dimension") @Dependencies("getAttributeGroups") + @XmlElement(name = "dimension", namespace = LegacyNamespaces.GMD) public final Collection<RangeDimension> getDimensions() { + if (!FilterByVersion.LEGACY_METADATA.accept()) return null; return new LegacyPropertyAdapter<RangeDimension,AttributeGroup>(getAttributeGroups()) { /** Stores a legacy value into the new kind of value. */ @Override protected AttributeGroup wrap(final RangeDimension value) { @@ -345,7 +357,7 @@ public class DefaultCoverageDescription * @return description of the specific range elements of a coverage. */ @Override - @XmlElement(name = "rangeElementDescription", namespace = Namespaces.GMI) + @XmlElement(name = "rangeElementDescription") public Collection<RangeElementDescription> getRangeElementDescriptions() { return rangeElementDescriptions = nonNullCollection(rangeElementDescriptions, RangeElementDescription.class); } @@ -358,4 +370,28 @@ public class DefaultCoverageDescription public void setRangeElementDescriptions(final Collection<? extends RangeElementDescription> newValues) { rangeElementDescriptions = writeCollection(newValues, rangeElementDescriptions, RangeElementDescription.class); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked by JAXB at both marshalling and unmarshalling time. + * This attribute has been added by ISO 19115:2014 standard. + * If (and only if) marshalling an older standard version, we omit this attribute. + */ + @XmlElement(name = "attributeGroup") + private Collection<AttributeGroup> getAttributeGroup() { + return FilterByVersion.CURRENT_METADATA.accept() ? getAttributeGroups() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -21,10 +21,14 @@ import java.util.Collection; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.opengis.util.GenericName; import org.opengis.metadata.citation.Citation; import org.opengis.metadata.content.FeatureCatalogueDescription; import org.opengis.metadata.content.FeatureTypeInfo; +import org.apache.sis.internal.jaxb.FilterByVersion; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.gmd.LocaleAdapter; import org.apache.sis.internal.metadata.Dependencies; import org.apache.sis.internal.metadata.LegacyPropertyAdapter; @@ -51,16 +55,19 @@ import org.apache.sis.internal.metadata. * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @XmlType(name = "MD_FeatureCatalogueDescription_Type", propOrder = { "compliant", - "languages", + "locale", // New in ISO 19115:2014 + "language", // Legacy ISO 19115:2003 "includedWithDataset", - "featureTypes", + "featureTypesInfo", // New in ISO 19115:2014. Actual name is "featureTypeInfo" + "featureTypes", // Legacy ISO 19115:2003 "featureCatalogueCitations" }) @XmlRootElement(name = "MD_FeatureCatalogueDescription") @@ -179,7 +186,7 @@ public class DefaultFeatureCatalogueDesc * @return language(s) used within the catalogue. */ @Override - @XmlElement(name = "language") + // @XmlElement at the end of this class. public Collection<Locale> getLanguages() { return languages = nonNullCollection(languages, Locale.class); } @@ -199,7 +206,7 @@ public class DefaultFeatureCatalogueDesc * @return whether or not the feature catalogue is included with the resource. */ @Override - @XmlElement(name = "includedWithDataset", required = true) + @XmlElement(name = "includedWithDataset") public boolean isIncludedWithDataset() { return includedWithDataset; } @@ -222,6 +229,7 @@ public class DefaultFeatureCatalogueDesc * @since 0.5 */ @Override + // @XmlElement at the end of this class. public Collection<FeatureTypeInfo> getFeatureTypeInfo() { return featureTypes = nonNullCollection(featureTypes, FeatureTypeInfo.class); } @@ -246,9 +254,10 @@ public class DefaultFeatureCatalogueDesc */ @Override @Deprecated - @XmlElement(name = "featureTypes") @Dependencies("getFeatureTypeInfo") + @XmlElement(name = "featureTypes", namespace = LegacyNamespaces.GMD) public final Collection<GenericName> getFeatureTypes() { + if (!FilterByVersion.LEGACY_METADATA.accept()) return null; return new LegacyPropertyAdapter<GenericName,FeatureTypeInfo>(getFeatureTypeInfo()) { /** Stores a legacy value into the new kind of value. */ @Override protected FeatureTypeInfo wrap(final GenericName value) { @@ -290,7 +299,7 @@ public class DefaultFeatureCatalogueDesc * @return bibliographic reference to one or more external feature catalogues. */ @Override - @XmlElement(name = "featureCatalogueCitation", required = true) + @XmlElement(name = "featureCatalogueCitation") public Collection<Citation> getFeatureCatalogueCitations() { return featureCatalogueCitations = nonNullCollection(featureCatalogueCitations, Citation.class); } @@ -303,4 +312,47 @@ public class DefaultFeatureCatalogueDesc public void setFeatureCatalogueCitations(final Collection<? extends Citation> newValues) { featureCatalogueCitations = writeCollection(newValues, featureCatalogueCitations, Citation.class); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Invoked by JAXB at both marshalling and unmarshalling time. + * This attribute has been added by ISO 19115:2014 standard. + * If (and only if) marshalling an older standard version, we omit this attribute. + */ + @XmlElement(name = "featureTypes") + private Collection<FeatureTypeInfo> getFeatureTypesInfo() { + return FilterByVersion.CURRENT_METADATA.accept() ? getFeatureTypeInfo() : null; + } + + /** + * Returns the locale to marshal if the XML document is to be written + * according the new ISO 19115:2014 model. + */ + @XmlElement(name = "locale") + private Collection<Locale> getLocale() { + return FilterByVersion.CURRENT_METADATA.accept() ? getLanguages() : null; + } + + /** + * Returns the locale to marshal if the XML document is to be written + * according the legacy ISO 19115:2003 model. + */ + @XmlElement(name = "language", namespace = LegacyNamespaces.GMD) + @XmlJavaTypeAdapter(LocaleAdapter.class) + private Collection<Locale> getLanguage() { + return FilterByVersion.LEGACY_METADATA.accept() ? getLanguages() : null; + } } Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureTypeInfo.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureTypeInfo.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureTypeInfo.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureTypeInfo.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -42,7 +42,7 @@ import static org.apache.sis.internal.me * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * * @see org.apache.sis.storage.FeatureNaming * @see org.apache.sis.feature.DefaultFeatureType @@ -52,7 +52,7 @@ import static org.apache.sis.internal.me */ @SuppressWarnings("CloneableClassWithoutClone") // ModifiableMetadata needs shallow clones. @TitleProperty(name = "featureTypeName") -@XmlType(name = "MD_FeatureTypeInfo", propOrder = { +@XmlType(name = "MD_FeatureTypeInfo_Type", propOrder = { "featureTypeName", "featureInstanceCount" }) Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultImageDescription.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultImageDescription.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultImageDescription.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultImageDescription.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -23,6 +23,8 @@ import javax.xml.bind.annotation.XmlRoot import org.opengis.metadata.Identifier; import org.opengis.metadata.content.ImageDescription; import org.opengis.metadata.content.ImagingCondition; +import org.apache.sis.internal.jaxb.LegacyNamespaces; +import org.apache.sis.internal.jaxb.FilterByVersion; import org.apache.sis.measure.ValueRange; import static org.apache.sis.internal.metadata.MetadataUtilities.ensureInRange; @@ -48,7 +50,7 @@ import static org.apache.sis.internal.me * @author Martin Desruisseaux (IRD, Geomatys) * @author Touraïvane (IRD) * @author Cédric Briançon (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ @@ -59,7 +61,7 @@ import static org.apache.sis.internal.me "imagingCondition", "imageQualityCode", "cloudCoverPercentage", - "processingLevelCode", + "processingLevel", "compressionGenerationQuantity", "triangulationIndicator", "radiometricCalibrationDataAvailable", @@ -328,29 +330,6 @@ public class DefaultImageDescription ext } /** - * Returns the image distributor's code that identifies the level of radiometric and geometric - * processing that has been applied. - * - * @return the level of radiometric and geometric processing that has been applied, or {@code null} if unspecified. - */ - @Override - @XmlElement(name = "processingLevelCode") - public Identifier getProcessingLevelCode() { - return super.getProcessingLevelCode(); - } - - /** - * Sets the image distributor's code that identifies the level of radiometric and geometric - * processing that has been applied. - * - * @param newValue the new processing level code. - */ - @Override - public void setProcessingLevelCode(final Identifier newValue) { - super.setProcessingLevelCode(newValue); - } - - /** * Returns the count of the number of lossy compression cycles performed on the image. * * @return the number of lossy compression cycles performed on the image, or {@code null} if unspecified. @@ -481,4 +460,37 @@ public class DefaultImageDescription ext checkWritePermission(); lensDistortionInformationAvailable = newValue; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * An attribute which was defined in {@code ImageDescription} by ISO 19115:2003, + * and which moved to the parent class in ISO 19115:2014 revision. We handle the + * two versions separately for proper attribute ordering, and for avoiding this + * attribute to be written for subtypes other than {@code ImageDescription}. + */ + @XmlElement(name = "processingLevelCode", namespace = LegacyNamespaces.GMD) + private Identifier getProcessingLevel() { + return FilterByVersion.LEGACY_METADATA.accept() ? getProcessingLevelCode() : null; + } + + /** + * Invoked by JAXB at unmarshalling time. + */ + @SuppressWarnings("unused") + private void setProcessingLevel(final Identifier newValue) { + setProcessingLevelCode(newValue); + } }
