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.UuidAdapter;
006import dev.metaschema.core.datatype.markup.MarkupMultiline;
007import dev.metaschema.core.datatype.markup.MarkupMultilineAdapter;
008import dev.metaschema.core.model.IBoundObject;
009import dev.metaschema.core.model.IMetaschemaData;
010import dev.metaschema.core.model.JsonGroupAsBehavior;
011import dev.metaschema.core.model.constraint.IConstraint;
012import dev.metaschema.core.util.ObjectUtils;
013import dev.metaschema.databind.model.annotations.AssemblyConstraints;
014import dev.metaschema.databind.model.annotations.BoundAssembly;
015import dev.metaschema.databind.model.annotations.BoundField;
016import dev.metaschema.databind.model.annotations.BoundFlag;
017import dev.metaschema.databind.model.annotations.GroupAs;
018import dev.metaschema.databind.model.annotations.IsUnique;
019import dev.metaschema.databind.model.annotations.KeyField;
020import dev.metaschema.databind.model.annotations.MetaschemaAssembly;
021import edu.umd.cs.findbugs.annotations.NonNull;
022import edu.umd.cs.findbugs.annotations.Nullable;
023import java.util.LinkedList;
024import java.util.List;
025import java.util.UUID;
026import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
027import org.apache.commons.lang3.builder.ToStringStyle;
028
029/**
030 * Identifies an individual task for which the containing object is a consequence of.
031 */
032@MetaschemaAssembly(
033    formalName = "Task Reference",
034    description = "Identifies an individual task for which the containing object is a consequence of.",
035    name = "related-task",
036    moduleClass = OscalAssessmentCommonModule.class,
037    modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "oscal-unique-ssp-related-task-responsible-party", level = IConstraint.Level.ERROR, target = "responsible-party", keyFields = @KeyField(target = "@role-id"), remarks = "Since `responsible-party` associates multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once."))
038)
039public class RelatedTask implements IBoundObject {
040  private final IMetaschemaData __metaschemaData;
041
042  /**
043   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a unique task.
044   */
045  @BoundFlag(
046      formalName = "Task Universally Unique Identifier Reference",
047      description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to a unique task.",
048      name = "task-uuid",
049      required = true,
050      typeAdapter = UuidAdapter.class
051  )
052  private UUID _taskUuid;
053
054  /**
055   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
056   */
057  @BoundAssembly(
058      formalName = "Property",
059      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
060      useName = "prop",
061      maxOccurs = -1,
062      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
063  )
064  private List<Property> _props;
065
066  /**
067   * A reference to a local or remote resource, that has a specific relation to the containing object.
068   */
069  @BoundAssembly(
070      formalName = "Link",
071      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
072      useName = "link",
073      maxOccurs = -1,
074      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
075  )
076  private List<Link> _links;
077
078  /**
079   * A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object.
080   */
081  @BoundAssembly(
082      formalName = "Responsible Party",
083      description = "A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object.",
084      useName = "responsible-party",
085      remarks = "Identifies the person or organization responsible for performing a specific role defined by the activity.",
086      maxOccurs = -1,
087      groupAs = @GroupAs(name = "responsible-parties", inJson = JsonGroupAsBehavior.LIST)
088  )
089  private List<ResponsibleParty> _responsibleParties;
090
091  /**
092   * 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.
093   */
094  @BoundAssembly(
095      formalName = "Subject of Assessment",
096      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.",
097      useName = "subject",
098      remarks = "The assessment subjects that the task was performed against.",
099      maxOccurs = -1,
100      groupAs = @GroupAs(name = "subjects", inJson = JsonGroupAsBehavior.LIST)
101  )
102  private List<AssessmentSubject> _subjects;
103
104  /**
105   * Used to detail assessment subjects that were identified by this task.
106   */
107  @BoundAssembly(
108      formalName = "Identified Subject",
109      description = "Used to detail assessment subjects that were identified by this task.",
110      useName = "identified-subject"
111  )
112  private IdentifiedSubject _identifiedSubject;
113
114  /**
115   * Additional commentary about the containing object.
116   */
117  @BoundField(
118      formalName = "Remarks",
119      description = "Additional commentary about the containing object.",
120      useName = "remarks",
121      typeAdapter = MarkupMultilineAdapter.class
122  )
123  private MarkupMultiline _remarks;
124
125  /**
126   * Constructs a new {@code dev.metaschema.oscal.lib.model.RelatedTask} instance with no metadata.
127   */
128  public RelatedTask() {
129    this(null);
130  }
131
132  /**
133   * Constructs a new {@code dev.metaschema.oscal.lib.model.RelatedTask} instance with the specified metadata.
134   *
135   * @param data
136   *           the metaschema data, or {@code null} if none
137   */
138  public RelatedTask(IMetaschemaData data) {
139    this.__metaschemaData = data;
140  }
141
142  @Override
143  public IMetaschemaData getMetaschemaData() {
144    return __metaschemaData;
145  }
146
147  /**
148   * Get the "{@literal Task Universally Unique Identifier Reference}".
149   *
150   * <p>
151   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a unique task.
152   *
153   * @return the task-uuid value
154   */
155  @NonNull
156  public UUID getTaskUuid() {
157    return _taskUuid;
158  }
159
160  /**
161   * Set the "{@literal Task Universally Unique Identifier Reference}".
162   *
163   * <p>
164   * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a unique task.
165   *
166   * @param value
167   *           the task-uuid value to set
168   */
169  public void setTaskUuid(@NonNull UUID value) {
170    _taskUuid = value;
171  }
172
173  /**
174   * Get the "{@literal Property}".
175   *
176   * <p>
177   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
178   *
179   * @return the prop value
180   */
181  @NonNull
182  public List<Property> getProps() {
183    if (_props == null) {
184      _props = new LinkedList<>();
185    }
186    return ObjectUtils.notNull(_props);
187  }
188
189  /**
190   * Set the "{@literal Property}".
191   *
192   * <p>
193   * An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.
194   *
195   * @param value
196   *           the prop value to set
197   */
198  public void setProps(@NonNull List<Property> value) {
199    _props = value;
200  }
201
202  /**
203   * Add a new {@link Property} item to the underlying collection.
204   * @param item the item to add
205   * @return {@code true}
206   */
207  public boolean addProp(Property item) {
208    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
209    if (_props == null) {
210      _props = new LinkedList<>();
211    }
212    return _props.add(value);
213  }
214
215  /**
216   * Remove the first matching {@link Property} item from the underlying collection.
217   * @param item the item to remove
218   * @return {@code true} if the item was removed or {@code false} otherwise
219   */
220  public boolean removeProp(Property item) {
221    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
222    return _props != null && _props.remove(value);
223  }
224
225  /**
226   * Get the "{@literal Link}".
227   *
228   * <p>
229   * A reference to a local or remote resource, that has a specific relation to the containing object.
230   *
231   * @return the link value
232   */
233  @NonNull
234  public List<Link> getLinks() {
235    if (_links == null) {
236      _links = new LinkedList<>();
237    }
238    return ObjectUtils.notNull(_links);
239  }
240
241  /**
242   * Set the "{@literal Link}".
243   *
244   * <p>
245   * A reference to a local or remote resource, that has a specific relation to the containing object.
246   *
247   * @param value
248   *           the link value to set
249   */
250  public void setLinks(@NonNull List<Link> value) {
251    _links = value;
252  }
253
254  /**
255   * Add a new {@link Link} item to the underlying collection.
256   * @param item the item to add
257   * @return {@code true}
258   */
259  public boolean addLink(Link item) {
260    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
261    if (_links == null) {
262      _links = new LinkedList<>();
263    }
264    return _links.add(value);
265  }
266
267  /**
268   * Remove the first matching {@link Link} item from the underlying collection.
269   * @param item the item to remove
270   * @return {@code true} if the item was removed or {@code false} otherwise
271   */
272  public boolean removeLink(Link item) {
273    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
274    return _links != null && _links.remove(value);
275  }
276
277  /**
278   * Get the "{@literal Responsible Party}".
279   *
280   * <p>
281   * A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object.
282   *
283   * @return the responsible-party value
284   */
285  @NonNull
286  public List<ResponsibleParty> getResponsibleParties() {
287    if (_responsibleParties == null) {
288      _responsibleParties = new LinkedList<>();
289    }
290    return ObjectUtils.notNull(_responsibleParties);
291  }
292
293  /**
294   * Set the "{@literal Responsible Party}".
295   *
296   * <p>
297   * A reference to a set of persons and/or organizations that have responsibility for performing the referenced role in the context of the containing object.
298   *
299   * @param value
300   *           the responsible-party value to set
301   */
302  public void setResponsibleParties(@NonNull List<ResponsibleParty> value) {
303    _responsibleParties = value;
304  }
305
306  /**
307   * Add a new {@link ResponsibleParty} item to the underlying collection.
308   * @param item the item to add
309   * @return {@code true}
310   */
311  public boolean addResponsibleParty(ResponsibleParty item) {
312    ResponsibleParty value = ObjectUtils.requireNonNull(item,"item cannot be null");
313    if (_responsibleParties == null) {
314      _responsibleParties = new LinkedList<>();
315    }
316    return _responsibleParties.add(value);
317  }
318
319  /**
320   * Remove the first matching {@link ResponsibleParty} item from the underlying collection.
321   * @param item the item to remove
322   * @return {@code true} if the item was removed or {@code false} otherwise
323   */
324  public boolean removeResponsibleParty(ResponsibleParty item) {
325    ResponsibleParty value = ObjectUtils.requireNonNull(item,"item cannot be null");
326    return _responsibleParties != null && _responsibleParties.remove(value);
327  }
328
329  /**
330   * Get the "{@literal Subject of Assessment}".
331   *
332   * <p>
333   * 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.
334   *
335   * @return the subject value
336   */
337  @NonNull
338  public List<AssessmentSubject> getSubjects() {
339    if (_subjects == null) {
340      _subjects = new LinkedList<>();
341    }
342    return ObjectUtils.notNull(_subjects);
343  }
344
345  /**
346   * Set the "{@literal Subject of Assessment}".
347   *
348   * <p>
349   * 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.
350   *
351   * @param value
352   *           the subject value to set
353   */
354  public void setSubjects(@NonNull List<AssessmentSubject> value) {
355    _subjects = value;
356  }
357
358  /**
359   * Add a new {@link AssessmentSubject} item to the underlying collection.
360   * @param item the item to add
361   * @return {@code true}
362   */
363  public boolean addSubject(AssessmentSubject item) {
364    AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null");
365    if (_subjects == null) {
366      _subjects = new LinkedList<>();
367    }
368    return _subjects.add(value);
369  }
370
371  /**
372   * Remove the first matching {@link AssessmentSubject} item from the underlying collection.
373   * @param item the item to remove
374   * @return {@code true} if the item was removed or {@code false} otherwise
375   */
376  public boolean removeSubject(AssessmentSubject item) {
377    AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null");
378    return _subjects != null && _subjects.remove(value);
379  }
380
381  /**
382   * Get the "{@literal Identified Subject}".
383   *
384   * <p>
385   * Used to detail assessment subjects that were identified by this task.
386   *
387   * @return the identified-subject value, or {@code null} if not set
388   */
389  @Nullable
390  public IdentifiedSubject getIdentifiedSubject() {
391    return _identifiedSubject;
392  }
393
394  /**
395   * Set the "{@literal Identified Subject}".
396   *
397   * <p>
398   * Used to detail assessment subjects that were identified by this task.
399   *
400   * @param value
401   *           the identified-subject value to set, or {@code null} to clear
402   */
403  public void setIdentifiedSubject(@Nullable IdentifiedSubject value) {
404    _identifiedSubject = value;
405  }
406
407  /**
408   * Get the "{@literal Remarks}".
409   *
410   * <p>
411   * Additional commentary about the containing object.
412   *
413   * @return the remarks value, or {@code null} if not set
414   */
415  @Nullable
416  public MarkupMultiline getRemarks() {
417    return _remarks;
418  }
419
420  /**
421   * Set the "{@literal Remarks}".
422   *
423   * <p>
424   * Additional commentary about the containing object.
425   *
426   * @param value
427   *           the remarks value to set, or {@code null} to clear
428   */
429  public void setRemarks(@Nullable MarkupMultiline value) {
430    _remarks = value;
431  }
432
433  @Override
434  public String toString() {
435    return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
436  }
437
438  /**
439   * Used to detail assessment subjects that were identified by this task.
440   */
441  @MetaschemaAssembly(
442      formalName = "Identified Subject",
443      description = "Used to detail assessment subjects that were identified by this task.",
444      name = "identified-subject",
445      moduleClass = OscalAssessmentCommonModule.class
446  )
447  public static class IdentifiedSubject implements IBoundObject {
448    private final IMetaschemaData __metaschemaData;
449
450    /**
451     * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a unique assessment subject placeholder defined by this task.
452     */
453    @BoundFlag(
454        formalName = "Assessment Subject Placeholder Universally Unique Identifier Reference",
455        description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to a unique assessment subject placeholder defined by this task.",
456        name = "subject-placeholder-uuid",
457        required = true,
458        typeAdapter = UuidAdapter.class
459    )
460    private UUID _subjectPlaceholderUuid;
461
462    /**
463     * 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.
464     */
465    @BoundAssembly(
466        formalName = "Subject of Assessment",
467        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.",
468        useName = "subject",
469        remarks = "The assessment subjects that the task identified, which will be used by another task through a subject-placeholder reference. Such a task will \"consume\" these subjects.",
470        minOccurs = 1,
471        maxOccurs = -1,
472        groupAs = @GroupAs(name = "subjects", inJson = JsonGroupAsBehavior.LIST)
473    )
474    private List<AssessmentSubject> _subjects;
475
476    /**
477     * Constructs a new {@code dev.metaschema.oscal.lib.model.RelatedTask.IdentifiedSubject} instance with no metadata.
478     */
479    public IdentifiedSubject() {
480      this(null);
481    }
482
483    /**
484     * Constructs a new {@code dev.metaschema.oscal.lib.model.RelatedTask.IdentifiedSubject} instance with the specified metadata.
485     *
486     * @param data
487     *           the metaschema data, or {@code null} if none
488     */
489    public IdentifiedSubject(IMetaschemaData data) {
490      this.__metaschemaData = data;
491    }
492
493    @Override
494    public IMetaschemaData getMetaschemaData() {
495      return __metaschemaData;
496    }
497
498    /**
499     * Get the "{@literal Assessment Subject Placeholder Universally Unique Identifier Reference}".
500     *
501     * <p>
502     * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a unique assessment subject placeholder defined by this task.
503     *
504     * @return the subject-placeholder-uuid value
505     */
506    @NonNull
507    public UUID getSubjectPlaceholderUuid() {
508      return _subjectPlaceholderUuid;
509    }
510
511    /**
512     * Set the "{@literal Assessment Subject Placeholder Universally Unique Identifier Reference}".
513     *
514     * <p>
515     * A <a href="https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented">machine-oriented</a> identifier reference to a unique assessment subject placeholder defined by this task.
516     *
517     * @param value
518     *           the subject-placeholder-uuid value to set
519     */
520    public void setSubjectPlaceholderUuid(@NonNull UUID value) {
521      _subjectPlaceholderUuid = value;
522    }
523
524    /**
525     * Get the "{@literal Subject of Assessment}".
526     *
527     * <p>
528     * 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.
529     *
530     * @return the subject value
531     */
532    @NonNull
533    public List<AssessmentSubject> getSubjects() {
534      if (_subjects == null) {
535        _subjects = new LinkedList<>();
536      }
537      return ObjectUtils.notNull(_subjects);
538    }
539
540    /**
541     * Set the "{@literal Subject of Assessment}".
542     *
543     * <p>
544     * 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.
545     *
546     * @param value
547     *           the subject value to set
548     */
549    public void setSubjects(@NonNull List<AssessmentSubject> value) {
550      _subjects = value;
551    }
552
553    /**
554     * Add a new {@link AssessmentSubject} item to the underlying collection.
555     * @param item the item to add
556     * @return {@code true}
557     */
558    public boolean addSubject(AssessmentSubject item) {
559      AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null");
560      if (_subjects == null) {
561        _subjects = new LinkedList<>();
562      }
563      return _subjects.add(value);
564    }
565
566    /**
567     * Remove the first matching {@link AssessmentSubject} item from the underlying collection.
568     * @param item the item to remove
569     * @return {@code true} if the item was removed or {@code false} otherwise
570     */
571    public boolean removeSubject(AssessmentSubject item) {
572      AssessmentSubject value = ObjectUtils.requireNonNull(item,"item cannot be null");
573      return _subjects != null && _subjects.remove(value);
574    }
575
576    @Override
577    public String toString() {
578      return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString());
579    }
580  }
581}