001package gov.nist.secauto.oscal.lib.model; 002 003import gov.nist.secauto.metaschema.core.datatype.adapter.UriAdapter; 004import gov.nist.secauto.metaschema.core.datatype.adapter.UriReferenceAdapter; 005import gov.nist.secauto.metaschema.core.model.IBoundObject; 006import gov.nist.secauto.metaschema.core.model.IMetaschemaData; 007import gov.nist.secauto.metaschema.core.model.constraint.IConstraint; 008import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue; 009import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues; 010import gov.nist.secauto.metaschema.databind.model.annotations.BoundFieldValue; 011import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag; 012import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaField; 013import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints; 014import java.lang.Override; 015import java.lang.String; 016import java.net.URI; 017import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 018import org.apache.commons.lang3.builder.ToStringStyle; 019 020/** 021 * A pointer, by ID, to an externally-defined threat. 022 */ 023@MetaschemaField( 024 formalName = "Threat ID", 025 description = "A pointer, by ID, to an externally-defined threat.", 026 name = "threat-id", 027 moduleClass = OscalAssessmentCommonModule.class 028) 029public class ThreatId implements IBoundObject { 030 private final IMetaschemaData __metaschemaData; 031 032 /** 033 * "Specifies the source of the threat information." 034 */ 035 @BoundFlag( 036 formalName = "Threat Type Identification System", 037 description = "Specifies the source of the threat information.", 038 name = "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 valueConstraints = @ValueConstraints(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.", deprecatedVersion = "1.0.3"), @AllowedValue(value = "http://fedramp.gov/ns/oscal", description = "The value conforms to FedRAMP definitions.")})) 043 ) 044 private URI _system; 045 046 /** 047 * "An optional location for the threat data, from which this ID originates." 048 */ 049 @BoundFlag( 050 formalName = "Threat Information Resource Reference", 051 description = "An optional location for the threat data, from which this ID originates.", 052 name = "href", 053 typeAdapter = UriReferenceAdapter.class, 054 remarks = "This value may be one of:\n" 055 + "\n" 056 + "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n" 057 + "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" 058 + "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))." 059 ) 060 private URI _href; 061 062 @BoundFieldValue( 063 valueKeyName = "id", 064 typeAdapter = UriAdapter.class 065 ) 066 private URI _id; 067 068 public ThreatId() { 069 this(null); 070 } 071 072 public ThreatId(IMetaschemaData data) { 073 this.__metaschemaData = data; 074 } 075 076 @Override 077 public IMetaschemaData getMetaschemaData() { 078 return __metaschemaData; 079 } 080 081 public URI getSystem() { 082 return _system; 083 } 084 085 public void setSystem(URI value) { 086 _system = value; 087 } 088 089 public URI getHref() { 090 return _href; 091 } 092 093 public void setHref(URI value) { 094 _href = value; 095 } 096 097 public URI getId() { 098 return _id; 099 } 100 101 public void setId(URI value) { 102 _id = value; 103 } 104 105 @Override 106 public String toString() { 107 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 108 } 109}