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.DateTimeWithTZAdapter; 006import dev.metaschema.core.datatype.adapter.StringAdapter; 007import dev.metaschema.core.datatype.adapter.TokenAdapter; 008import dev.metaschema.core.datatype.adapter.UriReferenceAdapter; 009import dev.metaschema.core.datatype.adapter.UuidAdapter; 010import dev.metaschema.core.datatype.markup.MarkupLine; 011import dev.metaschema.core.datatype.markup.MarkupLineAdapter; 012import dev.metaschema.core.datatype.markup.MarkupMultiline; 013import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter; 014import dev.metaschema.core.model.IBoundObject; 015import dev.metaschema.core.model.IMetaschemaData; 016import dev.metaschema.core.model.JsonGroupAsBehavior; 017import dev.metaschema.core.model.constraint.IConstraint; 018import dev.metaschema.core.util.ObjectUtils; 019import dev.metaschema.databind.model.annotations.AllowedValue; 020import dev.metaschema.databind.model.annotations.AllowedValues; 021import dev.metaschema.databind.model.annotations.BoundAssembly; 022import dev.metaschema.databind.model.annotations.BoundField; 023import dev.metaschema.databind.model.annotations.BoundFlag; 024import dev.metaschema.databind.model.annotations.GroupAs; 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.time.ZonedDateTime; 031import java.util.LinkedList; 032import java.util.List; 033import java.util.UUID; 034import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 035import org.apache.commons.lang3.builder.ToStringStyle; 036 037/** 038 * Describes an individual observation. 039 */ 040@MetaschemaAssembly( 041 formalName = "Observation", 042 description = "Describes an individual observation.", 043 name = "observation", 044 moduleClass = OscalAssessmentCommonModule.class 045) 046public class Observation implements IBoundObject { 047 private final IMetaschemaData __metaschemaData; 048 049 /** 050 * 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 <em>cross-instance</em> scope that can be used to reference this observation 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>observation</code> can be used to reference the data item locally or globally (e.g., in an imported 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. 051 */ 052 @BoundFlag( 053 formalName = "Observation Universally Unique Identifier", 054 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* scope that can be used to reference this observation elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `observation` can be used to reference the data item locally or globally (e.g., in an imported 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.", 055 name = "uuid", 056 required = true, 057 typeAdapter = UuidAdapter.class 058 ) 059 private UUID _uuid; 060 061 /** 062 * The title for this observation. 063 */ 064 @BoundField( 065 formalName = "Observation Title", 066 description = "The title for this observation.", 067 useName = "title", 068 typeAdapter = MarkupLineAdapter.class 069 ) 070 private MarkupLine _title; 071 072 /** 073 * A human-readable description of this assessment observation. 074 */ 075 @BoundField( 076 formalName = "Observation Description", 077 description = "A human-readable description of this assessment observation.", 078 useName = "description", 079 minOccurs = 1, 080 typeAdapter = MarkupMultilineAdapter.class 081 ) 082 private MarkupMultiline _description; 083 084 /** 085 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 086 */ 087 @BoundAssembly( 088 formalName = "Property", 089 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 090 useName = "prop", 091 maxOccurs = -1, 092 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 093 ) 094 private List<Property> _props; 095 096 /** 097 * A reference to a local or remote resource, that has a specific relation to the containing object. 098 */ 099 @BoundAssembly( 100 formalName = "Link", 101 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 102 useName = "link", 103 maxOccurs = -1, 104 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 105 ) 106 private List<Link> _links; 107 108 /** 109 * Identifies how the observation was made. 110 */ 111 @BoundField( 112 formalName = "Observation Method", 113 description = "Identifies how the observation was made.", 114 useName = "method", 115 minOccurs = 1, 116 maxOccurs = -1, 117 groupAs = @GroupAs(name = "methods", inJson = JsonGroupAsBehavior.LIST), 118 typeAdapter = StringAdapter.class, 119 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-observation-method-type-values", level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "EXAMINE", description = "An inspection was performed."), @AllowedValue(value = "INTERVIEW", description = "An interview was performed."), @AllowedValue(value = "TEST", description = "A manual or automated test was performed."), @AllowedValue(value = "UNKNOWN", description = "This is only for use when converting historic content to OSCAL, where the conversion process cannot initially identify the appropriate method(s).")})) 120 ) 121 private List<String> _methods; 122 123 /** 124 * Identifies the nature of the observation. More than one may be used to further qualify and enable filtering. 125 */ 126 @BoundField( 127 formalName = "Observation Type", 128 description = "Identifies the nature of the observation. More than one may be used to further qualify and enable filtering.", 129 useName = "type", 130 maxOccurs = -1, 131 groupAs = @GroupAs(name = "types", inJson = JsonGroupAsBehavior.LIST), 132 typeAdapter = TokenAdapter.class, 133 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-observation-values", level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "ssp-statement-issue", description = "A difference between the SSP implementation statement, and actual implementation."), @AllowedValue(value = "control-objective", description = "An observation about the status of a the associated control objective."), @AllowedValue(value = "mitigation", description = "A mitigating factor was identified."), @AllowedValue(value = "finding", description = "\\*\\*(deprecated)\\*\\* Use 'discovery' instead.", deprecatedVersion = "1.2.0"), @AllowedValue(value = "discovery", description = "An observation of potential risk in the system's implementation, identified through security scanning tools, penetration testing, and other means."), @AllowedValue(value = "historic", description = "An observation from a past assessment, which was converted to OSCAL at a later date.")})) 134 ) 135 private List<String> _types; 136 137 /** 138 * Identifies the source of the finding, such as a tool, interviewed person, or activity. 139 */ 140 @BoundAssembly( 141 formalName = "Origin", 142 description = "Identifies the source of the finding, such as a tool, interviewed person, or activity.", 143 useName = "origin", 144 remarks = "Used to identify the individual and/or tool that gathered the evidence resulting in the observation identification.", 145 maxOccurs = -1, 146 groupAs = @GroupAs(name = "origins", inJson = JsonGroupAsBehavior.LIST) 147 ) 148 private List<Origin> _origins; 149 150 /** 151 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a resource. Use type to indicate whether the identified resource is a component, inventory item, location, user, or something else. 152 */ 153 @BoundAssembly( 154 formalName = "Identifies the Subject", 155 description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented) identifier reference to a resource. Use type to indicate whether the identified resource is a component, inventory item, location, user, or something else.", 156 useName = "subject", 157 remarks = "Identifies who was interviewed, or what was tested or inspected.", 158 maxOccurs = -1, 159 groupAs = @GroupAs(name = "subjects", inJson = JsonGroupAsBehavior.LIST) 160 ) 161 private List<SubjectReference> _subjects; 162 163 /** 164 * Links this observation to relevant evidence. 165 */ 166 @BoundAssembly( 167 formalName = "Relevant Evidence", 168 description = "Links this observation to relevant evidence.", 169 useName = "relevant-evidence", 170 maxOccurs = -1, 171 groupAs = @GroupAs(name = "relevant-evidence", inJson = JsonGroupAsBehavior.LIST) 172 ) 173 private List<RelevantEvidence> _relevantEvidence; 174 175 /** 176 * Date/time stamp identifying when the finding information was collected. 177 */ 178 @BoundField( 179 formalName = "Collected Field", 180 description = "Date/time stamp identifying when the finding information was collected.", 181 useName = "collected", 182 minOccurs = 1, 183 typeAdapter = DateTimeWithTZAdapter.class 184 ) 185 private ZonedDateTime _collected; 186 187 /** 188 * Date/time identifying when the finding information is out-of-date and no longer valid. Typically used with continuous assessment scenarios. 189 */ 190 @BoundField( 191 formalName = "Expires Field", 192 description = "Date/time identifying when the finding information is out-of-date and no longer valid. Typically used with continuous assessment scenarios.", 193 useName = "expires", 194 typeAdapter = DateTimeWithTZAdapter.class 195 ) 196 private ZonedDateTime _expires; 197 198 /** 199 * Additional commentary about the containing object. 200 */ 201 @BoundField( 202 formalName = "Remarks", 203 description = "Additional commentary about the containing object.", 204 useName = "remarks", 205 typeAdapter = MarkupMultilineAdapter.class 206 ) 207 private MarkupMultiline _remarks; 208 209 /** 210 * Constructs a new {@code dev.metaschema.oscal.lib.model.Observation} instance with no metadata. 211 */ 212 public Observation() { 213 this(null); 214 } 215 216 /** 217 * Constructs a new {@code dev.metaschema.oscal.lib.model.Observation} instance with the specified metadata. 218 * 219 * @param data 220 * the metaschema data, or {@code null} if none 221 */ 222 public Observation(IMetaschemaData data) { 223 this.__metaschemaData = data; 224 } 225 226 @Override 227 public IMetaschemaData getMetaschemaData() { 228 return __metaschemaData; 229 } 230 231 /** 232 * Get the "{@literal Observation Universally Unique Identifier}". 233 * 234 * <p> 235 * 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 <em>cross-instance</em> scope that can be used to reference this observation 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>observation</code> can be used to reference the data item locally or globally (e.g., in an imported 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. 236 * 237 * @return the uuid value 238 */ 239 @NonNull 240 public UUID getUuid() { 241 return _uuid; 242 } 243 244 /** 245 * Set the "{@literal Observation Universally Unique Identifier}". 246 * 247 * <p> 248 * 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 <em>cross-instance</em> scope that can be used to reference this observation 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>observation</code> can be used to reference the data item locally or globally (e.g., in an imported 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. 249 * 250 * @param value 251 * the uuid value to set 252 */ 253 public void setUuid(@NonNull UUID value) { 254 _uuid = value; 255 } 256 257 /** 258 * Get the "{@literal Observation Title}". 259 * 260 * <p> 261 * The title for this observation. 262 * 263 * @return the title value, or {@code null} if not set 264 */ 265 @Nullable 266 public MarkupLine getTitle() { 267 return _title; 268 } 269 270 /** 271 * Set the "{@literal Observation Title}". 272 * 273 * <p> 274 * The title for this observation. 275 * 276 * @param value 277 * the title value to set, or {@code null} to clear 278 */ 279 public void setTitle(@Nullable MarkupLine value) { 280 _title = value; 281 } 282 283 /** 284 * Get the "{@literal Observation Description}". 285 * 286 * <p> 287 * A human-readable description of this assessment observation. 288 * 289 * @return the description value 290 */ 291 @NonNull 292 public MarkupMultiline getDescription() { 293 return _description; 294 } 295 296 /** 297 * Set the "{@literal Observation Description}". 298 * 299 * <p> 300 * A human-readable description of this assessment observation. 301 * 302 * @param value 303 * the description value to set 304 */ 305 public void setDescription(@NonNull MarkupMultiline value) { 306 _description = value; 307 } 308 309 /** 310 * Get the "{@literal Property}". 311 * 312 * <p> 313 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 314 * 315 * @return the prop value 316 */ 317 @NonNull 318 public List<Property> getProps() { 319 if (_props == null) { 320 _props = new LinkedList<>(); 321 } 322 return ObjectUtils.notNull(_props); 323 } 324 325 /** 326 * Set the "{@literal Property}". 327 * 328 * <p> 329 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 330 * 331 * @param value 332 * the prop value to set 333 */ 334 public void setProps(@NonNull List<Property> value) { 335 _props = value; 336 } 337 338 /** 339 * Add a new {@link Property} item to the underlying collection. 340 * @param item the item to add 341 * @return {@code true} 342 */ 343 public boolean addProp(Property item) { 344 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 345 if (_props == null) { 346 _props = new LinkedList<>(); 347 } 348 return _props.add(value); 349 } 350 351 /** 352 * Remove the first matching {@link Property} item from the underlying collection. 353 * @param item the item to remove 354 * @return {@code true} if the item was removed or {@code false} otherwise 355 */ 356 public boolean removeProp(Property item) { 357 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 358 return _props != null && _props.remove(value); 359 } 360 361 /** 362 * Get the "{@literal Link}". 363 * 364 * <p> 365 * A reference to a local or remote resource, that has a specific relation to the containing object. 366 * 367 * @return the link value 368 */ 369 @NonNull 370 public List<Link> getLinks() { 371 if (_links == null) { 372 _links = new LinkedList<>(); 373 } 374 return ObjectUtils.notNull(_links); 375 } 376 377 /** 378 * Set the "{@literal Link}". 379 * 380 * <p> 381 * A reference to a local or remote resource, that has a specific relation to the containing object. 382 * 383 * @param value 384 * the link value to set 385 */ 386 public void setLinks(@NonNull List<Link> value) { 387 _links = value; 388 } 389 390 /** 391 * Add a new {@link Link} item to the underlying collection. 392 * @param item the item to add 393 * @return {@code true} 394 */ 395 public boolean addLink(Link item) { 396 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 397 if (_links == null) { 398 _links = new LinkedList<>(); 399 } 400 return _links.add(value); 401 } 402 403 /** 404 * Remove the first matching {@link Link} item from the underlying collection. 405 * @param item the item to remove 406 * @return {@code true} if the item was removed or {@code false} otherwise 407 */ 408 public boolean removeLink(Link item) { 409 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 410 return _links != null && _links.remove(value); 411 } 412 413 /** 414 * Get the "{@literal Observation Method}". 415 * 416 * <p> 417 * Identifies how the observation was made. 418 * 419 * @return the method value 420 */ 421 @NonNull 422 public List<String> getMethods() { 423 if (_methods == null) { 424 _methods = new LinkedList<>(); 425 } 426 return ObjectUtils.notNull(_methods); 427 } 428 429 /** 430 * Set the "{@literal Observation Method}". 431 * 432 * <p> 433 * Identifies how the observation was made. 434 * 435 * @param value 436 * the method value to set 437 */ 438 public void setMethods(@NonNull List<String> value) { 439 _methods = value; 440 } 441 442 /** 443 * Add a new {@link String} item to the underlying collection. 444 * @param item the item to add 445 * @return {@code true} 446 */ 447 public boolean addMethod(String item) { 448 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 449 if (_methods == null) { 450 _methods = new LinkedList<>(); 451 } 452 return _methods.add(value); 453 } 454 455 /** 456 * Remove the first matching {@link String} item from the underlying collection. 457 * @param item the item to remove 458 * @return {@code true} if the item was removed or {@code false} otherwise 459 */ 460 public boolean removeMethod(String item) { 461 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 462 return _methods != null && _methods.remove(value); 463 } 464 465 /** 466 * Get the "{@literal Observation Type}". 467 * 468 * <p> 469 * Identifies the nature of the observation. More than one may be used to further qualify and enable filtering. 470 * 471 * @return the type value 472 */ 473 @NonNull 474 public List<String> getTypes() { 475 if (_types == null) { 476 _types = new LinkedList<>(); 477 } 478 return ObjectUtils.notNull(_types); 479 } 480 481 /** 482 * Set the "{@literal Observation Type}". 483 * 484 * <p> 485 * Identifies the nature of the observation. More than one may be used to further qualify and enable filtering. 486 * 487 * @param value 488 * the type value to set 489 */ 490 public void setTypes(@NonNull List<String> value) { 491 _types = value; 492 } 493 494 /** 495 * Add a new {@link String} item to the underlying collection. 496 * @param item the item to add 497 * @return {@code true} 498 */ 499 public boolean addType(String item) { 500 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 501 if (_types == null) { 502 _types = new LinkedList<>(); 503 } 504 return _types.add(value); 505 } 506 507 /** 508 * Remove the first matching {@link String} item from the underlying collection. 509 * @param item the item to remove 510 * @return {@code true} if the item was removed or {@code false} otherwise 511 */ 512 public boolean removeType(String item) { 513 String value = ObjectUtils.requireNonNull(item,"item cannot be null"); 514 return _types != null && _types.remove(value); 515 } 516 517 /** 518 * Get the "{@literal Origin}". 519 * 520 * <p> 521 * Identifies the source of the finding, such as a tool, interviewed person, or activity. 522 * 523 * @return the origin value 524 */ 525 @NonNull 526 public List<Origin> getOrigins() { 527 if (_origins == null) { 528 _origins = new LinkedList<>(); 529 } 530 return ObjectUtils.notNull(_origins); 531 } 532 533 /** 534 * Set the "{@literal Origin}". 535 * 536 * <p> 537 * Identifies the source of the finding, such as a tool, interviewed person, or activity. 538 * 539 * @param value 540 * the origin value to set 541 */ 542 public void setOrigins(@NonNull List<Origin> value) { 543 _origins = value; 544 } 545 546 /** 547 * Add a new {@link Origin} item to the underlying collection. 548 * @param item the item to add 549 * @return {@code true} 550 */ 551 public boolean addOrigin(Origin item) { 552 Origin value = ObjectUtils.requireNonNull(item,"item cannot be null"); 553 if (_origins == null) { 554 _origins = new LinkedList<>(); 555 } 556 return _origins.add(value); 557 } 558 559 /** 560 * Remove the first matching {@link Origin} item from the underlying collection. 561 * @param item the item to remove 562 * @return {@code true} if the item was removed or {@code false} otherwise 563 */ 564 public boolean removeOrigin(Origin item) { 565 Origin value = ObjectUtils.requireNonNull(item,"item cannot be null"); 566 return _origins != null && _origins.remove(value); 567 } 568 569 /** 570 * Get the "{@literal Identifies the Subject}". 571 * 572 * <p> 573 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a resource. Use type to indicate whether the identified resource is a component, inventory item, location, user, or something else. 574 * 575 * @return the subject value 576 */ 577 @NonNull 578 public List<SubjectReference> getSubjects() { 579 if (_subjects == null) { 580 _subjects = new LinkedList<>(); 581 } 582 return ObjectUtils.notNull(_subjects); 583 } 584 585 /** 586 * Set the "{@literal Identifies the Subject}". 587 * 588 * <p> 589 * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented">human-oriented</a> identifier reference to a resource. Use type to indicate whether the identified resource is a component, inventory item, location, user, or something else. 590 * 591 * @param value 592 * the subject value to set 593 */ 594 public void setSubjects(@NonNull List<SubjectReference> value) { 595 _subjects = value; 596 } 597 598 /** 599 * Add a new {@link SubjectReference} item to the underlying collection. 600 * @param item the item to add 601 * @return {@code true} 602 */ 603 public boolean addSubject(SubjectReference item) { 604 SubjectReference value = ObjectUtils.requireNonNull(item,"item cannot be null"); 605 if (_subjects == null) { 606 _subjects = new LinkedList<>(); 607 } 608 return _subjects.add(value); 609 } 610 611 /** 612 * Remove the first matching {@link SubjectReference} item from the underlying collection. 613 * @param item the item to remove 614 * @return {@code true} if the item was removed or {@code false} otherwise 615 */ 616 public boolean removeSubject(SubjectReference item) { 617 SubjectReference value = ObjectUtils.requireNonNull(item,"item cannot be null"); 618 return _subjects != null && _subjects.remove(value); 619 } 620 621 /** 622 * Get the "{@literal Relevant Evidence}". 623 * 624 * <p> 625 * Links this observation to relevant evidence. 626 * 627 * @return the relevant-evidence value 628 */ 629 @NonNull 630 public List<RelevantEvidence> getRelevantEvidence() { 631 if (_relevantEvidence == null) { 632 _relevantEvidence = new LinkedList<>(); 633 } 634 return ObjectUtils.notNull(_relevantEvidence); 635 } 636 637 /** 638 * Set the "{@literal Relevant Evidence}". 639 * 640 * <p> 641 * Links this observation to relevant evidence. 642 * 643 * @param value 644 * the relevant-evidence value to set 645 */ 646 public void setRelevantEvidence(@NonNull List<RelevantEvidence> value) { 647 _relevantEvidence = value; 648 } 649 650 /** 651 * Add a new {@link RelevantEvidence} item to the underlying collection. 652 * @param item the item to add 653 * @return {@code true} 654 */ 655 public boolean addRelevantEvidence(RelevantEvidence item) { 656 RelevantEvidence value = ObjectUtils.requireNonNull(item,"item cannot be null"); 657 if (_relevantEvidence == null) { 658 _relevantEvidence = new LinkedList<>(); 659 } 660 return _relevantEvidence.add(value); 661 } 662 663 /** 664 * Remove the first matching {@link RelevantEvidence} item from the underlying collection. 665 * @param item the item to remove 666 * @return {@code true} if the item was removed or {@code false} otherwise 667 */ 668 public boolean removeRelevantEvidence(RelevantEvidence item) { 669 RelevantEvidence value = ObjectUtils.requireNonNull(item,"item cannot be null"); 670 return _relevantEvidence != null && _relevantEvidence.remove(value); 671 } 672 673 /** 674 * Get the "{@literal Collected Field}". 675 * 676 * <p> 677 * Date/time stamp identifying when the finding information was collected. 678 * 679 * @return the collected value 680 */ 681 @NonNull 682 public ZonedDateTime getCollected() { 683 return _collected; 684 } 685 686 /** 687 * Set the "{@literal Collected Field}". 688 * 689 * <p> 690 * Date/time stamp identifying when the finding information was collected. 691 * 692 * @param value 693 * the collected value to set 694 */ 695 public void setCollected(@NonNull ZonedDateTime value) { 696 _collected = value; 697 } 698 699 /** 700 * Get the "{@literal Expires Field}". 701 * 702 * <p> 703 * Date/time identifying when the finding information is out-of-date and no longer valid. Typically used with continuous assessment scenarios. 704 * 705 * @return the expires value, or {@code null} if not set 706 */ 707 @Nullable 708 public ZonedDateTime getExpires() { 709 return _expires; 710 } 711 712 /** 713 * Set the "{@literal Expires Field}". 714 * 715 * <p> 716 * Date/time identifying when the finding information is out-of-date and no longer valid. Typically used with continuous assessment scenarios. 717 * 718 * @param value 719 * the expires value to set, or {@code null} to clear 720 */ 721 public void setExpires(@Nullable ZonedDateTime value) { 722 _expires = value; 723 } 724 725 /** 726 * Get the "{@literal Remarks}". 727 * 728 * <p> 729 * Additional commentary about the containing object. 730 * 731 * @return the remarks value, or {@code null} if not set 732 */ 733 @Nullable 734 public MarkupMultiline getRemarks() { 735 return _remarks; 736 } 737 738 /** 739 * Set the "{@literal Remarks}". 740 * 741 * <p> 742 * Additional commentary about the containing object. 743 * 744 * @param value 745 * the remarks value to set, or {@code null} to clear 746 */ 747 public void setRemarks(@Nullable MarkupMultiline value) { 748 _remarks = value; 749 } 750 751 @Override 752 public String toString() { 753 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 754 } 755 756 /** 757 * Links this observation to relevant evidence. 758 */ 759 @MetaschemaAssembly( 760 formalName = "Relevant Evidence", 761 description = "Links this observation to relevant evidence.", 762 name = "relevant-evidence", 763 moduleClass = OscalAssessmentCommonModule.class 764 ) 765 public static class RelevantEvidence implements IBoundObject { 766 private final IMetaschemaData __metaschemaData; 767 768 /** 769 * A resolvable URL reference to relevant evidence. 770 */ 771 @BoundFlag( 772 formalName = "Relevant Evidence Reference", 773 description = "A resolvable URL reference to relevant evidence.", 774 name = "href", 775 typeAdapter = UriReferenceAdapter.class, 776 remarks = "This value may be one of:\n" 777 + "\n" 778 + "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n" 779 + "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" 780 + "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))." 781 ) 782 private URI _href; 783 784 /** 785 * A human-readable description of this evidence. 786 */ 787 @BoundField( 788 formalName = "Relevant Evidence Description", 789 description = "A human-readable description of this evidence.", 790 useName = "description", 791 minOccurs = 1, 792 typeAdapter = MarkupMultilineAdapter.class 793 ) 794 private MarkupMultiline _description; 795 796 /** 797 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 798 */ 799 @BoundAssembly( 800 formalName = "Property", 801 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 802 useName = "prop", 803 maxOccurs = -1, 804 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 805 ) 806 private List<Property> _props; 807 808 /** 809 * A reference to a local or remote resource, that has a specific relation to the containing object. 810 */ 811 @BoundAssembly( 812 formalName = "Link", 813 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 814 useName = "link", 815 maxOccurs = -1, 816 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 817 ) 818 private List<Link> _links; 819 820 /** 821 * Additional commentary about the containing object. 822 */ 823 @BoundField( 824 formalName = "Remarks", 825 description = "Additional commentary about the containing object.", 826 useName = "remarks", 827 typeAdapter = MarkupMultilineAdapter.class 828 ) 829 private MarkupMultiline _remarks; 830 831 /** 832 * Constructs a new {@code dev.metaschema.oscal.lib.model.Observation.RelevantEvidence} instance with no metadata. 833 */ 834 public RelevantEvidence() { 835 this(null); 836 } 837 838 /** 839 * Constructs a new {@code dev.metaschema.oscal.lib.model.Observation.RelevantEvidence} instance with the specified metadata. 840 * 841 * @param data 842 * the metaschema data, or {@code null} if none 843 */ 844 public RelevantEvidence(IMetaschemaData data) { 845 this.__metaschemaData = data; 846 } 847 848 @Override 849 public IMetaschemaData getMetaschemaData() { 850 return __metaschemaData; 851 } 852 853 /** 854 * Get the "{@literal Relevant Evidence Reference}". 855 * 856 * <p> 857 * A resolvable URL reference to relevant evidence. 858 * 859 * @return the href value, or {@code null} if not set 860 */ 861 @Nullable 862 public URI getHref() { 863 return _href; 864 } 865 866 /** 867 * Set the "{@literal Relevant Evidence Reference}". 868 * 869 * <p> 870 * A resolvable URL reference to relevant evidence. 871 * 872 * @param value 873 * the href value to set, or {@code null} to clear 874 */ 875 public void setHref(@Nullable URI value) { 876 _href = value; 877 } 878 879 /** 880 * Get the "{@literal Relevant Evidence Description}". 881 * 882 * <p> 883 * A human-readable description of this evidence. 884 * 885 * @return the description value 886 */ 887 @NonNull 888 public MarkupMultiline getDescription() { 889 return _description; 890 } 891 892 /** 893 * Set the "{@literal Relevant Evidence Description}". 894 * 895 * <p> 896 * A human-readable description of this evidence. 897 * 898 * @param value 899 * the description value to set 900 */ 901 public void setDescription(@NonNull MarkupMultiline value) { 902 _description = value; 903 } 904 905 /** 906 * Get the "{@literal Property}". 907 * 908 * <p> 909 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 910 * 911 * @return the prop value 912 */ 913 @NonNull 914 public List<Property> getProps() { 915 if (_props == null) { 916 _props = new LinkedList<>(); 917 } 918 return ObjectUtils.notNull(_props); 919 } 920 921 /** 922 * Set the "{@literal Property}". 923 * 924 * <p> 925 * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. 926 * 927 * @param value 928 * the prop value to set 929 */ 930 public void setProps(@NonNull List<Property> value) { 931 _props = value; 932 } 933 934 /** 935 * Add a new {@link Property} item to the underlying collection. 936 * @param item the item to add 937 * @return {@code true} 938 */ 939 public boolean addProp(Property item) { 940 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 941 if (_props == null) { 942 _props = new LinkedList<>(); 943 } 944 return _props.add(value); 945 } 946 947 /** 948 * Remove the first matching {@link Property} item from the underlying collection. 949 * @param item the item to remove 950 * @return {@code true} if the item was removed or {@code false} otherwise 951 */ 952 public boolean removeProp(Property item) { 953 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 954 return _props != null && _props.remove(value); 955 } 956 957 /** 958 * Get the "{@literal Link}". 959 * 960 * <p> 961 * A reference to a local or remote resource, that has a specific relation to the containing object. 962 * 963 * @return the link value 964 */ 965 @NonNull 966 public List<Link> getLinks() { 967 if (_links == null) { 968 _links = new LinkedList<>(); 969 } 970 return ObjectUtils.notNull(_links); 971 } 972 973 /** 974 * Set the "{@literal Link}". 975 * 976 * <p> 977 * A reference to a local or remote resource, that has a specific relation to the containing object. 978 * 979 * @param value 980 * the link value to set 981 */ 982 public void setLinks(@NonNull List<Link> value) { 983 _links = value; 984 } 985 986 /** 987 * Add a new {@link Link} item to the underlying collection. 988 * @param item the item to add 989 * @return {@code true} 990 */ 991 public boolean addLink(Link item) { 992 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 993 if (_links == null) { 994 _links = new LinkedList<>(); 995 } 996 return _links.add(value); 997 } 998 999 /** 1000 * Remove the first matching {@link Link} item from the underlying collection. 1001 * @param item the item to remove 1002 * @return {@code true} if the item was removed or {@code false} otherwise 1003 */ 1004 public boolean removeLink(Link item) { 1005 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1006 return _links != null && _links.remove(value); 1007 } 1008 1009 /** 1010 * Get the "{@literal Remarks}". 1011 * 1012 * <p> 1013 * Additional commentary about the containing object. 1014 * 1015 * @return the remarks value, or {@code null} if not set 1016 */ 1017 @Nullable 1018 public MarkupMultiline getRemarks() { 1019 return _remarks; 1020 } 1021 1022 /** 1023 * Set the "{@literal Remarks}". 1024 * 1025 * <p> 1026 * Additional commentary about the containing object. 1027 * 1028 * @param value 1029 * the remarks value to set, or {@code null} to clear 1030 */ 1031 public void setRemarks(@Nullable MarkupMultiline value) { 1032 _remarks = value; 1033 } 1034 1035 @Override 1036 public String toString() { 1037 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 1038 } 1039 } 1040}