1 package gov.nist.secauto.oscal.lib.model;
2
3 import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
4 import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
5 import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
6 import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaField;
7 import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaFieldValue;
8 import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
9 import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
10 import gov.nist.secauto.metaschema.model.common.datatype.adapter.UriAdapter;
11 import gov.nist.secauto.metaschema.model.common.datatype.adapter.UriReferenceAdapter;
12 import java.lang.Override;
13 import java.lang.String;
14 import java.net.URI;
15 import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
16 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
17
18
19
20
21 @MetaschemaField(
22 formalName = "Threat ID",
23 description = "A pointer, by ID, to an externally-defined threat.",
24 name = "threat-id",
25 metaschema = OscalAssessmentCommonMetaschema.class,
26 isCollapsible = false
27 )
28 public class ThreatId {
29 @MetaschemaFieldValue(
30 valueKeyName = "id",
31 typeAdapter = UriAdapter.class
32 )
33 private URI _value;
34
35 @BoundFlag(
36 formalName = "Threat Type Identification System",
37 description = "Specifies the source of the threat information.",
38 useName = "system",
39 required = true,
40 typeAdapter = UriAdapter.class,
41 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)."
42 )
43 @ValueConstraints(
44 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.")})
45 )
46 private URI _system;
47
48 @BoundFlag(
49 formalName = "Threat Information Resource Reference",
50 description = "An optional location for the threat data, from which this ID originates.",
51 useName = "href",
52 typeAdapter = UriReferenceAdapter.class,
53 remarks = "This value may be one of:\n"
54 + "\n"
55 + "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n"
56 + "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"
57 + "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))."
58 )
59 private URI _href;
60
61 public ThreatId() {
62 }
63
64 public URI getValue() {
65 return _value;
66 }
67
68 public void setValue(URI value) {
69 _value = value;
70 }
71
72 public URI getSystem() {
73 return _system;
74 }
75
76 public void setSystem(URI value) {
77 _system = value;
78 }
79
80 public URI getHref() {
81 return _href;
82 }
83
84 public void setHref(URI value) {
85 _href = value;
86 }
87
88 @Override
89 public String toString() {
90 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
91 }
92 }