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 gov.nist.secauto.metaschema.model.common.datatype.adapter.UriReferenceAdapter;
012import java.lang.Override;
013import java.lang.String;
014import java.net.URI;
015import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
016import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
017
018/**
019 * A pointer, by ID, to an externally-defined threat.
020 */
021@MetaschemaField(
022    formalName = "Threat ID",
023    description = "A pointer, by ID, to an externally-defined threat.",
024    name = "threat-id",
025    metaschema = OscalAssessmentCommonMetaschema.class,
026    isCollapsible = false
027)
028public class ThreatId {
029  @MetaschemaFieldValue(
030      valueKeyName = "id",
031      typeAdapter = UriAdapter.class
032  )
033  private URI _value;
034
035  @BoundFlag(
036      formalName = "Threat Type Identification System",
037      description = "Specifies the source of the threat information.",
038      useName = "system",
039      required = true,
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  )
043  @ValueConstraints(
044      allowedValues = @AllowedValues(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."), @AllowedValue(value = "http://fedramp.gov/ns/oscal", description = "The value conforms to FedRAMP definitions.")})
045  )
046  private URI _system;
047
048  @BoundFlag(
049      formalName = "Threat Information Resource Reference",
050      description = "An optional location for the threat data, from which this ID originates.",
051      useName = "href",
052      typeAdapter = UriReferenceAdapter.class,
053      remarks = "This value may be one of:\n"
054              + "\n"
055              + "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n"
056              + "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"
057              + "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))."
058  )
059  private URI _href;
060
061  public ThreatId() {
062  }
063
064  public URI getValue() {
065    return _value;
066  }
067
068  public void setValue(URI value) {
069    _value = value;
070  }
071
072  public URI getSystem() {
073    return _system;
074  }
075
076  public void setSystem(URI value) {
077    _system = value;
078  }
079
080  public URI getHref() {
081    return _href;
082  }
083
084  public void setHref(URI value) {
085    _href = value;
086  }
087
088  @Override
089  public String toString() {
090    return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
091  }
092}