Java Code Examples for org.opengis.referencing.ReferenceIdentifier#getVersion()

The following examples show how to use org.opengis.referencing.ReferenceIdentifier#getVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MD_Identifier.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Invoked by JAXB at marshalling time for getting the actual metadata to write
 * inside the {@code <mcc:MD_Identifier>} or {@code RS_Identifier} 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 final DefaultIdentifier getElement() {
    if (FilterByVersion.LEGACY_METADATA.accept() && metadata instanceof ReferenceIdentifier) {
        /*
         * In legacy specification, "code space" and "version" were not defined in <gmd:MD_Identifier> but were
         * defined in <gmd:RS_Identifier> subclass. In newer specification there is no longer such special case.
         * Note that "description" did not existed anywhere in legacy specification.
         */
        final ReferenceIdentifier id = (ReferenceIdentifier) metadata;
        if (id.getCodeSpace() != null || id.getVersion() != null) {
            return RS_Identifier.wrap(id);
        }
    }
    return DefaultIdentifier.castOrCopy(metadata);
}
 
Example 2
Source File: ImmutableIdentifier.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new identifier from the specified one. This is a copy constructor which
 * get the code, codespace, authority and version from the given identifier.
 *
 * @param identifier  the identifier to copy.
 *
 * @see #castOrCopy(ReferenceIdentifier)
 */
public ImmutableIdentifier(final ReferenceIdentifier identifier) {
    ensureNonNull("identifier", identifier);
    code        = identifier.getCode();
    codeSpace   = identifier.getCodeSpace();
    authority   = identifier.getAuthority();
    version     = identifier.getVersion();
    if (identifier instanceof DefaultIdentifier) {
        description = ((DefaultIdentifier) identifier).getDescription();
    } else {
        description = null;
    }
    validate(null);
}
 
Example 3
Source File: Code.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a wrapper initialized to the values of the given identifier.
 * Version number, if presents, will be appended after the codespace with a semicolon separator.
 * The {@link #getIdentifier()} method shall be able to perform the opposite operation (split the
 * above in separated codespace and version attributes).
 *
 * @param identifier  the identifier from which to get the values.
 */
Code(final ReferenceIdentifier identifier) {
    code      = identifier.getCode();
    codeSpace = identifier.getCodeSpace();
    String version = identifier.getVersion();
    if (version != null) {
        final StringBuilder buffer = new StringBuilder();
        if (codeSpace != null) {
            buffer.append(codeSpace);
        }
        codeSpace = buffer.append(DefinitionURI.SEPARATOR).append(version).toString();
    }
}