001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_assessment-common_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.datatype.adapter.UriReferenceAdapter;
007import dev.metaschema.core.model.IBoundObject;
008import dev.metaschema.core.model.IMetaschemaData;
009import dev.metaschema.core.model.constraint.IConstraint;
010import dev.metaschema.core.util.ObjectUtils;
011import dev.metaschema.databind.model.annotations.AllowedValue;
012import dev.metaschema.databind.model.annotations.AllowedValues;
013import dev.metaschema.databind.model.annotations.BoundFieldValue;
014import dev.metaschema.databind.model.annotations.BoundFlag;
015import dev.metaschema.databind.model.annotations.MetaschemaField;
016import dev.metaschema.databind.model.annotations.ValueConstraints;
017import edu.umd.cs.findbugs.annotations.NonNull;
018import edu.umd.cs.findbugs.annotations.Nullable;
019import java.net.URI;
020import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
021import org.apache.commons.lang3.builder.ToStringStyle;
022
023/**
024 * A pointer, by ID, to an externally-defined threat.
025 */
026@MetaschemaField(
027    formalName = "Threat ID",
028    description = "A pointer, by ID, to an externally-defined threat.",
029    name = "threat-id",
030    moduleClass = OscalAssessmentCommonModule.class
031)
032public class ThreatId implements IBoundObject {
033  private final IMetaschemaData __metaschemaData;
034
035  /**
036   * Specifies the source of the threat information.
037   */
038  @BoundFlag(
039      formalName = "Threat Type Identification System",
040      description = "Specifies the source of the threat information.",
041      name = "system",
042      required = true,
043      typeAdapter = UriAdapter.class,
044      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).",
045      valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-threat-id-system", level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "http://fedramp.gov", description = "\\*\\*deprecated\\*\\* The value conforms to FedRAMP definitions. This value has been deprecated; use `http://fedramp.gov/ns/oscal` instead.", deprecatedVersion = "1.0.3"), @AllowedValue(value = "http://fedramp.gov/ns/oscal", description = "The value conforms to FedRAMP definitions.")}))
046  )
047  private URI _system;
048
049  /**
050   * An optional location for the threat data, from which this ID originates.
051   */
052  @BoundFlag(
053      formalName = "Threat Information Resource Reference",
054      description = "An optional location for the threat data, from which this ID originates.",
055      name = "href",
056      typeAdapter = UriReferenceAdapter.class,
057      remarks = "This value may be one of:\n"
058              + "\n"
059              + "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n"
060              + "2. a [relative reference](https://pages.nist.gov/OSCAL/concepts/uri-use/#relative-reference) pointing to a network resolvable resource whose base URI is the URI of the containing document, or\n"
061              + "3. a bare URI fragment (i.e., \\`#uuid\\`) pointing to a `back-matter` resource in this or an imported document (see [linking to another OSCAL object](https://pages.nist.gov/OSCAL/concepts/uri-use/#linking-to-another-oscal-object))."
062  )
063  private URI _href;
064
065  /**
066   * The field value.
067   */
068  @BoundFieldValue(
069      valueKeyName = "id",
070      typeAdapter = UriAdapter.class
071  )
072  private URI _id;
073
074  /**
075   * Constructs a new {@code dev.metaschema.oscal.lib.model.ThreatId} instance with no metadata.
076   */
077  public ThreatId() {
078    this(null);
079  }
080
081  /**
082   * Constructs a new {@code dev.metaschema.oscal.lib.model.ThreatId} instance with the specified metadata.
083   *
084   * @param data
085   *           the metaschema data, or {@code null} if none
086   */
087  public ThreatId(IMetaschemaData data) {
088    this.__metaschemaData = data;
089  }
090
091  @Override
092  public IMetaschemaData getMetaschemaData() {
093    return __metaschemaData;
094  }
095
096  /**
097   * Get the "{@literal Threat Type Identification System}".
098   *
099   * <p>
100   * Specifies the source of the threat information.
101   *
102   * @return the system value
103   */
104  @NonNull
105  public URI getSystem() {
106    return _system;
107  }
108
109  /**
110   * Set the "{@literal Threat Type Identification System}".
111   *
112   * <p>
113   * Specifies the source of the threat information.
114   *
115   * @param value
116   *           the system value to set
117   */
118  public void setSystem(@NonNull URI value) {
119    _system = value;
120  }
121
122  /**
123   * Get the "{@literal Threat Information Resource Reference}".
124   *
125   * <p>
126   * An optional location for the threat data, from which this ID originates.
127   *
128   * @return the href value, or {@code null} if not set
129   */
130  @Nullable
131  public URI getHref() {
132    return _href;
133  }
134
135  /**
136   * Set the "{@literal Threat Information Resource Reference}".
137   *
138   * <p>
139   * An optional location for the threat data, from which this ID originates.
140   *
141   * @param value
142   *           the href value to set, or {@code null} to clear
143   */
144  public void setHref(@Nullable URI value) {
145    _href = value;
146  }
147
148  /**
149   * Get the field value.
150   *
151   * @return the value
152   */
153  @Nullable
154  public URI getId() {
155    return _id;
156  }
157
158  /**
159   * Set the field value.
160   *
161   * @param value
162   *           the value to set
163   */
164  public void setId(@Nullable URI value) {
165    _id = value;
166  }
167
168  @Override
169  public String toString() {
170    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
171  }
172}