PoamItem.java

  1. package gov.nist.secauto.oscal.lib.model;

  2. import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
  3. import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
  4. import gov.nist.secauto.metaschema.binding.model.annotations.BoundFieldValue;
  5. import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
  6. import gov.nist.secauto.metaschema.binding.model.annotations.Expect;
  7. import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
  8. import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
  9. import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
  10. import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
  11. import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
  12. import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
  13. import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLine;
  14. import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLineAdapter;
  15. import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
  16. import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
  17. import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
  18. import java.lang.Override;
  19. import java.lang.String;
  20. import java.util.LinkedList;
  21. import java.util.List;
  22. import java.util.UUID;
  23. import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
  24. import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

  25. /**
  26.  * Describes an individual POA&M item.
  27.  */
  28. @MetaschemaAssembly(
  29.     formalName = "POA&M Item",
  30.     description = "Describes an individual POA\\&M item.",
  31.     name = "poam-item",
  32.     metaschema = OscalPoamMetaschema.class
  33. )
  34. @ValueConstraints(
  35.     expect = @Expect(level = IConstraint.Level.WARNING, test = "@uuid", message = "It is a best practice to provide a UUID.")
  36. )
  37. public class PoamItem {
  38.   @BoundFlag(
  39.       formalName = "POA&M Item Universally Unique Identifier",
  40.       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.",
  41.       useName = "uuid",
  42.       typeAdapter = UuidAdapter.class
  43.   )
  44.   private UUID _uuid;

  45.   /**
  46.    * "The title or name for this POA&M item ."
  47.    */
  48.   @BoundField(
  49.       formalName = "POA&M Item Title",
  50.       description = "The title or name for this POA\\&M item .",
  51.       useName = "title",
  52.       minOccurs = 1
  53.   )
  54.   @BoundFieldValue(
  55.       typeAdapter = MarkupLineAdapter.class
  56.   )
  57.   private MarkupLine _title;

  58.   /**
  59.    * "A human-readable description of POA&M item."
  60.    */
  61.   @BoundField(
  62.       formalName = "POA&M Item Description",
  63.       description = "A human-readable description of POA\\&M item.",
  64.       useName = "description",
  65.       minOccurs = 1
  66.   )
  67.   @BoundFieldValue(
  68.       typeAdapter = MarkupMultilineAdapter.class
  69.   )
  70.   private MarkupMultiline _description;

  71.   @BoundAssembly(
  72.       formalName = "Property",
  73.       description = "An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair.",
  74.       useName = "prop",
  75.       maxOccurs = -1
  76.   )
  77.   @GroupAs(
  78.       name = "props",
  79.       inJson = JsonGroupAsBehavior.LIST
  80.   )
  81.   private List<Property> _props;

  82.   @BoundAssembly(
  83.       formalName = "Link",
  84.       description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
  85.       useName = "link",
  86.       maxOccurs = -1
  87.   )
  88.   @GroupAs(
  89.       name = "links",
  90.       inJson = JsonGroupAsBehavior.LIST
  91.   )
  92.   private List<Link> _links;

  93.   /**
  94.    * "Identifies the source of the finding, such as a tool or person."
  95.    */
  96.   @BoundAssembly(
  97.       formalName = "Origin",
  98.       description = "Identifies the source of the finding, such as a tool or person.",
  99.       useName = "origin",
  100.       maxOccurs = -1,
  101.       remarks = "Used to identify the individual and/or tool generated this poam-item."
  102.   )
  103.   @GroupAs(
  104.       name = "origins",
  105.       inJson = JsonGroupAsBehavior.LIST
  106.   )
  107.   private List<Origin> _origins;

  108.   /**
  109.    * "Relates the poam-item to referenced finding(s)."
  110.    */
  111.   @BoundAssembly(
  112.       formalName = "Related Finding",
  113.       description = "Relates the poam-item to referenced finding(s).",
  114.       useName = "related-finding",
  115.       maxOccurs = -1
  116.   )
  117.   @GroupAs(
  118.       name = "related-findings",
  119.       inJson = JsonGroupAsBehavior.LIST
  120.   )
  121.   private List<RelatedFinding> _relatedFindings;

  122.   /**
  123.    * "Relates the poam-item to a set of referenced observations that were used to determine the finding."
  124.    */
  125.   @BoundAssembly(
  126.       formalName = "Related Observation",
  127.       description = "Relates the poam-item to a set of referenced observations that were used to determine the finding.",
  128.       useName = "related-observation",
  129.       maxOccurs = -1
  130.   )
  131.   @GroupAs(
  132.       name = "related-observations",
  133.       inJson = JsonGroupAsBehavior.LIST
  134.   )
  135.   private List<RelatedObservation> _relatedObservations;

  136.   /**
  137.    * "Relates the finding to a set of referenced risks that were used to determine the finding."
  138.    */
  139.   @BoundAssembly(
  140.       formalName = "Associated Risk",
  141.       description = "Relates the finding to a set of referenced risks that were used to determine the finding.",
  142.       useName = "associated-risk",
  143.       maxOccurs = -1
  144.   )
  145.   @GroupAs(
  146.       name = "related-risks",
  147.       inJson = JsonGroupAsBehavior.LIST
  148.   )
  149.   private List<AssociatedRisk> _relatedRisks;

  150.   @BoundField(
  151.       formalName = "Remarks",
  152.       description = "Additional commentary about the containing object.",
  153.       useName = "remarks"
  154.   )
  155.   @BoundFieldValue(
  156.       typeAdapter = MarkupMultilineAdapter.class
  157.   )
  158.   private MarkupMultiline _remarks;

  159.   public PoamItem() {
  160.   }

  161.   public UUID getUuid() {
  162.     return _uuid;
  163.   }

  164.   public void setUuid(UUID value) {
  165.     _uuid = value;
  166.   }

  167.   public MarkupLine getTitle() {
  168.     return _title;
  169.   }

  170.   public void setTitle(MarkupLine value) {
  171.     _title = value;
  172.   }

  173.   public MarkupMultiline getDescription() {
  174.     return _description;
  175.   }

  176.   public void setDescription(MarkupMultiline value) {
  177.     _description = value;
  178.   }

  179.   public List<Property> getProps() {
  180.     return _props;
  181.   }

  182.   public void setProps(List<Property> value) {
  183.     _props = value;
  184.   }

  185.   /**
  186.    * Add a new {@link Property} item to the underlying collection.
  187.    * @param item the item to add
  188.    * @return {@code true}
  189.    */
  190.   public boolean addProp(Property item) {
  191.     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
  192.     if (_props == null) {
  193.       _props = new LinkedList<>();
  194.     }
  195.     return _props.add(value);
  196.   }

  197.   /**
  198.    * Remove the first matching {@link Property} item from the underlying collection.
  199.    * @param item the item to remove
  200.    * @return {@code true} if the item was removed or {@code false} otherwise
  201.    */
  202.   public boolean removeProp(Property item) {
  203.     Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
  204.     return _props == null ? false : _props.remove(value);
  205.   }

  206.   public List<Link> getLinks() {
  207.     return _links;
  208.   }

  209.   public void setLinks(List<Link> value) {
  210.     _links = value;
  211.   }

  212.   /**
  213.    * Add a new {@link Link} item to the underlying collection.
  214.    * @param item the item to add
  215.    * @return {@code true}
  216.    */
  217.   public boolean addLink(Link item) {
  218.     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
  219.     if (_links == null) {
  220.       _links = new LinkedList<>();
  221.     }
  222.     return _links.add(value);
  223.   }

  224.   /**
  225.    * Remove the first matching {@link Link} item from the underlying collection.
  226.    * @param item the item to remove
  227.    * @return {@code true} if the item was removed or {@code false} otherwise
  228.    */
  229.   public boolean removeLink(Link item) {
  230.     Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
  231.     return _links == null ? false : _links.remove(value);
  232.   }

  233.   public List<Origin> getOrigins() {
  234.     return _origins;
  235.   }

  236.   public void setOrigins(List<Origin> value) {
  237.     _origins = value;
  238.   }

  239.   /**
  240.    * Add a new {@link Origin} item to the underlying collection.
  241.    * @param item the item to add
  242.    * @return {@code true}
  243.    */
  244.   public boolean addOrigin(Origin item) {
  245.     Origin value = ObjectUtils.requireNonNull(item,"item cannot be null");
  246.     if (_origins == null) {
  247.       _origins = new LinkedList<>();
  248.     }
  249.     return _origins.add(value);
  250.   }

  251.   /**
  252.    * Remove the first matching {@link Origin} item from the underlying collection.
  253.    * @param item the item to remove
  254.    * @return {@code true} if the item was removed or {@code false} otherwise
  255.    */
  256.   public boolean removeOrigin(Origin item) {
  257.     Origin value = ObjectUtils.requireNonNull(item,"item cannot be null");
  258.     return _origins == null ? false : _origins.remove(value);
  259.   }

  260.   public List<RelatedFinding> getRelatedFindings() {
  261.     return _relatedFindings;
  262.   }

  263.   public void setRelatedFindings(List<RelatedFinding> value) {
  264.     _relatedFindings = value;
  265.   }

  266.   /**
  267.    * Add a new {@link RelatedFinding} item to the underlying collection.
  268.    * @param item the item to add
  269.    * @return {@code true}
  270.    */
  271.   public boolean addRelatedFinding(RelatedFinding item) {
  272.     RelatedFinding value = ObjectUtils.requireNonNull(item,"item cannot be null");
  273.     if (_relatedFindings == null) {
  274.       _relatedFindings = new LinkedList<>();
  275.     }
  276.     return _relatedFindings.add(value);
  277.   }

  278.   /**
  279.    * Remove the first matching {@link RelatedFinding} item from the underlying collection.
  280.    * @param item the item to remove
  281.    * @return {@code true} if the item was removed or {@code false} otherwise
  282.    */
  283.   public boolean removeRelatedFinding(RelatedFinding item) {
  284.     RelatedFinding value = ObjectUtils.requireNonNull(item,"item cannot be null");
  285.     return _relatedFindings == null ? false : _relatedFindings.remove(value);
  286.   }

  287.   public List<RelatedObservation> getRelatedObservations() {
  288.     return _relatedObservations;
  289.   }

  290.   public void setRelatedObservations(List<RelatedObservation> value) {
  291.     _relatedObservations = value;
  292.   }

  293.   /**
  294.    * Add a new {@link RelatedObservation} item to the underlying collection.
  295.    * @param item the item to add
  296.    * @return {@code true}
  297.    */
  298.   public boolean addRelatedObservation(RelatedObservation item) {
  299.     RelatedObservation value = ObjectUtils.requireNonNull(item,"item cannot be null");
  300.     if (_relatedObservations == null) {
  301.       _relatedObservations = new LinkedList<>();
  302.     }
  303.     return _relatedObservations.add(value);
  304.   }

  305.   /**
  306.    * Remove the first matching {@link RelatedObservation} item from the underlying collection.
  307.    * @param item the item to remove
  308.    * @return {@code true} if the item was removed or {@code false} otherwise
  309.    */
  310.   public boolean removeRelatedObservation(RelatedObservation item) {
  311.     RelatedObservation value = ObjectUtils.requireNonNull(item,"item cannot be null");
  312.     return _relatedObservations == null ? false : _relatedObservations.remove(value);
  313.   }

  314.   public List<AssociatedRisk> getRelatedRisks() {
  315.     return _relatedRisks;
  316.   }

  317.   public void setRelatedRisks(List<AssociatedRisk> value) {
  318.     _relatedRisks = value;
  319.   }

  320.   /**
  321.    * Add a new {@link AssociatedRisk} item to the underlying collection.
  322.    * @param item the item to add
  323.    * @return {@code true}
  324.    */
  325.   public boolean addAssociatedRisk(AssociatedRisk item) {
  326.     AssociatedRisk value = ObjectUtils.requireNonNull(item,"item cannot be null");
  327.     if (_relatedRisks == null) {
  328.       _relatedRisks = new LinkedList<>();
  329.     }
  330.     return _relatedRisks.add(value);
  331.   }

  332.   /**
  333.    * Remove the first matching {@link AssociatedRisk} item from the underlying collection.
  334.    * @param item the item to remove
  335.    * @return {@code true} if the item was removed or {@code false} otherwise
  336.    */
  337.   public boolean removeAssociatedRisk(AssociatedRisk item) {
  338.     AssociatedRisk value = ObjectUtils.requireNonNull(item,"item cannot be null");
  339.     return _relatedRisks == null ? false : _relatedRisks.remove(value);
  340.   }

  341.   public MarkupMultiline getRemarks() {
  342.     return _remarks;
  343.   }

  344.   public void setRemarks(MarkupMultiline value) {
  345.     _remarks = value;
  346.   }

  347.   @Override
  348.   public String toString() {
  349.     return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
  350.   }

  351.   /**
  352.    * Relates the poam-item to a set of referenced observations that were used to determine the finding.
  353.    */
  354.   @MetaschemaAssembly(
  355.       formalName = "Related Observation",
  356.       description = "Relates the poam-item to a set of referenced observations that were used to determine the finding.",
  357.       name = "related-observation",
  358.       metaschema = OscalPoamMetaschema.class
  359.   )
  360.   public static class RelatedObservation {
  361.     @BoundFlag(
  362.         formalName = "Observation Universally Unique Identifier Reference",
  363.         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.",
  364.         useName = "observation-uuid",
  365.         required = true,
  366.         typeAdapter = UuidAdapter.class
  367.     )
  368.     private UUID _observationUuid;

  369.     public RelatedObservation() {
  370.     }

  371.     public UUID getObservationUuid() {
  372.       return _observationUuid;
  373.     }

  374.     public void setObservationUuid(UUID value) {
  375.       _observationUuid = value;
  376.     }

  377.     @Override
  378.     public String toString() {
  379.       return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
  380.     }
  381.   }

  382.   /**
  383.    * Identifies the source of the finding, such as a tool or person.
  384.    */
  385.   @MetaschemaAssembly(
  386.       formalName = "Origin",
  387.       description = "Identifies the source of the finding, such as a tool or person.",
  388.       name = "origin",
  389.       metaschema = OscalPoamMetaschema.class,
  390.       remarks = "Used to identify the individual and/or tool generated this poam-item."
  391.   )
  392.   public static class Origin {
  393.     @BoundAssembly(
  394.         formalName = "Originating Actor",
  395.         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.",
  396.         useName = "actor",
  397.         minOccurs = 1,
  398.         maxOccurs = -1
  399.     )
  400.     @GroupAs(
  401.         name = "actors",
  402.         inJson = JsonGroupAsBehavior.LIST
  403.     )
  404.     private List<OriginActor> _actors;

  405.     public Origin() {
  406.     }

  407.     public List<OriginActor> getActors() {
  408.       return _actors;
  409.     }

  410.     public void setActors(List<OriginActor> value) {
  411.       _actors = value;
  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.      * Remove the first matching {@link OriginActor} item from the underlying collection.
  427.      * @param item the item to remove
  428.      * @return {@code true} if the item was removed or {@code false} otherwise
  429.      */
  430.     public boolean removeActor(OriginActor item) {
  431.       OriginActor value = ObjectUtils.requireNonNull(item,"item cannot be null");
  432.       return _actors == null ? false : _actors.remove(value);
  433.     }

  434.     @Override
  435.     public String toString() {
  436.       return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
  437.     }
  438.   }

  439.   /**
  440.    * Relates the finding to a set of referenced risks that were used to determine the finding.
  441.    */
  442.   @MetaschemaAssembly(
  443.       formalName = "Associated Risk",
  444.       description = "Relates the finding to a set of referenced risks that were used to determine the finding.",
  445.       name = "associated-risk",
  446.       metaschema = OscalPoamMetaschema.class
  447.   )
  448.   public static class AssociatedRisk {
  449.     @BoundFlag(
  450.         formalName = "Risk Universally Unique Identifier Reference",
  451.         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.",
  452.         useName = "risk-uuid",
  453.         required = true,
  454.         typeAdapter = UuidAdapter.class
  455.     )
  456.     private UUID _riskUuid;

  457.     public AssociatedRisk() {
  458.     }

  459.     public UUID getRiskUuid() {
  460.       return _riskUuid;
  461.     }

  462.     public void setRiskUuid(UUID value) {
  463.       _riskUuid = value;
  464.     }

  465.     @Override
  466.     public String toString() {
  467.       return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
  468.     }
  469.   }

  470.   /**
  471.    * Relates the poam-item to referenced finding(s).
  472.    */
  473.   @MetaschemaAssembly(
  474.       formalName = "Related Finding",
  475.       description = "Relates the poam-item to referenced finding(s).",
  476.       name = "related-finding",
  477.       metaschema = OscalPoamMetaschema.class
  478.   )
  479.   public static class RelatedFinding {
  480.     @BoundFlag(
  481.         formalName = "Finding Universally Unique Identifier Reference",
  482.         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.",
  483.         useName = "finding-uuid",
  484.         required = true,
  485.         typeAdapter = UuidAdapter.class
  486.     )
  487.     private UUID _findingUuid;

  488.     public RelatedFinding() {
  489.     }

  490.     public UUID getFindingUuid() {
  491.       return _findingUuid;
  492.     }

  493.     public void setFindingUuid(UUID value) {
  494.       _findingUuid = value;
  495.     }

  496.     @Override
  497.     public String toString() {
  498.       return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
  499.     }
  500.   }
  501. }