/** * 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 DefaultKeywords}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultKeywords} instance is created using the * {@linkplain #DefaultKeywords(Keywords) 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 DefaultKeywords castOrCopy(final Keywords object) { if (object == null || object instanceof DefaultKeywords) { return (DefaultKeywords) object; } return new DefaultKeywords(object); }
/** * Converts a GeoAPI interface to the SIS implementation for XML marshalling. * * @param value the bound type value, here the GeoAPI interface. * @return the adapter for the given value, here the SIS implementation. */ @Override public DefaultKeywords marshal(final Keywords value) { return DefaultKeywords.castOrCopy(value); } }
/** * Sets the name of the formally registered thesaurus or a similar authoritative source of keywords. * * @param newValue the new thesaurus name. */ public void setThesaurusName(final Citation newValue) { checkWritePermission(thesaurusName); thesaurusName = newValue; }
if (i18n != null) { if (list == null) { group = new DefaultKeywords(); group.setType(type); group.setThesaurusName(sharedCitation(trim(thesaurusName))); list = group.getKeywords();
final DefaultKeywords keywords = new DefaultKeywords( "EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature"); keywords.setType(KeywordType.THEME); keywords.setThesaurusName(new DefaultCitation("GCMD Science Keywords"));
/** * Tests {@link DefaultKeywords#DefaultKeywords(CharSequence[])}. */ @Test public void testConstructor() { final DefaultKeywords keywords = new DefaultKeywords("Keyword 1", "Keyword 2", "Keyword 3"); assertArrayEquals(new Object[] { new SimpleInternationalString("Keyword 1"), new SimpleInternationalString("Keyword 2"), new SimpleInternationalString("Keyword 3") }, keywords.getKeywords().toArray()); } }
if (i18n != null) { if (list == null) { group = new DefaultKeywords(); group.setType(type); group.setThesaurusName(sharedCitation(trim(thesaurusName))); list = group.getKeywords();
final DefaultKeywords keyword = new DefaultKeywords( new Anchor(URI.create("SDN:P021:35:ATTN"), "Transmittance and attenuance of the water column")); keyword.setType(KeywordType.THEME); final DefaultCitation thesaurus = new DefaultCitation("BODC Parameter Discovery Vocabulary"); thesaurus.setAlternateTitles(singleton(new SimpleInternationalString("P021"))); thesaurus.setEdition(new Anchor(URI.create("SDN:C371:1:35"), "35")); thesaurus.setIdentifiers(singleton(new ImmutableIdentifier(null, null, "http://www.seadatanet.org/urnurl/"))); keyword.setThesaurusName(thesaurus); identification.setDescriptiveKeywords(singleton(keyword));
/** * 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 DefaultKeywords}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultKeywords} instance is created using the * {@linkplain #DefaultKeywords(Keywords) 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 DefaultKeywords castOrCopy(final Keywords object) { if (object == null || object instanceof DefaultKeywords) { return (DefaultKeywords) object; } return new DefaultKeywords(object); }
/** * Sets the subject matter used to group similar keywords. * * @param newValue the new keyword type. */ public void setType(final KeywordType newValue) { checkWritePermission(type); type = newValue; }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <gmd:MD_Keywords>} 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 DefaultKeywords getElement() { return DefaultKeywords.castOrCopy(metadata); }
/** * ISO 19115 metadata property determined by the {@link #keywords} field. * This is part of the information returned by {@link #getIdentificationInfo()}. * * @return category keywords, their type, and reference source. */ @Override public Collection<Keywords> getDescriptiveKeywords() { if (keywords != null) { return Collections.singleton(new DefaultKeywords(keywords.toArray(new String[keywords.size()]))); } return super.getDescriptiveKeywords(); }
/** * Sets the subject matter used to group similar keywords. * * @param newValue the new keyword type. */ public void setType(final KeywordType newValue) { checkWritePermission(); type = newValue; }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <mri:MD_Keywords>} 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 DefaultKeywords getElement() { return DefaultKeywords.castOrCopy(metadata); }
/** * Sets the name of the formally registered thesaurus or a similar authoritative source of keywords. * * @param newValue the new thesaurus name. */ public void setThesaurusName(final Citation newValue) { checkWritePermission(); thesaurusName = newValue; }
/** * Sets the user-defined categorization of groups of keywords. * * <div class="warning"><b>Upcoming API change — generalization</b><br> * The argument type will be changed to the {@code KeywordClass} interface when GeoAPI will provide it * (tentatively in GeoAPI 3.1).</div> * * @param newValue new user-defined categorization of groups of keywords. * * @since 0.5 */ public void setKeywordClass(final DefaultKeywordClass newValue) { checkWritePermission(keywordClass); keywordClass = newValue; } }
checkWritePermission(); keywordClass = newValue;