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.TokenAdapter; 006import dev.metaschema.core.datatype.adapter.UriAdapter; 007import dev.metaschema.core.datatype.adapter.UuidAdapter; 008import dev.metaschema.core.datatype.markup.MarkupLine; 009import dev.metaschema.core.datatype.markup.MarkupLineAdapter; 010import dev.metaschema.core.datatype.markup.MarkupMultiline; 011import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter; 012import dev.metaschema.core.model.IBoundObject; 013import dev.metaschema.core.model.IMetaschemaData; 014import dev.metaschema.core.model.JsonGroupAsBehavior; 015import dev.metaschema.core.model.constraint.IConstraint; 016import dev.metaschema.core.util.ObjectUtils; 017import dev.metaschema.databind.model.annotations.AllowedValue; 018import dev.metaschema.databind.model.annotations.AllowedValues; 019import dev.metaschema.databind.model.annotations.AssemblyConstraints; 020import dev.metaschema.databind.model.annotations.BoundAssembly; 021import dev.metaschema.databind.model.annotations.BoundField; 022import dev.metaschema.databind.model.annotations.BoundFlag; 023import dev.metaschema.databind.model.annotations.GroupAs; 024import dev.metaschema.databind.model.annotations.HasCardinality; 025import dev.metaschema.databind.model.annotations.MetaschemaAssembly; 026import dev.metaschema.databind.model.annotations.ValueConstraints; 027import edu.umd.cs.findbugs.annotations.NonNull; 028import edu.umd.cs.findbugs.annotations.Nullable; 029import java.net.URI; 030import java.util.LinkedList; 031import java.util.List; 032import java.util.UUID; 033import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 034import org.apache.commons.lang3.builder.ToStringStyle; 035 036/** 037 * A partition of an assessment plan or results or a child of another part. 038 */ 039@MetaschemaAssembly( 040 formalName = "Assessment Part", 041 description = "A partition of an assessment plan or results or a child of another part.", 042 name = "assessment-part", 043 moduleClass = OscalAssessmentCommonModule.class, 044 remarks = "A `part` provides for logical partitioning of prose, and can be thought of as a grouping structure (e.g., section). A `part` can have child parts allowing for arbitrary nesting of prose content (e.g., statement hierarchy). A `part` can contain `prop` objects that allow for enriching prose text with structured name/value information.\n" 045 + "\n" 046 + "A `part` can be assigned an optional `id`, which allows for internal and external references to the textual concept contained within a `part`. A `id` provides a means for an OSCAL profile, or a higher layer OSCAL model to reference a specific part within a `catalog`. For example, an `id` can be used to reference or to make modifications to a control statement in a profile.\n" 047 + "\n" 048 + "Use of `part` and `prop` provides for a wide degree of extensibility within the OSCAL catalog model. The optional `ns` provides a means to qualify a part's `name`, allowing for organization-specific vocabularies to be defined with clear semantics. Any organization that extends OSCAL in this way should consistently assign a `ns` value that represents the organization, making a given namespace qualified `name` unique to that organization. This allows the combination of `ns` and `name` to always be unique and unambiguous, even when mixed with extensions from other organizations. Each organization is responsible for governance of their own extensions, and is strongly encouraged to publish their extensions as standards to their user community. If no `ns` is provided, the name is expected to be in the \"OSCAL\" namespace.\n" 049 + "\n" 050 + "To ensure a `ns` is unique to an organization and naming conflicts are avoided, a URI containing a DNS or other globally defined organization name should be used. For example, if FedRAMP and DoD both extend OSCAL, FedRAMP will use the `ns` `http://fedramp.gov/ns/oscal`, while DoD might use the `ns` `https://defense.gov` for any organization specific `name`.\n" 051 + "\n" 052 + "Tools that process OSCAL content are not required to interpret unrecognized OSCAL extensions; however, OSCAL compliant tools should not modify or remove unrecognized extensions, unless there is a compelling reason to do so, such as data sensitivity.", 053 valueConstraints = @ValueConstraints(allowedValues = {@AllowedValues(id = "oscal-assesment-part-objective-name", level = IConstraint.Level.ERROR, target = ".[@name='objective']/prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name", values = @AllowedValue(value = "method", description = "The assessment method to use. This typically appears on parts with the name \"objective\".")), @AllowedValues(id = "oscal-assesment-part-objective-method-value", level = IConstraint.Level.ERROR, target = ".[@name='objective']/prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='method']/@value", values = {@AllowedValue(value = "INTERVIEW", description = "The process of holding discussions with individuals or groups of individuals within an organization to once again, facilitate assessor understanding, achieve clarification, or obtain evidence."), @AllowedValue(value = "EXAMINE", description = "The process of reviewing, inspecting, observing, studying, or analyzing one or more assessment objects (i.e., specifications, mechanisms, or activities)."), @AllowedValue(value = "TEST", description = "The process of exercising one or more assessment objects (i.e., activities or mechanisms) under specified conditions to compare actual with expected behavior.")})}), 054 modelConstraints = @AssemblyConstraints(cardinality = @HasCardinality(id = "oscal-assesment-part-objective-cardinality", level = IConstraint.Level.ERROR, target = ".[@name='objective']/prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal') and @name='method']", minOccurs = 1)) 055) 056public class AssessmentPart implements IBoundObject { 057 private final IMetaschemaData __metaschemaData; 058 059 /** 060 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a>, <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique">globally unique</a> identifier with <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance">cross-instance</a> scope that can be used to reference this part elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>part</code> can be used to reference the data item locally or globally (e.g., in an ported OSCAL instance). This UUID should be assigned <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document. 061 */ 062 @BoundFlag( 063 formalName = "Part Identifier", 064 description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented), [globally unique](https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique) identifier with [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference this part elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `part` can be used to reference the data item locally or globally (e.g., in an ported OSCAL instance). This UUID should be assigned [per-subject](https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency), which means it should be consistently used to identify the same subject across revisions of the document.", 065 name = "uuid", 066 typeAdapter = UuidAdapter.class 067 ) 068 private UUID _uuid; 069 070 /** 071 * A textual label that uniquely identifies the part's semantic type. 072 */ 073 @BoundFlag( 074 formalName = "Part Name", 075 description = "A textual label that uniquely identifies the part's semantic type.", 076 name = "name", 077 required = true, 078 typeAdapter = TokenAdapter.class, 079 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-assessment-part-values", level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "asset", description = "An assessment asset."), @AllowedValue(value = "method", description = "An assessment method."), @AllowedValue(value = "objective", description = "Describes a set of control objectives.")})) 080 ) 081 private String _name; 082 083 /** 084 * A namespace qualifying the part's name. This allows different organizations to associate distinct semantics with the same name. 085 */ 086 @BoundFlag( 087 formalName = "Part Namespace", 088 description = "A namespace qualifying the part's name. This allows different organizations to associate distinct semantics with the same name.", 089 name = "ns", 090 defaultValue = "http://csrc.nist.gov/ns/oscal", 091 typeAdapter = UriAdapter.class, 092 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).\n" 093 + "\n" 094 + "When a `ns` is not provided, its value should be assumed to be `http://csrc.nist.gov/ns/oscal` and the name should be a name defined by the associated OSCAL model." 095 ) 096 private URI _ns; 097 098 /** 099 * A textual label that provides a sub-type or characterization of the part's <code>name</code>. This can be used to further distinguish or discriminate between the semantics of multiple parts of the same control with the same <code>name</code> and <code>ns</code>. 100 */ 101 @BoundFlag( 102 formalName = "Part Class", 103 description = "A textual label that provides a sub-type or characterization of the part's `name`. This can be used to further distinguish or discriminate between the semantics of multiple parts of the same control with the same `name` and `ns`.", 104 name = "class", 105 typeAdapter = TokenAdapter.class, 106 remarks = "A `class` can be used in validation rules to express extra constraints over named items of a specific `class` value.\n" 107 + "\n" 108 + "A `class` can also be used in an OSCAL profile as a means to target an alteration to control content." 109 ) 110 private String _clazz; 111 112 /** 113 * A name given to the part, which may be used by a tool for display and navigation. 114 */ 115 @BoundField( 116 formalName = "Part Title", 117 description = "A name given to the part, which may be used by a tool for display and navigation.", 118 useName = "title", 119 typeAdapter = MarkupLineAdapter.class 120 ) 121 private MarkupLine _title; 122 123 /** 124 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 125 */ 126 @BoundAssembly( 127 formalName = "Property", 128 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 129 useName = "prop", 130 maxOccurs = -1, 131 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 132 ) 133 private List<Property> _props; 134 135 /** 136 * Permits multiple paragraphs, lists, tables etc. 137 */ 138 @BoundField( 139 formalName = "Part Text", 140 description = "Permits multiple paragraphs, lists, tables etc.", 141 useName = "prose", 142 inXmlWrapped = false, 143 typeAdapter = MarkupMultilineAdapter.class 144 ) 145 private MarkupMultiline _prose; 146 147 /** 148 * A partition of an assessment plan or results or a child of another part. 149 */ 150 @BoundAssembly( 151 formalName = "Assessment Part", 152 description = "A partition of an assessment plan or results or a child of another part.", 153 useName = "part", 154 maxOccurs = -1, 155 groupAs = @GroupAs(name = "parts", inJson = JsonGroupAsBehavior.LIST) 156 ) 157 private List<AssessmentPart> _parts; 158 159 /** 160 * A reference to a local or remote resource, that has a specific relation to the containing object. 161 */ 162 @BoundAssembly( 163 formalName = "Link", 164 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 165 useName = "link", 166 maxOccurs = -1, 167 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 168 ) 169 private List<Link> _links; 170 171 /** 172 * Constructs a new {@code dev.metaschema.oscal.lib.model.AssessmentPart} instance with no metadata. 173 */ 174 public AssessmentPart() { 175 this(null); 176 } 177 178 /** 179 * Constructs a new {@code dev.metaschema.oscal.lib.model.AssessmentPart} instance with the specified metadata. 180 * 181 * @param data 182 * the metaschema data, or {@code null} if none 183 */ 184 public AssessmentPart(IMetaschemaData data) { 185 this.__metaschemaData = data; 186 } 187 188 @Override 189 public IMetaschemaData getMetaschemaData() { 190 return __metaschemaData; 191 } 192 193 /** 194 * Get the "{@literal Part Identifier}". 195 * 196 * <p> 197 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a>, <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique">globally unique</a> identifier with <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance">cross-instance</a> scope that can be used to reference this part elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>part</code> can be used to reference the data item locally or globally (e.g., in an ported OSCAL instance). This UUID should be assigned <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document. 198 * 199 * @return the uuid value, or {@code null} if not set 200 */ 201 @Nullable 202 public UUID getUuid() { 203 return _uuid; 204 } 205 206 /** 207 * Set the "{@literal Part Identifier}". 208 * 209 * <p> 210 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a>, <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique">globally unique</a> identifier with <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance">cross-instance</a> scope that can be used to reference this part elsewhere in <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>part</code> can be used to reference the data item locally or globally (e.g., in an ported OSCAL instance). This UUID should be assigned <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document. 211 * 212 * @param value 213 * the uuid value to set, or {@code null} to clear 214 */ 215 public void setUuid(@Nullable UUID value) { 216 _uuid = value; 217 } 218 219 /** 220 * Get the "{@literal Part Name}". 221 * 222 * <p> 223 * A textual label that uniquely identifies the part's semantic type. 224 * 225 * @return the name value 226 */ 227 @NonNull 228 public String getName() { 229 return _name; 230 } 231 232 /** 233 * Set the "{@literal Part Name}". 234 * 235 * <p> 236 * A textual label that uniquely identifies the part's semantic type. 237 * 238 * @param value 239 * the name value to set 240 */ 241 public void setName(@NonNull String value) { 242 _name = value; 243 } 244 245 /** 246 * Get the "{@literal Part Namespace}". 247 * 248 * <p> 249 * A namespace qualifying the part's name. This allows different organizations to associate distinct semantics with the same name. 250 * 251 * @return the ns value, or {@code null} if not set 252 */ 253 @Nullable 254 public URI getNs() { 255 return _ns; 256 } 257 258 /** 259 * Set the "{@literal Part Namespace}". 260 * 261 * <p> 262 * A namespace qualifying the part's name. This allows different organizations to associate distinct semantics with the same name. 263 * 264 * @param value 265 * the ns value to set, or {@code null} to clear 266 */ 267 public void setNs(@Nullable URI value) { 268 _ns = value; 269 } 270 271 /** 272 * Get the "{@literal Part Class}". 273 * 274 * <p> 275 * A textual label that provides a sub-type or characterization of the part's <code>name</code>. This can be used to further distinguish or discriminate between the semantics of multiple parts of the same control with the same <code>name</code> and <code>ns</code>. 276 * 277 * @return the class value, or {@code null} if not set 278 */ 279 @Nullable 280 public String getClazz() { 281 return _clazz; 282 } 283 284 /** 285 * Set the "{@literal Part Class}". 286 * 287 * <p> 288 * A textual label that provides a sub-type or characterization of the part's <code>name</code>. This can be used to further distinguish or discriminate between the semantics of multiple parts of the same control with the same <code>name</code> and <code>ns</code>. 289 * 290 * @param value 291 * the class value to set, or {@code null} to clear 292 */ 293 public void setClazz(@Nullable String value) { 294 _clazz = value; 295 } 296 297 /** 298 * Get the "{@literal Part Title}". 299 * 300 * <p> 301 * A name given to the part, which may be used by a tool for display and navigation. 302 * 303 * @return the title value, or {@code null} if not set 304 */ 305 @Nullable 306 public MarkupLine getTitle() { 307 return _title; 308 } 309 310 /** 311 * Set the "{@literal Part Title}". 312 * 313 * <p> 314 * A name given to the part, which may be used by a tool for display and navigation. 315 * 316 * @param value 317 * the title value to set, or {@code null} to clear 318 */ 319 public void setTitle(@Nullable MarkupLine value) { 320 _title = value; 321 } 322 323 /** 324 * Get the "{@literal Property}". 325 * 326 * <p> 327 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 328 * 329 * @return the prop value 330 */ 331 @NonNull 332 public List<Property> getProps() { 333 if (_props == null) { 334 _props = new LinkedList<>(); 335 } 336 return ObjectUtils.notNull(_props); 337 } 338 339 /** 340 * Set the "{@literal Property}". 341 * 342 * <p> 343 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 344 * 345 * @param value 346 * the prop value to set 347 */ 348 public void setProps(@NonNull List<Property> value) { 349 _props = value; 350 } 351 352 /** 353 * Add a new {@link Property} item to the underlying collection. 354 * @param item the item to add 355 * @return {@code true} 356 */ 357 public boolean addProp(Property item) { 358 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 359 if (_props == null) { 360 _props = new LinkedList<>(); 361 } 362 return _props.add(value); 363 } 364 365 /** 366 * Remove the first matching {@link Property} item from the underlying collection. 367 * @param item the item to remove 368 * @return {@code true} if the item was removed or {@code false} otherwise 369 */ 370 public boolean removeProp(Property item) { 371 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 372 return _props != null && _props.remove(value); 373 } 374 375 /** 376 * Get the "{@literal Part Text}". 377 * 378 * <p> 379 * Permits multiple paragraphs, lists, tables etc. 380 * 381 * @return the prose value, or {@code null} if not set 382 */ 383 @Nullable 384 public MarkupMultiline getProse() { 385 return _prose; 386 } 387 388 /** 389 * Set the "{@literal Part Text}". 390 * 391 * <p> 392 * Permits multiple paragraphs, lists, tables etc. 393 * 394 * @param value 395 * the prose value to set, or {@code null} to clear 396 */ 397 public void setProse(@Nullable MarkupMultiline value) { 398 _prose = value; 399 } 400 401 /** 402 * Get the "{@literal Assessment Part}". 403 * 404 * <p> 405 * A partition of an assessment plan or results or a child of another part. 406 * 407 * @return the part value 408 */ 409 @NonNull 410 public List<AssessmentPart> getParts() { 411 if (_parts == null) { 412 _parts = new LinkedList<>(); 413 } 414 return ObjectUtils.notNull(_parts); 415 } 416 417 /** 418 * Set the "{@literal Assessment Part}". 419 * 420 * <p> 421 * A partition of an assessment plan or results or a child of another part. 422 * 423 * @param value 424 * the part value to set 425 */ 426 public void setParts(@NonNull List<AssessmentPart> value) { 427 _parts = value; 428 } 429 430 /** 431 * Add a new {@link AssessmentPart} item to the underlying collection. 432 * @param item the item to add 433 * @return {@code true} 434 */ 435 public boolean addPart(AssessmentPart item) { 436 AssessmentPart value = ObjectUtils.requireNonNull(item,"item cannot be null"); 437 if (_parts == null) { 438 _parts = new LinkedList<>(); 439 } 440 return _parts.add(value); 441 } 442 443 /** 444 * Remove the first matching {@link AssessmentPart} item from the underlying collection. 445 * @param item the item to remove 446 * @return {@code true} if the item was removed or {@code false} otherwise 447 */ 448 public boolean removePart(AssessmentPart item) { 449 AssessmentPart value = ObjectUtils.requireNonNull(item,"item cannot be null"); 450 return _parts != null && _parts.remove(value); 451 } 452 453 /** 454 * Get the "{@literal Link}". 455 * 456 * <p> 457 * A reference to a local or remote resource, that has a specific relation to the containing object. 458 * 459 * @return the link value 460 */ 461 @NonNull 462 public List<Link> getLinks() { 463 if (_links == null) { 464 _links = new LinkedList<>(); 465 } 466 return ObjectUtils.notNull(_links); 467 } 468 469 /** 470 * Set the "{@literal Link}". 471 * 472 * <p> 473 * A reference to a local or remote resource, that has a specific relation to the containing object. 474 * 475 * @param value 476 * the link value to set 477 */ 478 public void setLinks(@NonNull List<Link> value) { 479 _links = value; 480 } 481 482 /** 483 * Add a new {@link Link} item to the underlying collection. 484 * @param item the item to add 485 * @return {@code true} 486 */ 487 public boolean addLink(Link item) { 488 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 489 if (_links == null) { 490 _links = new LinkedList<>(); 491 } 492 return _links.add(value); 493 } 494 495 /** 496 * Remove the first matching {@link Link} item from the underlying collection. 497 * @param item the item to remove 498 * @return {@code true} if the item was removed or {@code false} otherwise 499 */ 500 public boolean removeLink(Link item) { 501 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 502 return _links != null && _links.remove(value); 503 } 504 505 @Override 506 public String toString() { 507 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 508 } 509}