001package gov.nist.secauto.oscal.lib.model;
002
003import gov.nist.secauto.metaschema.core.datatype.adapter.UuidAdapter;
004import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine;
005import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter;
006import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline;
007import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter;
008import gov.nist.secauto.metaschema.core.model.IBoundObject;
009import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
010import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
011import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
012import gov.nist.secauto.metaschema.core.util.ObjectUtils;
013import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly;
014import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
015import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag;
016import gov.nist.secauto.metaschema.databind.model.annotations.Expect;
017import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
018import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
019import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
020import java.lang.Override;
021import java.lang.String;
022import java.util.LinkedList;
023import java.util.List;
024import java.util.UUID;
025import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
026import org.apache.commons.lang3.builder.ToStringStyle;
027
028/**
029 * Describes an individual POA&M item.
030 */
031@MetaschemaAssembly(
032    formalName = "POA&M Item",
033    description = "Describes an individual POA\\&M item.",
034    name = "poam-item",
035    moduleClass = OscalPoamModule.class,
036    valueConstraints = @ValueConstraints(expect = @Expect(level = IConstraint.Level.WARNING, test = "@uuid", message = "It is a best practice to provide a UUID."))
037)
038public class PoamItem implements IBoundObject {
039  private final IMetaschemaData __metaschemaData;
040
041  /**
042   * "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/#instance\">instance</a> scope that can be used to reference this POA&amp;M item entry in <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#poam-identifiers\">this OSCAL instance</a>. 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."
043   */
044  @BoundFlag(
045      formalName = "POA&M Item Universally Unique Identifier",
046      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 [instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#instance) scope that can be used to reference this POA\\&M item entry in [this OSCAL instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#poam-identifiers). 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.",
047      name = "uuid",
048      typeAdapter = UuidAdapter.class
049  )
050  private UUID _uuid;
051
052  @BoundField(
053      formalName = "POA&M Item Title",
054      description = "The title or name for this POA\\&M item .",
055      useName = "title",
056      minOccurs = 1,
057      typeAdapter = MarkupLineAdapter.class
058  )
059  private MarkupLine _title;
060
061  @BoundField(
062      formalName = "POA&M Item Description",
063      description = "A human-readable description of POA\\&M item.",
064      useName = "description",
065      minOccurs = 1,
066      typeAdapter = MarkupMultilineAdapter.class
067  )
068  private MarkupMultiline _description;
069
070  @BoundAssembly(
071      formalName = "Property",
072      description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
073      useName = "prop",
074      maxOccurs = -1,
075      groupAs = @GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST)
076  )
077  private List<Property> _props;
078
079  @BoundAssembly(
080      formalName = "Link",
081      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
082      useName = "link",
083      maxOccurs = -1,
084      groupAs = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
085  )
086  private List<Link> _links;
087
088  @BoundAssembly(
089      formalName = "Origin",
090      description = "Identifies the source of the finding, such as a tool or person.",
091      useName = "origin",
092      remarks = "Used to identify the individual and/or tool generated this poam-item.",
093      maxOccurs = -1,
094      groupAs = @GroupAs(name = "origins", inJson = JsonGroupAsBehavior.LIST)
095  )
096  private List<Origin> _origins;
097
098  @BoundAssembly(
099      formalName = "Related Finding",
100      description = "Relates the poam-item to referenced finding(s).",
101      useName = "related-finding",
102      maxOccurs = -1,
103      groupAs = @GroupAs(name = "related-findings", inJson = JsonGroupAsBehavior.LIST)
104  )
105  private List<RelatedFinding> _relatedFindings;
106
107  @BoundAssembly(
108      formalName = "Related Observation",
109      description = "Relates the poam-item to a set of referenced observations that were used to determine the finding.",
110      useName = "related-observation",
111      maxOccurs = -1,
112      groupAs = @GroupAs(name = "related-observations", inJson = JsonGroupAsBehavior.LIST)
113  )
114  private List<RelatedObservation> _relatedObservations;
115
116  @BoundAssembly(
117      formalName = "Associated Risk",
118      description = "Relates the finding to a set of referenced risks that were used to determine the finding.",
119      useName = "associated-risk",
120      maxOccurs = -1,
121      groupAs = @GroupAs(name = "related-risks", inJson = JsonGroupAsBehavior.LIST)
122  )
123  private List<AssociatedRisk> _relatedRisks;
124
125  @BoundField(
126      formalName = "Remarks",
127      description = "Additional commentary about the containing object.",
128      useName = "remarks",
129      typeAdapter = MarkupMultilineAdapter.class
130  )
131  private MarkupMultiline _remarks;
132
133  public PoamItem() {
134    this(null);
135  }
136
137  public PoamItem(IMetaschemaData data) {
138    this.__metaschemaData = data;
139  }
140
141  @Override
142  public IMetaschemaData getMetaschemaData() {
143    return __metaschemaData;
144  }
145
146  public UUID getUuid() {
147    return _uuid;
148  }
149
150  public void setUuid(UUID value) {
151    _uuid = value;
152  }
153
154  public MarkupLine getTitle() {
155    return _title;
156  }
157
158  public void setTitle(MarkupLine value) {
159    _title = value;
160  }
161
162  public MarkupMultiline getDescription() {
163    return _description;
164  }
165
166  public void setDescription(MarkupMultiline value) {
167    _description = value;
168  }
169
170  public List<Property> getProps() {
171    return _props;
172  }
173
174  public void setProps(List<Property> value) {
175    _props = value;
176  }
177
178  /**
179   * Add a new {@link Property} item to the underlying collection.
180   * @param item the item to add
181   * @return {@code true}
182   */
183  public boolean addProp(Property item) {
184    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
185    if (_props == null) {
186      _props = new LinkedList<>();
187    }
188    return _props.add(value);
189  }
190
191  /**
192   * Remove the first matching {@link Property} item from the underlying collection.
193   * @param item the item to remove
194   * @return {@code true} if the item was removed or {@code false} otherwise
195   */
196  public boolean removeProp(Property item) {
197    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
198    return _props != null && _props.remove(value);
199  }
200
201  public List<Link> getLinks() {
202    return _links;
203  }
204
205  public void setLinks(List<Link> value) {
206    _links = value;
207  }
208
209  /**
210   * Add a new {@link Link} item to the underlying collection.
211   * @param item the item to add
212   * @return {@code true}
213   */
214  public boolean addLink(Link item) {
215    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
216    if (_links == null) {
217      _links = new LinkedList<>();
218    }
219    return _links.add(value);
220  }
221
222  /**
223   * Remove the first matching {@link Link} item from the underlying collection.
224   * @param item the item to remove
225   * @return {@code true} if the item was removed or {@code false} otherwise
226   */
227  public boolean removeLink(Link item) {
228    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
229    return _links != null && _links.remove(value);
230  }
231
232  public List<Origin> getOrigins() {
233    return _origins;
234  }
235
236  public void setOrigins(List<Origin> value) {
237    _origins = value;
238  }
239
240  /**
241   * Add a new {@link Origin} item to the underlying collection.
242   * @param item the item to add
243   * @return {@code true}
244   */
245  public boolean addOrigin(Origin item) {
246    Origin value = ObjectUtils.requireNonNull(item,"item cannot be null");
247    if (_origins == null) {
248      _origins = new LinkedList<>();
249    }
250    return _origins.add(value);
251  }
252
253  /**
254   * Remove the first matching {@link Origin} item from the underlying collection.
255   * @param item the item to remove
256   * @return {@code true} if the item was removed or {@code false} otherwise
257   */
258  public boolean removeOrigin(Origin item) {
259    Origin value = ObjectUtils.requireNonNull(item,"item cannot be null");
260    return _origins != null && _origins.remove(value);
261  }
262
263  public List<RelatedFinding> getRelatedFindings() {
264    return _relatedFindings;
265  }
266
267  public void setRelatedFindings(List<RelatedFinding> value) {
268    _relatedFindings = value;
269  }
270
271  /**
272   * Add a new {@link RelatedFinding} item to the underlying collection.
273   * @param item the item to add
274   * @return {@code true}
275   */
276  public boolean addRelatedFinding(RelatedFinding item) {
277    RelatedFinding value = ObjectUtils.requireNonNull(item,"item cannot be null");
278    if (_relatedFindings == null) {
279      _relatedFindings = new LinkedList<>();
280    }
281    return _relatedFindings.add(value);
282  }
283
284  /**
285   * Remove the first matching {@link RelatedFinding} item from the underlying collection.
286   * @param item the item to remove
287   * @return {@code true} if the item was removed or {@code false} otherwise
288   */
289  public boolean removeRelatedFinding(RelatedFinding item) {
290    RelatedFinding value = ObjectUtils.requireNonNull(item,"item cannot be null");
291    return _relatedFindings != null && _relatedFindings.remove(value);
292  }
293
294  public List<RelatedObservation> getRelatedObservations() {
295    return _relatedObservations;
296  }
297
298  public void setRelatedObservations(List<RelatedObservation> value) {
299    _relatedObservations = value;
300  }
301
302  /**
303   * Add a new {@link RelatedObservation} item to the underlying collection.
304   * @param item the item to add
305   * @return {@code true}
306   */
307  public boolean addRelatedObservation(RelatedObservation item) {
308    RelatedObservation value = ObjectUtils.requireNonNull(item,"item cannot be null");
309    if (_relatedObservations == null) {
310      _relatedObservations = new LinkedList<>();
311    }
312    return _relatedObservations.add(value);
313  }
314
315  /**
316   * Remove the first matching {@link RelatedObservation} item from the underlying collection.
317   * @param item the item to remove
318   * @return {@code true} if the item was removed or {@code false} otherwise
319   */
320  public boolean removeRelatedObservation(RelatedObservation item) {
321    RelatedObservation value = ObjectUtils.requireNonNull(item,"item cannot be null");
322    return _relatedObservations != null && _relatedObservations.remove(value);
323  }
324
325  public List<AssociatedRisk> getRelatedRisks() {
326    return _relatedRisks;
327  }
328
329  public void setRelatedRisks(List<AssociatedRisk> value) {
330    _relatedRisks = value;
331  }
332
333  /**
334   * Add a new {@link AssociatedRisk} item to the underlying collection.
335   * @param item the item to add
336   * @return {@code true}
337   */
338  public boolean addAssociatedRisk(AssociatedRisk item) {
339    AssociatedRisk value = ObjectUtils.requireNonNull(item,"item cannot be null");
340    if (_relatedRisks == null) {
341      _relatedRisks = new LinkedList<>();
342    }
343    return _relatedRisks.add(value);
344  }
345
346  /**
347   * Remove the first matching {@link AssociatedRisk} item from the underlying collection.
348   * @param item the item to remove
349   * @return {@code true} if the item was removed or {@code false} otherwise
350   */
351  public boolean removeAssociatedRisk(AssociatedRisk item) {
352    AssociatedRisk value = ObjectUtils.requireNonNull(item,"item cannot be null");
353    return _relatedRisks != null && _relatedRisks.remove(value);
354  }
355
356  public MarkupMultiline getRemarks() {
357    return _remarks;
358  }
359
360  public void setRemarks(MarkupMultiline value) {
361    _remarks = value;
362  }
363
364  @Override
365  public String toString() {
366    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
367  }
368
369  /**
370   * Identifies the source of the finding, such as a tool or person.
371   */
372  @MetaschemaAssembly(
373      formalName = "Origin",
374      description = "Identifies the source of the finding, such as a tool or person.",
375      name = "origin",
376      moduleClass = OscalPoamModule.class,
377      remarks = "Used to identify the individual and/or tool generated this poam-item."
378  )
379  public static class Origin implements IBoundObject {
380    private final IMetaschemaData __metaschemaData;
381
382    @BoundAssembly(
383        formalName = "Originating Actor",
384        description = "The actor that produces an observation, a finding, or a risk. One or more actor type can be used to specify a person that is using a tool.",
385        useName = "actor",
386        minOccurs = 1,
387        maxOccurs = -1,
388        groupAs = @GroupAs(name = "actors", inJson = JsonGroupAsBehavior.LIST)
389    )
390    private List<OriginActor> _actors;
391
392    public Origin() {
393      this(null);
394    }
395
396    public Origin(IMetaschemaData data) {
397      this.__metaschemaData = data;
398    }
399
400    @Override
401    public IMetaschemaData getMetaschemaData() {
402      return __metaschemaData;
403    }
404
405    public List<OriginActor> getActors() {
406      return _actors;
407    }
408
409    public void setActors(List<OriginActor> value) {
410      _actors = value;
411    }
412
413    /**
414     * Add a new {@link OriginActor} item to the underlying collection.
415     * @param item the item to add
416     * @return {@code true}
417     */
418    public boolean addActor(OriginActor item) {
419      OriginActor value = ObjectUtils.requireNonNull(item,"item cannot be null");
420      if (_actors == null) {
421        _actors = new LinkedList<>();
422      }
423      return _actors.add(value);
424    }
425
426    /**
427     * Remove the first matching {@link OriginActor} item from the underlying collection.
428     * @param item the item to remove
429     * @return {@code true} if the item was removed or {@code false} otherwise
430     */
431    public boolean removeActor(OriginActor item) {
432      OriginActor value = ObjectUtils.requireNonNull(item,"item cannot be null");
433      return _actors != null && _actors.remove(value);
434    }
435
436    @Override
437    public String toString() {
438      return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
439    }
440  }
441
442  /**
443   * Relates the poam-item to referenced finding(s).
444   */
445  @MetaschemaAssembly(
446      formalName = "Related Finding",
447      description = "Relates the poam-item to referenced finding(s).",
448      name = "related-finding",
449      moduleClass = OscalPoamModule.class
450  )
451  public static class RelatedFinding implements IBoundObject {
452    private final IMetaschemaData __metaschemaData;
453
454    /**
455     * "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a> identifier reference to a finding defined in the list of findings."
456     */
457    @BoundFlag(
458        formalName = "Finding Universally Unique Identifier Reference",
459        description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to a finding defined in the list of findings.",
460        name = "finding-uuid",
461        required = true,
462        typeAdapter = UuidAdapter.class
463    )
464    private UUID _findingUuid;
465
466    public RelatedFinding() {
467      this(null);
468    }
469
470    public RelatedFinding(IMetaschemaData data) {
471      this.__metaschemaData = data;
472    }
473
474    @Override
475    public IMetaschemaData getMetaschemaData() {
476      return __metaschemaData;
477    }
478
479    public UUID getFindingUuid() {
480      return _findingUuid;
481    }
482
483    public void setFindingUuid(UUID value) {
484      _findingUuid = value;
485    }
486
487    @Override
488    public String toString() {
489      return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
490    }
491  }
492
493  /**
494   * Relates the poam-item to a set of referenced observations that were used to determine the finding.
495   */
496  @MetaschemaAssembly(
497      formalName = "Related Observation",
498      description = "Relates the poam-item to a set of referenced observations that were used to determine the finding.",
499      name = "related-observation",
500      moduleClass = OscalPoamModule.class
501  )
502  public static class RelatedObservation implements IBoundObject {
503    private final IMetaschemaData __metaschemaData;
504
505    /**
506     * "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a> identifier reference to an observation defined in the list of observations."
507     */
508    @BoundFlag(
509        formalName = "Observation Universally Unique Identifier Reference",
510        description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to an observation defined in the list of observations.",
511        name = "observation-uuid",
512        required = true,
513        typeAdapter = UuidAdapter.class
514    )
515    private UUID _observationUuid;
516
517    public RelatedObservation() {
518      this(null);
519    }
520
521    public RelatedObservation(IMetaschemaData data) {
522      this.__metaschemaData = data;
523    }
524
525    @Override
526    public IMetaschemaData getMetaschemaData() {
527      return __metaschemaData;
528    }
529
530    public UUID getObservationUuid() {
531      return _observationUuid;
532    }
533
534    public void setObservationUuid(UUID value) {
535      _observationUuid = value;
536    }
537
538    @Override
539    public String toString() {
540      return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
541    }
542  }
543
544  /**
545   * Relates the finding to a set of referenced risks that were used to determine the finding.
546   */
547  @MetaschemaAssembly(
548      formalName = "Associated Risk",
549      description = "Relates the finding to a set of referenced risks that were used to determine the finding.",
550      name = "associated-risk",
551      moduleClass = OscalPoamModule.class
552  )
553  public static class AssociatedRisk implements IBoundObject {
554    private final IMetaschemaData __metaschemaData;
555
556    /**
557     * "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a> identifier reference to a risk defined in the list of risks."
558     */
559    @BoundFlag(
560        formalName = "Risk Universally Unique Identifier Reference",
561        description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to a risk defined in the list of risks.",
562        name = "risk-uuid",
563        required = true,
564        typeAdapter = UuidAdapter.class
565    )
566    private UUID _riskUuid;
567
568    public AssociatedRisk() {
569      this(null);
570    }
571
572    public AssociatedRisk(IMetaschemaData data) {
573      this.__metaschemaData = data;
574    }
575
576    @Override
577    public IMetaschemaData getMetaschemaData() {
578      return __metaschemaData;
579    }
580
581    public UUID getRiskUuid() {
582      return _riskUuid;
583    }
584
585    public void setRiskUuid(UUID value) {
586      _riskUuid = value;
587    }
588
589    @Override
590    public String toString() {
591      return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
592    }
593  }
594}