001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
004import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
005import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
006import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaField;
007import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaFieldValue;
008import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
009import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
010import gov.nist.secauto.metaschema.model.common.datatype.adapter.UriAdapter;
011import java.lang.Override;
012import java.lang.String;
013import java.net.URI;
014import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
015import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
016
017/**
018 * A document identifier qualified by an identifier <code>scheme</code>.
019 */
020@MetaschemaField(
021    formalName = "Document Identifier",
022    description = "A document identifier qualified by an identifier `scheme`.",
023    name = "document-id",
024    metaschema = OscalMetadataMetaschema.class,
025    isCollapsible = false
026)
027public class DocumentId {
028  @MetaschemaFieldValue(
029      valueKeyName = "identifier"
030  )
031  private String _value;
032
033  @BoundFlag(
034      formalName = "Document Identification Scheme",
035      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.",
036      useName = "scheme",
037      typeAdapter = UriAdapter.class,
038      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)."
039  )
040  @ValueConstraints(
041      allowedValues = @AllowedValues(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."))
042  )
043  private URI _scheme;
044
045  public DocumentId() {
046  }
047
048  public String getValue() {
049    return _value;
050  }
051
052  public void setValue(String value) {
053    _value = value;
054  }
055
056  public URI getScheme() {
057    return _scheme;
058  }
059
060  public void setScheme(URI value) {
061    _scheme = value;
062  }
063
064  @Override
065  public String toString() {
066    return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
067  }
068}