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.BoundAssembly; 006import gov.nist.secauto.metaschema.binding.model.annotations.BoundField; 007import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue; 008import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag; 009import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs; 010import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly; 011import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints; 012import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior; 013import gov.nist.secauto.metaschema.model.common.constraint.IConstraint; 014import gov.nist.secauto.metaschema.model.common.datatype.adapter.StringAdapter; 015import gov.nist.secauto.metaschema.model.common.datatype.adapter.TokenAdapter; 016import gov.nist.secauto.metaschema.model.common.datatype.adapter.UriAdapter; 017import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline; 018import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter; 019import gov.nist.secauto.metaschema.model.common.util.ObjectUtils; 020import java.lang.Override; 021import java.lang.String; 022import java.net.URI; 023import java.util.LinkedList; 024import java.util.List; 025import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle; 026import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 027 028/** 029 * A collection of descriptive data about the containing object from a specific origin. 030 */ 031@MetaschemaAssembly( 032 formalName = "Characterization", 033 description = "A collection of descriptive data about the containing object from a specific origin.", 034 name = "characterization", 035 metaschema = OscalAssessmentCommonMetaschema.class 036) 037public class Characterization { 038 @BoundAssembly( 039 formalName = "Property", 040 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 041 useName = "prop", 042 maxOccurs = -1 043 ) 044 @GroupAs( 045 name = "props", 046 inJson = JsonGroupAsBehavior.LIST 047 ) 048 private List<Property> _props; 049 050 @BoundAssembly( 051 formalName = "Link", 052 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 053 useName = "link", 054 maxOccurs = -1 055 ) 056 @GroupAs( 057 name = "links", 058 inJson = JsonGroupAsBehavior.LIST 059 ) 060 private List<Link> _links; 061 062 @BoundAssembly( 063 formalName = "Origin", 064 description = "Identifies the source of the finding, such as a tool, interviewed person, or activity.", 065 useName = "origin", 066 minOccurs = 1, 067 remarks = "metadata about the specific actor that generated this descriptive data." 068 ) 069 private Origin _origin; 070 071 /** 072 * "An individual characteristic that is part of a larger set produced by the same actor." 073 */ 074 @BoundAssembly( 075 formalName = "Facet", 076 description = "An individual characteristic that is part of a larger set produced by the same actor.", 077 useName = "facet", 078 minOccurs = 1, 079 maxOccurs = -1 080 ) 081 @GroupAs( 082 name = "facets", 083 inJson = JsonGroupAsBehavior.LIST 084 ) 085 private List<Facet> _facets; 086 087 public Characterization() { 088 } 089 090 public List<Property> getProps() { 091 return _props; 092 } 093 094 public void setProps(List<Property> value) { 095 _props = value; 096 } 097 098 /** 099 * Add a new {@link Property} item to the underlying collection. 100 * @param item the item to add 101 * @return {@code true} 102 */ 103 public boolean addProp(Property item) { 104 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 105 if (_props == null) { 106 _props = new LinkedList<>(); 107 } 108 return _props.add(value); 109 } 110 111 /** 112 * Remove the first matching {@link Property} item from the underlying collection. 113 * @param item the item to remove 114 * @return {@code true} if the item was removed or {@code false} otherwise 115 */ 116 public boolean removeProp(Property item) { 117 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 118 return _props == null ? false : _props.remove(value); 119 } 120 121 public List<Link> getLinks() { 122 return _links; 123 } 124 125 public void setLinks(List<Link> value) { 126 _links = value; 127 } 128 129 /** 130 * Add a new {@link Link} item to the underlying collection. 131 * @param item the item to add 132 * @return {@code true} 133 */ 134 public boolean addLink(Link item) { 135 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 136 if (_links == null) { 137 _links = new LinkedList<>(); 138 } 139 return _links.add(value); 140 } 141 142 /** 143 * Remove the first matching {@link Link} item from the underlying collection. 144 * @param item the item to remove 145 * @return {@code true} if the item was removed or {@code false} otherwise 146 */ 147 public boolean removeLink(Link item) { 148 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 149 return _links == null ? false : _links.remove(value); 150 } 151 152 public Origin getOrigin() { 153 return _origin; 154 } 155 156 public void setOrigin(Origin value) { 157 _origin = value; 158 } 159 160 public List<Facet> getFacets() { 161 return _facets; 162 } 163 164 public void setFacets(List<Facet> value) { 165 _facets = value; 166 } 167 168 /** 169 * Add a new {@link Facet} item to the underlying collection. 170 * @param item the item to add 171 * @return {@code true} 172 */ 173 public boolean addFacet(Facet item) { 174 Facet value = ObjectUtils.requireNonNull(item,"item cannot be null"); 175 if (_facets == null) { 176 _facets = new LinkedList<>(); 177 } 178 return _facets.add(value); 179 } 180 181 /** 182 * Remove the first matching {@link Facet} item from the underlying collection. 183 * @param item the item to remove 184 * @return {@code true} if the item was removed or {@code false} otherwise 185 */ 186 public boolean removeFacet(Facet item) { 187 Facet value = ObjectUtils.requireNonNull(item,"item cannot be null"); 188 return _facets == null ? false : _facets.remove(value); 189 } 190 191 @Override 192 public String toString() { 193 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString(); 194 } 195 196 /** 197 * An individual characteristic that is part of a larger set produced by the same actor. 198 */ 199 @MetaschemaAssembly( 200 formalName = "Facet", 201 description = "An individual characteristic that is part of a larger set produced by the same actor.", 202 name = "facet", 203 metaschema = OscalAssessmentCommonMetaschema.class 204 ) 205 @ValueConstraints( 206 allowedValues = { 207 @AllowedValues(level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = @AllowedValue(value = "state", description = "Indicates if the facet is 'initial' as first identified, or 'adjusted' indicating that the value has be changed after some adjustments have been made (e.g., to identify residual risk).")), 208 @AllowedValues(level = IConstraint.Level.ERROR, target = "prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='state']/@value", values = {@AllowedValue(value = "initial", description = "As first identified."), @AllowedValue(value = "adjusted", description = "Indicates that residual risk remains after some adjustments have been made.")}), 209 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://csrc.nist.gov/ns/oscal']/@name", values = {@AllowedValue(value = "likelihood", description = "General likelihood rating."), @AllowedValue(value = "impact", description = "General impact rating."), @AllowedValue(value = "risk", description = "General risk rating."), @AllowedValue(value = "severity", description = "General severity rating.")}), 210 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://fedramp.gov','http://fedramp.gov/ns/oscal')]/@name", values = {@AllowedValue(value = "likelihood", description = "Likelihood as defined by FedRAMP. The `class` can be used to specify 'initial' and 'adjusted' risk states."), @AllowedValue(value = "impact", description = "Impact as defined by FedRAMP. The `class` can be used to specify 'initial' and 'adjusted' risk states."), @AllowedValue(value = "risk", description = "Risk as calculated according to FedRAMP. The `class` can be used to specify 'initial' and 'adjusted' risk states.")}), 211 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://cve.mitre.org']/@name", values = @AllowedValue(value = "cve-id", description = "An identifier managed by the CVE program (see https://cve.mitre.org/).")), 212 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0']/@name", values = {@AllowedValue(value = "access-vector", description = "Base: Access Vector"), @AllowedValue(value = "access-complexity", description = "Base: Access Complexity"), @AllowedValue(value = "authentication", description = "Base: Authentication"), @AllowedValue(value = "confidentiality-impact", description = "Base: Confidentiality Impact"), @AllowedValue(value = "integrity-impact", description = "Base: Integrity Impact"), @AllowedValue(value = "availability-impact", description = "Base: Availability Impact"), @AllowedValue(value = "exploitability", description = "Temporal: Exploitability"), @AllowedValue(value = "remediation-level", description = "Temporal: Remediation Level"), @AllowedValue(value = "report-confidence", description = "Temporal: Report Confidence"), @AllowedValue(value = "collateral-damage-potential", description = "Environmental: Collateral Damage Potential"), @AllowedValue(value = "target-distribution", description = "Environmental: Target Distribution"), @AllowedValue(value = "confidentiality-requirement", description = "Environmental: Confidentiality Requirement"), @AllowedValue(value = "integrity-requirement", description = "Environmental: Integrity Requirement"), @AllowedValue(value = "availability-requirement", description = "Environmental: Availability Requirement")}), 213 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name='access-vector']/@value", values = {@AllowedValue(value = "local", description = "Local"), @AllowedValue(value = "adjacent-network", description = "Network Adjacent"), @AllowedValue(value = "network", description = "Network")}), 214 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name='access-complexity']/@value", values = {@AllowedValue(value = "high", description = "High"), @AllowedValue(value = "medium", description = "Medium"), @AllowedValue(value = "low", description = "Low")}), 215 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name='authentication']/@value", values = {@AllowedValue(value = "multiple", description = "Multiple"), @AllowedValue(value = "single", description = "Single"), @AllowedValue(value = "none", description = "None")}), 216 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name=('confidentiality-impact', 'integrity-impact', 'availability-impact')]/@value", values = {@AllowedValue(value = "none", description = "None"), @AllowedValue(value = "partial", description = "Partial"), @AllowedValue(value = "complete", description = "Complete")}), 217 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name='exploitability']/@value", values = {@AllowedValue(value = "unproven", description = "Unproven"), @AllowedValue(value = "proof-of-concept", description = "Proof-of-Concept"), @AllowedValue(value = "functional", description = "Functional"), @AllowedValue(value = "high", description = "High"), @AllowedValue(value = "not-defined", description = "Not Defined")}), 218 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name='remediation-level']/@value", values = {@AllowedValue(value = "official-fix", description = "Official Fix"), @AllowedValue(value = "temporary-fix", description = "Temporary Fix"), @AllowedValue(value = "workaround", description = "Workaround"), @AllowedValue(value = "unavailable", description = "Unavailable"), @AllowedValue(value = "not-defined", description = "Not Defined")}), 219 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name='report-confidence']/@value", values = {@AllowedValue(value = "unconfirmed", description = "Unconfirmed"), @AllowedValue(value = "uncorroborated", description = "Uncorroborated"), @AllowedValue(value = "confirmed", description = "Confirmed"), @AllowedValue(value = "not-defined", description = "Not Defined")}), 220 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name='collateral-damage-potential']/@value", values = {@AllowedValue(value = "none", description = "None"), @AllowedValue(value = "low", description = "Low (light loss)"), @AllowedValue(value = "low-medium", description = "Low Medium"), @AllowedValue(value = "medium-high", description = "Medium High"), @AllowedValue(value = "high", description = "High (catastrophic loss)"), @AllowedValue(value = "not-defined", description = "Not Defined")}), 221 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system='http://www.first.org/cvss/v2.0' and @name=('target-distribution', 'confidentiality-requirement', 'integrity-requirement', 'availability-requirement')]/@value", values = {@AllowedValue(value = "none", description = ""), @AllowedValue(value = "low", description = ""), @AllowedValue(value = "medium", description = ""), @AllowedValue(value = "high", description = ""), @AllowedValue(value = "not-defined", description = "")}), 222 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1')]/@name", values = {@AllowedValue(value = "attack-vector", description = "Base: Attack Vector"), @AllowedValue(value = "access-complexity", description = "Base: Attack Complexity"), @AllowedValue(value = "privileges-required", description = "Base: Privileges Required"), @AllowedValue(value = "user-interaction", description = "Base: User Interaction"), @AllowedValue(value = "scope", description = "Base: Scope"), @AllowedValue(value = "confidentiality-impact", description = "Base: Confidentiality Impact"), @AllowedValue(value = "integrity-impact", description = "Base: Integrity Impact"), @AllowedValue(value = "availability-impact", description = "Base: Availability Impact"), @AllowedValue(value = "exploit-code-maturity", description = "Temporal: Exploit Code Maturity"), @AllowedValue(value = "remediation-level", description = "Temporal: Remediation Level"), @AllowedValue(value = "report-confidence", description = "Temporal: Report Confidence"), @AllowedValue(value = "modified-attack-vector", description = "Environmental: Modified Attack Vector"), @AllowedValue(value = "modified-attack-complexity", description = "Environmental: Modified Attack Complexity"), @AllowedValue(value = "modified-privileges-required", description = "Environmental: Modified Privileges Required"), @AllowedValue(value = "modified-user-interaction", description = "Environmental: Modified User Interaction"), @AllowedValue(value = "modified-scope", description = "Environmental: Modified Scope"), @AllowedValue(value = "modified-confidentiality", description = "Environmental: Modified Confidentiality"), @AllowedValue(value = "modified-integrity", description = "Environmental: Modified Integrity"), @AllowedValue(value = "modified-availability", description = "Environmental: Modified Availability"), @AllowedValue(value = "confidentiality-requirement", description = "Environmental: Confidentiality Requirement Modifier"), @AllowedValue(value = "integrity-requirement", description = "Environmental: Integrity Requirement Modifier"), @AllowedValue(value = "availability-requirement", description = "Environmental: Availability Requirement Modifier")}), 223 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='access-vector']/@value", values = {@AllowedValue(value = "network", description = "Network"), @AllowedValue(value = "adjacent", description = "Adjacent"), @AllowedValue(value = "local", description = "Local"), @AllowedValue(value = "physical", description = "Physical")}), 224 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='access-complexity']/@value", values = {@AllowedValue(value = "high", description = "High"), @AllowedValue(value = "low", description = "Low")}), 225 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name=('privileges-required', 'confidentiality-impact', 'integrity-impact', 'availability-impact')]/@value", values = {@AllowedValue(value = "none", description = "None"), @AllowedValue(value = "low", description = "Low"), @AllowedValue(value = "high", description = "High")}), 226 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='user-interaction']/@value", values = {@AllowedValue(value = "none", description = "None"), @AllowedValue(value = "required", description = "Required")}), 227 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='scope']/@value", values = {@AllowedValue(value = "unchanged", description = "Unchanged"), @AllowedValue(value = "changed", description = "Changed")}), 228 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='exploit-code-maturity']/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "unproven", description = "Unproven"), @AllowedValue(value = "proof-of-concept", description = "Proof-of-Concept"), @AllowedValue(value = "functional", description = "Functional"), @AllowedValue(value = "high", description = "High")}), 229 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='remediation-level']/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "official-fix", description = "Official Fix"), @AllowedValue(value = "temporary-fix", description = "Temporary Fix"), @AllowedValue(value = "workaround", description = "Workaround"), @AllowedValue(value = "unavailable", description = "Unavailable")}), 230 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='report-confidence']/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "unknown", description = "Unknown"), @AllowedValue(value = "reasonable", description = "Reasonable"), @AllowedValue(value = "confirmed", description = "Confirmed")}), 231 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name=('confidentiality-requirement', 'integrity-requirement', 'availability-requirement')]/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "low", description = "Low"), @AllowedValue(value = "medium", description = "Medium"), @AllowedValue(value = "high", description = "High")}), 232 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='modified-attack-vector']/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "network", description = "Network"), @AllowedValue(value = "adjacent", description = "Adjacent"), @AllowedValue(value = "local", description = "Local"), @AllowedValue(value = "physical", description = "Physical")}), 233 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='modified-attack-complexity']/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "high", description = "High"), @AllowedValue(value = "low", description = "Low")}), 234 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name=('modified-privileges-required', 'modified-confidentiality', 'modified-integrity', 'modified-availability')]/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "none", description = "None"), @AllowedValue(value = "low", description = "Low"), @AllowedValue(value = "high", description = "High")}), 235 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='modified-user-interaction']/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "none", description = "None"), @AllowedValue(value = "required", description = "Required")}), 236 @AllowedValues(level = IConstraint.Level.ERROR, target = "(.)[@system=('http://www.first.org/cvss/v3.0', 'http://www.first.org/cvss/v3.1') and @name='modified-scope']/@value", values = {@AllowedValue(value = "not-defined", description = "Not Defined"), @AllowedValue(value = "unchanged", description = "Unchanged"), @AllowedValue(value = "changed", description = "Changed")}) 237 } 238 ) 239 public static class Facet { 240 @BoundFlag( 241 formalName = "Facet Name", 242 description = "The name of the risk metric within the specified system.", 243 useName = "name", 244 required = true, 245 typeAdapter = TokenAdapter.class 246 ) 247 private String _name; 248 249 @BoundFlag( 250 formalName = "Naming System", 251 description = "Specifies the naming system under which this risk metric is organized, which allows for the same names to be used in different systems controlled by different parties. This avoids the potential of a name clash.", 252 useName = "system", 253 required = true, 254 typeAdapter = UriAdapter.class, 255 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)." 256 ) 257 @ValueConstraints( 258 allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "http://fedramp.gov", description = "\\*\\*deprecated\\*\\* The FedRAMP naming system. This has been deprecated; use `http://fedramp.gov/ns/oscal` instead."), @AllowedValue(value = "http://fedramp.gov/ns/oscal", description = "The FedRAMP naming system."), @AllowedValue(value = "http://csrc.nist.gov/ns/oscal", description = ""), @AllowedValue(value = "http://csrc.nist.gov/ns/oscal/unknown", description = "The facet is from an unknown taxonomy. The meaning of the name is tool or organization specific."), @AllowedValue(value = "http://cve.mitre.org", description = ""), @AllowedValue(value = "http://www.first.org/cvss/v2.0", description = ""), @AllowedValue(value = "http://www.first.org/cvss/v3.0", description = ""), @AllowedValue(value = "http://www.first.org/cvss/v3.1", description = "")}) 259 ) 260 private URI _system; 261 262 @BoundFlag( 263 formalName = "Facet Value", 264 description = "Indicates the value of the facet.", 265 useName = "value", 266 required = true, 267 typeAdapter = StringAdapter.class 268 ) 269 private String _value; 270 271 @BoundAssembly( 272 formalName = "Property", 273 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 274 useName = "prop", 275 maxOccurs = -1 276 ) 277 @GroupAs( 278 name = "props", 279 inJson = JsonGroupAsBehavior.LIST 280 ) 281 private List<Property> _props; 282 283 @BoundAssembly( 284 formalName = "Link", 285 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 286 useName = "link", 287 maxOccurs = -1 288 ) 289 @GroupAs( 290 name = "links", 291 inJson = JsonGroupAsBehavior.LIST 292 ) 293 private List<Link> _links; 294 295 @BoundField( 296 formalName = "Remarks", 297 description = "Additional commentary about the containing object.", 298 useName = "remarks" 299 ) 300 @BoundFieldValue( 301 typeAdapter = MarkupMultilineAdapter.class 302 ) 303 private MarkupMultiline _remarks; 304 305 public Facet() { 306 } 307 308 public String getName() { 309 return _name; 310 } 311 312 public void setName(String value) { 313 _name = value; 314 } 315 316 public URI getSystem() { 317 return _system; 318 } 319 320 public void setSystem(URI value) { 321 _system = value; 322 } 323 324 public String getValue() { 325 return _value; 326 } 327 328 public void setValue(String value) { 329 _value = value; 330 } 331 332 public List<Property> getProps() { 333 return _props; 334 } 335 336 public void setProps(List<Property> value) { 337 _props = value; 338 } 339 340 /** 341 * Add a new {@link Property} item to the underlying collection. 342 * @param item the item to add 343 * @return {@code true} 344 */ 345 public boolean addProp(Property item) { 346 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 347 if (_props == null) { 348 _props = new LinkedList<>(); 349 } 350 return _props.add(value); 351 } 352 353 /** 354 * Remove the first matching {@link Property} item from the underlying collection. 355 * @param item the item to remove 356 * @return {@code true} if the item was removed or {@code false} otherwise 357 */ 358 public boolean removeProp(Property item) { 359 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 360 return _props == null ? false : _props.remove(value); 361 } 362 363 public List<Link> getLinks() { 364 return _links; 365 } 366 367 public void setLinks(List<Link> value) { 368 _links = value; 369 } 370 371 /** 372 * Add a new {@link Link} item to the underlying collection. 373 * @param item the item to add 374 * @return {@code true} 375 */ 376 public boolean addLink(Link item) { 377 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 378 if (_links == null) { 379 _links = new LinkedList<>(); 380 } 381 return _links.add(value); 382 } 383 384 /** 385 * Remove the first matching {@link Link} item from the underlying collection. 386 * @param item the item to remove 387 * @return {@code true} if the item was removed or {@code false} otherwise 388 */ 389 public boolean removeLink(Link item) { 390 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 391 return _links == null ? false : _links.remove(value); 392 } 393 394 public MarkupMultiline getRemarks() { 395 return _remarks; 396 } 397 398 public void setRemarks(MarkupMultiline value) { 399 _remarks = value; 400 } 401 402 @Override 403 public String toString() { 404 return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString(); 405 } 406 } 407}