001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_metadata_metaschema.xml
002// Do not edit - changes will be lost when regenerated.
003package dev.metaschema.oscal.lib.model;
004
005import dev.metaschema.core.datatype.adapter.UriAdapter;
006import dev.metaschema.core.model.IBoundObject;
007import dev.metaschema.core.model.IMetaschemaData;
008import dev.metaschema.core.model.constraint.IConstraint;
009import dev.metaschema.core.util.ObjectUtils;
010import dev.metaschema.databind.model.annotations.AllowedValue;
011import dev.metaschema.databind.model.annotations.AllowedValues;
012import dev.metaschema.databind.model.annotations.BoundFieldValue;
013import dev.metaschema.databind.model.annotations.BoundFlag;
014import dev.metaschema.databind.model.annotations.MetaschemaField;
015import dev.metaschema.databind.model.annotations.ValueConstraints;
016import edu.umd.cs.findbugs.annotations.Nullable;
017import java.net.URI;
018import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
019import org.apache.commons.lang3.builder.ToStringStyle;
020
021/**
022 * A document identifier qualified by an identifier <code>scheme</code>.
023 */
024@MetaschemaField(
025    formalName = "Document Identifier",
026    description = "A document identifier qualified by an identifier `scheme`.",
027    name = "document-id",
028    moduleClass = OscalMetadataModule.class
029)
030public class DocumentId implements IBoundObject {
031  private final IMetaschemaData __metaschemaData;
032
033  /**
034   * Qualifies the kind of document identifier using a URI. If the scheme is not provided the value of the element will be interpreted as a string of characters.
035   */
036  @BoundFlag(
037      formalName = "Document Identification Scheme",
038      description = "Qualifies the kind of document identifier using a URI. If the scheme is not provided the value of the element will be interpreted as a string of characters.",
039      name = "scheme",
040      typeAdapter = UriAdapter.class,
041      remarks = "This value must be an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that serves as a [naming system identifier](https://pages.nist.gov/OSCAL/concepts/uri-use/#use-as-a-naming-system-identifier).",
042      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-metadata-document-id-scheme-values", level = IConstraint.Level.ERROR, allowOthers = true, values = @AllowedValue(value = "http://www.doi.org/", description = "A [Digital Object Identifier](https://www.doi.org/hb.html) (DOI); use is preferred, since this allows for retrieval of a full bibliographic record.")))
043  )
044  private URI _scheme;
045
046  /**
047   * The field value.
048   */
049  @BoundFieldValue(
050      valueKeyName = "identifier"
051  )
052  private String _identifier;
053
054  /**
055   * Constructs a new {@code dev.metaschema.oscal.lib.model.DocumentId} instance with no metadata.
056   */
057  public DocumentId() {
058    this(null);
059  }
060
061  /**
062   * Constructs a new {@code dev.metaschema.oscal.lib.model.DocumentId} instance with the specified metadata.
063   *
064   * @param data
065   *           the metaschema data, or {@code null} if none
066   */
067  public DocumentId(IMetaschemaData data) {
068    this.__metaschemaData = data;
069  }
070
071  @Override
072  public IMetaschemaData getMetaschemaData() {
073    return __metaschemaData;
074  }
075
076  /**
077   * Get the "{@literal Document Identification Scheme}".
078   *
079   * <p>
080   * Qualifies the kind of document identifier using a URI. If the scheme is not provided the value of the element will be interpreted as a string of characters.
081   *
082   * @return the scheme value, or {@code null} if not set
083   */
084  @Nullable
085  public URI getScheme() {
086    return _scheme;
087  }
088
089  /**
090   * Set the "{@literal Document Identification Scheme}".
091   *
092   * <p>
093   * Qualifies the kind of document identifier using a URI. If the scheme is not provided the value of the element will be interpreted as a string of characters.
094   *
095   * @param value
096   *           the scheme value to set, or {@code null} to clear
097   */
098  public void setScheme(@Nullable URI value) {
099    _scheme = value;
100  }
101
102  /**
103   * Get the field value.
104   *
105   * @return the value
106   */
107  @Nullable
108  public String getIdentifier() {
109    return _identifier;
110  }
111
112  /**
113   * Set the field value.
114   *
115   * @param value
116   *           the value to set
117   */
118  public void setIdentifier(@Nullable String value) {
119    _identifier = value;
120  }
121
122  @Override
123  public String toString() {
124    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
125  }
126}