001package gov.nist.secauto.oscal.lib.model; 002 003import gov.nist.secauto.metaschema.core.datatype.adapter.DateTimeWithTZAdapter; 004import gov.nist.secauto.metaschema.core.datatype.adapter.PositiveIntegerAdapter; 005import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter; 006import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter; 007import gov.nist.secauto.metaschema.core.datatype.adapter.UuidAdapter; 008import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine; 009import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter; 010import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline; 011import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter; 012import gov.nist.secauto.metaschema.core.model.IBoundObject; 013import gov.nist.secauto.metaschema.core.model.IMetaschemaData; 014import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior; 015import gov.nist.secauto.metaschema.core.model.constraint.IConstraint; 016import gov.nist.secauto.metaschema.core.util.ObjectUtils; 017import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue; 018import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues; 019import gov.nist.secauto.metaschema.databind.model.annotations.AssemblyConstraints; 020import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly; 021import gov.nist.secauto.metaschema.databind.model.annotations.BoundField; 022import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag; 023import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs; 024import gov.nist.secauto.metaschema.databind.model.annotations.IsUnique; 025import gov.nist.secauto.metaschema.databind.model.annotations.KeyField; 026import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly; 027import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints; 028import java.lang.Override; 029import java.lang.String; 030import java.math.BigInteger; 031import java.time.ZonedDateTime; 032import java.util.LinkedList; 033import java.util.List; 034import java.util.UUID; 035import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 036import org.apache.commons.lang3.builder.ToStringStyle; 037 038/** 039 * Represents a scheduled event or milestone, which may be associated with a series of assessment actions. 040 */ 041@MetaschemaAssembly( 042 formalName = "Task", 043 description = "Represents a scheduled event or milestone, which may be associated with a series of assessment actions.", 044 name = "task", 045 moduleClass = OscalAssessmentCommonModule.class 046) 047public class Task implements IBoundObject { 048 private final IMetaschemaData __metaschemaData; 049 050 /** 051 * "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 task 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>task</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." 052 */ 053 @BoundFlag( 054 formalName = "Task Universally Unique Identifier", 055 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 task elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). The locally defined *UUID* of the `task` 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.", 056 name = "uuid", 057 required = true, 058 typeAdapter = UuidAdapter.class 059 ) 060 private UUID _uuid; 061 062 /** 063 * "The type of task." 064 */ 065 @BoundFlag( 066 formalName = "Task Type", 067 description = "The type of task.", 068 name = "type", 069 required = true, 070 typeAdapter = TokenAdapter.class, 071 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "milestone", description = "The task represents a planned milestone."), @AllowedValue(value = "action", description = "The task represents a specific assessment action to be performed.")})) 072 ) 073 private String _type; 074 075 @BoundField( 076 formalName = "Task Title", 077 description = "The title for this task.", 078 useName = "title", 079 minOccurs = 1, 080 typeAdapter = MarkupLineAdapter.class 081 ) 082 private MarkupLine _title; 083 084 @BoundField( 085 formalName = "Task Description", 086 description = "A human-readable description of this task.", 087 useName = "description", 088 typeAdapter = MarkupMultilineAdapter.class 089 ) 090 private MarkupMultiline _description; 091 092 @BoundAssembly( 093 formalName = "Property", 094 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 095 useName = "prop", 096 maxOccurs = -1, 097 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 098 ) 099 private List<Property> _props; 100 101 @BoundAssembly( 102 formalName = "Link", 103 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 104 useName = "link", 105 maxOccurs = -1, 106 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 107 ) 108 private List<Link> _links; 109 110 @BoundAssembly( 111 formalName = "Event Timing", 112 description = "The timing under which the task is intended to occur.", 113 useName = "timing" 114 ) 115 private Timing _timing; 116 117 @BoundAssembly( 118 formalName = "Task Dependency", 119 description = "Used to indicate that a task is dependent on another task.", 120 useName = "dependency", 121 maxOccurs = -1, 122 groupAs = @GroupAs(name = "dependencies", inJson = JsonGroupAsBehavior.LIST) 123 ) 124 private List<Dependency> _dependencies; 125 126 @BoundAssembly( 127 formalName = "Task", 128 description = "Represents a scheduled event or milestone, which may be associated with a series of assessment actions.", 129 useName = "task", 130 maxOccurs = -1, 131 groupAs = @GroupAs(name = "tasks", inJson = JsonGroupAsBehavior.LIST) 132 ) 133 private List<Task> _tasks; 134 135 @BoundAssembly( 136 formalName = "Associated Activity", 137 description = "Identifies an individual activity to be performed as part of a task.", 138 useName = "associated-activity", 139 maxOccurs = -1, 140 groupAs = @GroupAs(name = "associated-activities", inJson = JsonGroupAsBehavior.LIST) 141 ) 142 private List<AssociatedActivity> _associatedActivities; 143 144 @BoundAssembly( 145 formalName = "Subject of Assessment", 146 description = "Identifies system elements being assessed, such as components, inventory items, and locations. In the assessment plan, this identifies a planned assessment subject. In the assessment results this is an actual assessment subject, and reflects any changes from the plan. exactly what will be the focus of this assessment. Any subjects not identified in this way are out-of-scope.", 147 useName = "subject", 148 remarks = "The assessment subjects that the activity was performed against.", 149 maxOccurs = -1, 150 groupAs = @GroupAs(name = "subjects", inJson = JsonGroupAsBehavior.LIST) 151 ) 152 private List<AssessmentSubject> _subjects; 153 154 @BoundAssembly( 155 formalName = "Responsible Role", 156 description = "A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.", 157 useName = "responsible-role", 158 remarks = "Identifies the person or organization responsible for performing a specific role related to the task.", 159 maxOccurs = -1, 160 groupAs = @GroupAs(name = "responsible-roles", inJson = JsonGroupAsBehavior.LIST) 161 ) 162 private List<ResponsibleRole> _responsibleRoles; 163 164 @BoundField( 165 formalName = "Remarks", 166 description = "Additional commentary about the containing object.", 167 useName = "remarks", 168 typeAdapter = MarkupMultilineAdapter.class 169 ) 170 private MarkupMultiline _remarks; 171 172 public Task() { 173 this(null); 174 } 175 176 public Task(IMetaschemaData data) { 177 this.__metaschemaData = data; 178 } 179 180 @Override 181 public IMetaschemaData getMetaschemaData() { 182 return __metaschemaData; 183 } 184 185 public UUID getUuid() { 186 return _uuid; 187 } 188 189 public void setUuid(UUID value) { 190 _uuid = value; 191 } 192 193 public String getType() { 194 return _type; 195 } 196 197 public void setType(String value) { 198 _type = value; 199 } 200 201 public MarkupLine getTitle() { 202 return _title; 203 } 204 205 public void setTitle(MarkupLine value) { 206 _title = value; 207 } 208 209 public MarkupMultiline getDescription() { 210 return _description; 211 } 212 213 public void setDescription(MarkupMultiline value) { 214 _description = value; 215 } 216 217 public List<Property> getProps() { 218 return _props; 219 } 220 221 public void setProps(List<Property> value) { 222 _props = value; 223 } 224 225 /** 226 * Add a new {@link Property} item to the underlying collection. 227 * @param item the item to add 228 * @return {@code true} 229 */ 230 public boolean addProp(Property item) { 231 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 232 if (_props == null) { 233 _props = new LinkedList<>(); 234 } 235 return _props.add(value); 236 } 237 238 /** 239 * Remove the first matching {@link Property} item from the underlying collection. 240 * @param item the item to remove 241 * @return {@code true} if the item was removed or {@code false} otherwise 242 */ 243 public boolean removeProp(Property item) { 244 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 245 return _props != null && _props.remove(value); 246 } 247 248 public List<Link> getLinks() { 249 return _links; 250 } 251 252 public void setLinks(List<Link> value) { 253 _links = value; 254 } 255 256 /** 257 * Add a new {@link Link} item to the underlying collection. 258 * @param item the item to add 259 * @return {@code true} 260 */ 261 public boolean addLink(Link item) { 262 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 263 if (_links == null) { 264 _links = new LinkedList<>(); 265 } 266 return _links.add(value); 267 } 268 269 /** 270 * Remove the first matching {@link Link} item from the underlying collection. 271 * @param item the item to remove 272 * @return {@code true} if the item was removed or {@code false} otherwise 273 */ 274 public boolean removeLink(Link item) { 275 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 276 return _links != null && _links.remove(value); 277 } 278 279 public Timing getTiming() { 280 return _timing; 281 } 282 283 public void setTiming(Timing value) { 284 _timing = value; 285 } 286 287 public List<Dependency> getDependencies() { 288 return _dependencies; 289 } 290 291 public void setDependencies(List<Dependency> value) { 292 _dependencies = value; 293 } 294 295 /** 296 * Add a new {@link Dependency} item to the underlying collection. 297 * @param item the item to add 298 * @return {@code true} 299 */ 300 public boolean addDependency(Dependency item) { 301 Dependency value = ObjectUtils.requireNonNull(item,"item cannot be null"); 302 if (_dependencies == null) { 303 _dependencies = new LinkedList<>(); 304 } 305 return _dependencies.add(value); 306 } 307 308 /** 309 * Remove the first matching {@link Dependency} item from the underlying collection. 310 * @param item the item to remove 311 * @return {@code true} if the item was removed or {@code false} otherwise 312 */ 313 public boolean removeDependency(Dependency item) { 314 Dependency value = ObjectUtils.requireNonNull(item,"item cannot be null"); 315 return _dependencies != null && _dependencies.remove(value); 316 } 317 318 public List<Task> getTasks() { 319 return _tasks; 320 } 321 322 public void setTasks(List<Task> value) { 323 _tasks = value; 324 } 325 326 /** 327 * Add a new {@link Task} item to the underlying collection. 328 * @param item the item to add 329 * @return {@code true} 330 */ 331 public boolean addTask(Task item) { 332 Task value = ObjectUtils.requireNonNull(item,"item cannot be null"); 333 if (_tasks == null) { 334 _tasks = new LinkedList<>(); 335 } 336 return _tasks.add(value); 337 } 338 339 /** 340 * Remove the first matching {@link Task} item from the underlying collection. 341 * @param item the item to remove 342 * @return {@code true} if the item was removed or {@code false} otherwise 343 */ 344 public boolean removeTask(Task item) { 345 Task value = ObjectUtils.requireNonNull(item,"item cannot be null"); 346 return _tasks != null && _tasks.remove(value); 347 } 348 349 public List<AssociatedActivity> getAssociatedActivities() { 350 return _associatedActivities; 351 } 352 353 public void setAssociatedActivities(List<AssociatedActivity> value) { 354 _associatedActivities = value; 355 } 356 357 /** 358 * Add a new {@link AssociatedActivity} item to the underlying collection. 359 * @param item the item to add 360 * @return {@code true} 361 */ 362 public boolean addAssociatedActivity(AssociatedActivity item) { 363 AssociatedActivity value = ObjectUtils.requireNonNull(item,"item cannot be null"); 364 if (_associatedActivities == null) { 365 _associatedActivities = new LinkedList<>(); 366 } 367 return _associatedActivities.add(value); 368 } 369 370 /** 371 * Remove the first matching {@link AssociatedActivity} item from the underlying collection. 372 * @param item the item to remove 373 * @return {@code true} if the item was removed or {@code false} otherwise 374 */ 375 public boolean removeAssociatedActivity(AssociatedActivity item) { 376 AssociatedActivity value = ObjectUtils.requireNonNull(item,"item cannot be null"); 377 return _associatedActivities != null && _associatedActivities.remove(value); 378 } 379 380 public List<AssessmentSubject> getSubjects() { 381 return _subjects; 382 } 383 384 public void setSubjects(List<AssessmentSubject> value) { 385 _subjects = value; 386 } 387 388 /** 389 * Add a new {@link AssessmentSubject} item to the underlying collection. 390 * @param item the item to add 391 * @return {@code true} 392 */ 393 public boolean addSubject(AssessmentSubject item) { 394 AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null"); 395 if (_subjects == null) { 396 _subjects = new LinkedList<>(); 397 } 398 return _subjects.add(value); 399 } 400 401 /** 402 * Remove the first matching {@link AssessmentSubject} item from the underlying collection. 403 * @param item the item to remove 404 * @return {@code true} if the item was removed or {@code false} otherwise 405 */ 406 public boolean removeSubject(AssessmentSubject item) { 407 AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null"); 408 return _subjects != null && _subjects.remove(value); 409 } 410 411 public List<ResponsibleRole> getResponsibleRoles() { 412 return _responsibleRoles; 413 } 414 415 public void setResponsibleRoles(List<ResponsibleRole> value) { 416 _responsibleRoles = value; 417 } 418 419 /** 420 * Add a new {@link ResponsibleRole} item to the underlying collection. 421 * @param item the item to add 422 * @return {@code true} 423 */ 424 public boolean addResponsibleRole(ResponsibleRole item) { 425 ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null"); 426 if (_responsibleRoles == null) { 427 _responsibleRoles = new LinkedList<>(); 428 } 429 return _responsibleRoles.add(value); 430 } 431 432 /** 433 * Remove the first matching {@link ResponsibleRole} item from the underlying collection. 434 * @param item the item to remove 435 * @return {@code true} if the item was removed or {@code false} otherwise 436 */ 437 public boolean removeResponsibleRole(ResponsibleRole item) { 438 ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null"); 439 return _responsibleRoles != null && _responsibleRoles.remove(value); 440 } 441 442 public MarkupMultiline getRemarks() { 443 return _remarks; 444 } 445 446 public void setRemarks(MarkupMultiline value) { 447 _remarks = value; 448 } 449 450 @Override 451 public String toString() { 452 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 453 } 454 455 /** 456 * The timing under which the task is intended to occur. 457 */ 458 @MetaschemaAssembly( 459 formalName = "Event Timing", 460 description = "The timing under which the task is intended to occur.", 461 name = "timing", 462 moduleClass = OscalAssessmentCommonModule.class 463 ) 464 public static class Timing implements IBoundObject { 465 private final IMetaschemaData __metaschemaData; 466 467 @BoundAssembly( 468 formalName = "On Date Condition", 469 description = "The task is intended to occur on the specified date.", 470 useName = "on-date", 471 minOccurs = 1 472 ) 473 private OnDate _onDate; 474 475 @BoundAssembly( 476 formalName = "On Date Range Condition", 477 description = "The task is intended to occur within the specified date range.", 478 useName = "within-date-range", 479 minOccurs = 1 480 ) 481 private WithinDateRange _withinDateRange; 482 483 @BoundAssembly( 484 formalName = "Frequency Condition", 485 description = "The task is intended to occur at the specified frequency.", 486 useName = "at-frequency", 487 minOccurs = 1 488 ) 489 private AtFrequency _atFrequency; 490 491 public Timing() { 492 this(null); 493 } 494 495 public Timing(IMetaschemaData data) { 496 this.__metaschemaData = data; 497 } 498 499 @Override 500 public IMetaschemaData getMetaschemaData() { 501 return __metaschemaData; 502 } 503 504 public OnDate getOnDate() { 505 return _onDate; 506 } 507 508 public void setOnDate(OnDate value) { 509 _onDate = value; 510 } 511 512 public WithinDateRange getWithinDateRange() { 513 return _withinDateRange; 514 } 515 516 public void setWithinDateRange(WithinDateRange value) { 517 _withinDateRange = value; 518 } 519 520 public AtFrequency getAtFrequency() { 521 return _atFrequency; 522 } 523 524 public void setAtFrequency(AtFrequency value) { 525 _atFrequency = value; 526 } 527 528 @Override 529 public String toString() { 530 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 531 } 532 533 /** 534 * The task is intended to occur on the specified date. 535 */ 536 @MetaschemaAssembly( 537 formalName = "On Date Condition", 538 description = "The task is intended to occur on the specified date.", 539 name = "on-date", 540 moduleClass = OscalAssessmentCommonModule.class 541 ) 542 public static class OnDate implements IBoundObject { 543 private final IMetaschemaData __metaschemaData; 544 545 /** 546 * "The task must occur on the specified date." 547 */ 548 @BoundFlag( 549 formalName = "On Date Condition", 550 description = "The task must occur on the specified date.", 551 name = "date", 552 required = true, 553 typeAdapter = DateTimeWithTZAdapter.class 554 ) 555 private ZonedDateTime _date; 556 557 public OnDate() { 558 this(null); 559 } 560 561 public OnDate(IMetaschemaData data) { 562 this.__metaschemaData = data; 563 } 564 565 @Override 566 public IMetaschemaData getMetaschemaData() { 567 return __metaschemaData; 568 } 569 570 public ZonedDateTime getDate() { 571 return _date; 572 } 573 574 public void setDate(ZonedDateTime value) { 575 _date = value; 576 } 577 578 @Override 579 public String toString() { 580 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 581 } 582 } 583 584 /** 585 * The task is intended to occur within the specified date range. 586 */ 587 @MetaschemaAssembly( 588 formalName = "On Date Range Condition", 589 description = "The task is intended to occur within the specified date range.", 590 name = "within-date-range", 591 moduleClass = OscalAssessmentCommonModule.class 592 ) 593 public static class WithinDateRange implements IBoundObject { 594 private final IMetaschemaData __metaschemaData; 595 596 /** 597 * "The task must occur on or after the specified date." 598 */ 599 @BoundFlag( 600 formalName = "Start Date Condition", 601 description = "The task must occur on or after the specified date.", 602 name = "start", 603 required = true, 604 typeAdapter = DateTimeWithTZAdapter.class 605 ) 606 private ZonedDateTime _start; 607 608 /** 609 * "The task must occur on or before the specified date." 610 */ 611 @BoundFlag( 612 formalName = "End Date Condition", 613 description = "The task must occur on or before the specified date.", 614 name = "end", 615 required = true, 616 typeAdapter = DateTimeWithTZAdapter.class 617 ) 618 private ZonedDateTime _end; 619 620 public WithinDateRange() { 621 this(null); 622 } 623 624 public WithinDateRange(IMetaschemaData data) { 625 this.__metaschemaData = data; 626 } 627 628 @Override 629 public IMetaschemaData getMetaschemaData() { 630 return __metaschemaData; 631 } 632 633 public ZonedDateTime getStart() { 634 return _start; 635 } 636 637 public void setStart(ZonedDateTime value) { 638 _start = value; 639 } 640 641 public ZonedDateTime getEnd() { 642 return _end; 643 } 644 645 public void setEnd(ZonedDateTime value) { 646 _end = value; 647 } 648 649 @Override 650 public String toString() { 651 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 652 } 653 } 654 655 /** 656 * The task is intended to occur at the specified frequency. 657 */ 658 @MetaschemaAssembly( 659 formalName = "Frequency Condition", 660 description = "The task is intended to occur at the specified frequency.", 661 name = "at-frequency", 662 moduleClass = OscalAssessmentCommonModule.class 663 ) 664 public static class AtFrequency implements IBoundObject { 665 private final IMetaschemaData __metaschemaData; 666 667 /** 668 * "The task must occur after the specified period has elapsed." 669 */ 670 @BoundFlag( 671 formalName = "Period", 672 description = "The task must occur after the specified period has elapsed.", 673 name = "period", 674 required = true, 675 typeAdapter = PositiveIntegerAdapter.class 676 ) 677 private BigInteger _period; 678 679 /** 680 * "The unit of time for the period." 681 */ 682 @BoundFlag( 683 formalName = "Time Unit", 684 description = "The unit of time for the period.", 685 name = "unit", 686 required = true, 687 typeAdapter = StringAdapter.class, 688 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "seconds", description = "The period is specified in seconds."), @AllowedValue(value = "minutes", description = "The period is specified in minutes."), @AllowedValue(value = "hours", description = "The period is specified in hours."), @AllowedValue(value = "days", description = "The period is specified in days."), @AllowedValue(value = "months", description = "The period is specified in calendar months."), @AllowedValue(value = "years", description = "The period is specified in calendar years.")})) 689 ) 690 private String _unit; 691 692 public AtFrequency() { 693 this(null); 694 } 695 696 public AtFrequency(IMetaschemaData data) { 697 this.__metaschemaData = data; 698 } 699 700 @Override 701 public IMetaschemaData getMetaschemaData() { 702 return __metaschemaData; 703 } 704 705 public BigInteger getPeriod() { 706 return _period; 707 } 708 709 public void setPeriod(BigInteger value) { 710 _period = value; 711 } 712 713 public String getUnit() { 714 return _unit; 715 } 716 717 public void setUnit(String value) { 718 _unit = value; 719 } 720 721 @Override 722 public String toString() { 723 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 724 } 725 } 726 } 727 728 /** 729 * Used to indicate that a task is dependent on another task. 730 */ 731 @MetaschemaAssembly( 732 formalName = "Task Dependency", 733 description = "Used to indicate that a task is dependent on another task.", 734 name = "dependency", 735 moduleClass = OscalAssessmentCommonModule.class 736 ) 737 public static class Dependency implements IBoundObject { 738 private final IMetaschemaData __metaschemaData; 739 740 /** 741 * "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a> identifier reference to a unique task." 742 */ 743 @BoundFlag( 744 formalName = "Task Universally Unique Identifier Reference", 745 description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to a unique task.", 746 name = "task-uuid", 747 required = true, 748 typeAdapter = UuidAdapter.class 749 ) 750 private UUID _taskUuid; 751 752 @BoundField( 753 formalName = "Remarks", 754 description = "Additional commentary about the containing object.", 755 useName = "remarks", 756 typeAdapter = MarkupMultilineAdapter.class 757 ) 758 private MarkupMultiline _remarks; 759 760 public Dependency() { 761 this(null); 762 } 763 764 public Dependency(IMetaschemaData data) { 765 this.__metaschemaData = data; 766 } 767 768 @Override 769 public IMetaschemaData getMetaschemaData() { 770 return __metaschemaData; 771 } 772 773 public UUID getTaskUuid() { 774 return _taskUuid; 775 } 776 777 public void setTaskUuid(UUID value) { 778 _taskUuid = value; 779 } 780 781 public MarkupMultiline getRemarks() { 782 return _remarks; 783 } 784 785 public void setRemarks(MarkupMultiline value) { 786 _remarks = value; 787 } 788 789 @Override 790 public String toString() { 791 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 792 } 793 } 794 795 /** 796 * Identifies an individual activity to be performed as part of a task. 797 */ 798 @MetaschemaAssembly( 799 formalName = "Associated Activity", 800 description = "Identifies an individual activity to be performed as part of a task.", 801 name = "associated-activity", 802 moduleClass = OscalAssessmentCommonModule.class, 803 modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "unique-associated-activity-responsible-role", level = IConstraint.Level.ERROR, target = "responsible-role", keyFields = @KeyField(target = "@role-id"), remarks = "Since `responsible-role` associates multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once.")) 804 ) 805 public static class AssociatedActivity implements IBoundObject { 806 private final IMetaschemaData __metaschemaData; 807 808 /** 809 * "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a> identifier reference to an activity defined in the list of activities." 810 */ 811 @BoundFlag( 812 formalName = "Activity Universally Unique Identifier Reference", 813 description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to an activity defined in the list of activities.", 814 name = "activity-uuid", 815 required = true, 816 typeAdapter = UuidAdapter.class 817 ) 818 private UUID _activityUuid; 819 820 @BoundAssembly( 821 formalName = "Property", 822 description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.", 823 useName = "prop", 824 maxOccurs = -1, 825 groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 826 ) 827 private List<Property> _props; 828 829 @BoundAssembly( 830 formalName = "Link", 831 description = "A reference to a local or remote resource, that has a specific relation to the containing object.", 832 useName = "link", 833 maxOccurs = -1, 834 groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST) 835 ) 836 private List<Link> _links; 837 838 @BoundAssembly( 839 formalName = "Responsible Role", 840 description = "A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.", 841 useName = "responsible-role", 842 remarks = "Identifies the person or organization responsible for performing a specific role defined by the activity.", 843 maxOccurs = -1, 844 groupAs = @GroupAs(name = "responsible-roles", inJson = JsonGroupAsBehavior.LIST) 845 ) 846 private List<ResponsibleRole> _responsibleRoles; 847 848 @BoundAssembly( 849 formalName = "Subject of Assessment", 850 description = "Identifies system elements being assessed, such as components, inventory items, and locations. In the assessment plan, this identifies a planned assessment subject. In the assessment results this is an actual assessment subject, and reflects any changes from the plan. exactly what will be the focus of this assessment. Any subjects not identified in this way are out-of-scope.", 851 useName = "subject", 852 minOccurs = 1, 853 maxOccurs = -1, 854 groupAs = @GroupAs(name = "subjects", inJson = JsonGroupAsBehavior.LIST) 855 ) 856 private List<AssessmentSubject> _subjects; 857 858 @BoundField( 859 formalName = "Remarks", 860 description = "Additional commentary about the containing object.", 861 useName = "remarks", 862 typeAdapter = MarkupMultilineAdapter.class 863 ) 864 private MarkupMultiline _remarks; 865 866 public AssociatedActivity() { 867 this(null); 868 } 869 870 public AssociatedActivity(IMetaschemaData data) { 871 this.__metaschemaData = data; 872 } 873 874 @Override 875 public IMetaschemaData getMetaschemaData() { 876 return __metaschemaData; 877 } 878 879 public UUID getActivityUuid() { 880 return _activityUuid; 881 } 882 883 public void setActivityUuid(UUID value) { 884 _activityUuid = value; 885 } 886 887 public List<Property> getProps() { 888 return _props; 889 } 890 891 public void setProps(List<Property> value) { 892 _props = value; 893 } 894 895 /** 896 * Add a new {@link Property} item to the underlying collection. 897 * @param item the item to add 898 * @return {@code true} 899 */ 900 public boolean addProp(Property item) { 901 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 902 if (_props == null) { 903 _props = new LinkedList<>(); 904 } 905 return _props.add(value); 906 } 907 908 /** 909 * Remove the first matching {@link Property} item from the underlying collection. 910 * @param item the item to remove 911 * @return {@code true} if the item was removed or {@code false} otherwise 912 */ 913 public boolean removeProp(Property item) { 914 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 915 return _props != null && _props.remove(value); 916 } 917 918 public List<Link> getLinks() { 919 return _links; 920 } 921 922 public void setLinks(List<Link> value) { 923 _links = value; 924 } 925 926 /** 927 * Add a new {@link Link} item to the underlying collection. 928 * @param item the item to add 929 * @return {@code true} 930 */ 931 public boolean addLink(Link item) { 932 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 933 if (_links == null) { 934 _links = new LinkedList<>(); 935 } 936 return _links.add(value); 937 } 938 939 /** 940 * Remove the first matching {@link Link} item from the underlying collection. 941 * @param item the item to remove 942 * @return {@code true} if the item was removed or {@code false} otherwise 943 */ 944 public boolean removeLink(Link item) { 945 Link value = ObjectUtils.requireNonNull(item,"item cannot be null"); 946 return _links != null && _links.remove(value); 947 } 948 949 public List<ResponsibleRole> getResponsibleRoles() { 950 return _responsibleRoles; 951 } 952 953 public void setResponsibleRoles(List<ResponsibleRole> value) { 954 _responsibleRoles = value; 955 } 956 957 /** 958 * Add a new {@link ResponsibleRole} item to the underlying collection. 959 * @param item the item to add 960 * @return {@code true} 961 */ 962 public boolean addResponsibleRole(ResponsibleRole item) { 963 ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null"); 964 if (_responsibleRoles == null) { 965 _responsibleRoles = new LinkedList<>(); 966 } 967 return _responsibleRoles.add(value); 968 } 969 970 /** 971 * Remove the first matching {@link ResponsibleRole} item from the underlying collection. 972 * @param item the item to remove 973 * @return {@code true} if the item was removed or {@code false} otherwise 974 */ 975 public boolean removeResponsibleRole(ResponsibleRole item) { 976 ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null"); 977 return _responsibleRoles != null && _responsibleRoles.remove(value); 978 } 979 980 public List<AssessmentSubject> getSubjects() { 981 return _subjects; 982 } 983 984 public void setSubjects(List<AssessmentSubject> value) { 985 _subjects = value; 986 } 987 988 /** 989 * Add a new {@link AssessmentSubject} item to the underlying collection. 990 * @param item the item to add 991 * @return {@code true} 992 */ 993 public boolean addSubject(AssessmentSubject item) { 994 AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null"); 995 if (_subjects == null) { 996 _subjects = new LinkedList<>(); 997 } 998 return _subjects.add(value); 999 } 1000 1001 /** 1002 * Remove the first matching {@link AssessmentSubject} item from the underlying collection. 1003 * @param item the item to remove 1004 * @return {@code true} if the item was removed or {@code false} otherwise 1005 */ 1006 public boolean removeSubject(AssessmentSubject item) { 1007 AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null"); 1008 return _subjects != null && _subjects.remove(value); 1009 } 1010 1011 public MarkupMultiline getRemarks() { 1012 return _remarks; 1013 } 1014 1015 public void setRemarks(MarkupMultiline value) { 1016 _remarks = value; 1017 } 1018 1019 @Override 1020 public String toString() { 1021 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 1022 } 1023 } 1024}