/** * Creates the distribution information object if it does not already exists, then returns it. * * @return the distribution information (never {@code null}). * @see #newDistribution() */ private DefaultDistribution distribution() { if (distribution == null) { distribution = new DefaultDistribution(); } return distribution; }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <gmd:MD_Distribution>} XML element. * This is the value or a copy of the value given in argument to the {@code wrap} method. * * @return the metadata to be marshalled. */ @XmlElementRef public DefaultDistribution getElement() { return DefaultDistribution.castOrCopy(metadata); }
/** * Sets a brief description of a set of distribution options. * * @param newValue the new description. * * @since 0.5 */ public void setDescription(final InternationalString newValue) { checkWritePermission(); description = newValue; }
final DefaultDistribution distributionInfo = new DefaultDistribution(); distributor.setRole(Role.DISTRIBUTOR); distributionInfo.setDistributors(singleton(new DefaultDistributor(distributor))); specification.setEdition(new SimpleInternationalString("1.0")); format.setFormatSpecificationCitation(specification); distributionInfo.setDistributionFormats(singleton(format)); onlines.setProtocol("http"); transfer.setOnLines(singleton(onlines)); distributionInfo.setTransferOptions(singleton(transfer)); metadata.setDistributionInfo(distributionInfo);
/** * Creates the metadata object corresponding to the {@link #JSON} string. */ static DefaultMetadata createMetadata() { final AbstractIdentification identification = new AbstractIdentification(); identification.setCitation(new DefaultCitation("Data \"title\"")); identification.setExtents(singleton(new DefaultExtent(null, new DefaultGeographicBoundingBox(-11.4865013, -4.615912, 43.165467, 49.9990223), null, null))); final DefaultDistribution distribution = new DefaultDistribution(); distribution.setDistributors(asList( new DefaultDistributor(new DefaultResponsibility(Role.AUTHOR, null, null)), new DefaultDistributor(new DefaultResponsibility(Role.COLLABORATOR, null, null)))); final DefaultMetadata metadata = new DefaultMetadata(); metadata.setFileIdentifier("An archive"); metadata.setLanguage(Locale.ENGLISH); metadata.setCharacterSets(singleton(StandardCharsets.UTF_8)); metadata.setMetadataStandardName("ISO19115"); metadata.setMetadataStandardVersion("2003/Cor.1:2006"); metadata.setIdentificationInfo(singleton(identification)); metadata.setDistributionInfo(singleton(distribution)); return metadata; }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Distribution) */ public DefaultDistribution(final Distribution object) { super(object); if (object != null) { distributionFormats = copyCollection(object.getDistributionFormats(), Format.class); distributors = copyCollection(object.getDistributors(), Distributor.class); transferOptions = copyCollection(object.getTransferOptions(), DigitalTransferOptions.class); if (object instanceof DefaultDistribution) { description = ((DefaultDistribution) object).getDescription(); } } }
/** * Adds a distributor. This is often the same than the above responsible party. * Storage location is: * * <ul> * <li>{@code metadata/distributionInfo/distributor/distributorContact}</li> * </ul> * * @param distributor the distributor, or {@code null} for no-operation. */ public final void addDistributor(final ResponsibleParty distributor) { if (distributor != null) { addIfNotPresent(distribution().getDistributors(), new DefaultDistributor(distributor)); } }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Distribution) */ public DefaultDistribution(final Distribution object) { super(object); if (object != null) { distributionFormats = copyCollection(object.getDistributionFormats(), Format.class); distributors = copyCollection(object.getDistributors(), Distributor.class); transferOptions = copyCollection(object.getTransferOptions(), DigitalTransferOptions.class); if (object instanceof DefaultDistribution) { description = ((DefaultDistribution) object).getDescription(); } } }
/** * Adds a distributor. This is often the same than the above responsible party. * Storage location is: * * <ul> * <li>{@code metadata/distributionInfo/distributor/distributorContact}</li> * </ul> * * @param distributor the distributor, or {@code null} for no-operation. */ public final void addDistributor(final ResponsibleParty distributor) { if (distributor != null) { addIfNotPresent(distribution().getDistributors(), new DefaultDistributor(distributor)); } }
/** * Creates the distribution information object if it does not already exists, then returns it. * * @return the distribution information (never {@code null}). * @see #newDistribution() */ private DefaultDistribution distribution() { if (distribution == null) { distribution = new DefaultDistribution(); } return distribution; }
/** * Sets a brief description of a set of distribution options. * * @param newValue the new description. * * @since 0.5 */ public void setDescription(final InternationalString newValue) { checkWritePermission(description); description = newValue; }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <mrd:MD_Distribution>} XML element. * This is the value or a copy of the value given in argument to the {@code wrap} method. * * @return the metadata to be marshalled. */ @XmlElementRef public DefaultDistribution getElement() { return DefaultDistribution.castOrCopy(metadata); }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultDistribution}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultDistribution} instance is created using the * {@linkplain #DefaultDistribution(Distribution) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultDistribution castOrCopy(final Distribution object) { if (object == null || object instanceof DefaultDistribution) { return (DefaultDistribution) object; } return new DefaultDistribution(object); }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultDistribution}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultDistribution} instance is created using the * {@linkplain #DefaultDistribution(Distribution) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultDistribution castOrCopy(final Distribution object) { if (object == null || object instanceof DefaultDistribution) { return (DefaultDistribution) object; } return new DefaultDistribution(object); }