PlanOfActionAndMilestones.java

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

import gov.nist.secauto.metaschema.binding.model.annotations.BoundAssembly;
import gov.nist.secauto.metaschema.binding.model.annotations.BoundField;
import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
import java.lang.Override;
import java.lang.String;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

/**
 * A plan of action and milestones which identifies initial and residual risks, deviations, and disposition, such as those required by FedRAMP.
 */
@MetaschemaAssembly(
    formalName = "Plan of Action and Milestones (POA&M)",
    description = "A plan of action and milestones which identifies initial and residual risks, deviations, and disposition, such as those required by FedRAMP.",
    name = "plan-of-action-and-milestones",
    metaschema = OscalPoamMetaschema.class,
    rootName = "plan-of-action-and-milestones",
    remarks = "Either an OSCAL-based SSP must be imported, or a unique system-id must be specified. Both may be present."
)
public class PlanOfActionAndMilestones extends AbstractOscalInstance {
  @BoundFlag(
      formalName = "POA&M Universally Unique Identifier",
      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 instance 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.",
      useName = "uuid",
      required = true,
      typeAdapter = UuidAdapter.class
  )
  private UUID _uuid;

  @BoundAssembly(
      formalName = "Document Metadata",
      description = "Provides information about the containing document, and defines concepts that are shared across the document.",
      useName = "metadata",
      minOccurs = 1
  )
  private Metadata _metadata;

  @BoundAssembly(
      formalName = "Import System Security Plan",
      description = "Used by the assessment plan and POA\\&M to import information about the system.",
      useName = "import-ssp",
      remarks = "Used by the POA\\&M to import information about the system."
  )
  private ImportSsp _importSsp;

  @BoundField(
      formalName = "System Identification",
      description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-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 system identification property elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#scope). When referencing an externally defined `system identification`, the `system identification` must be used in the context of the external / imported OSCAL instance (e.g., uri-reference). This string 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 system across revisions of the document.",
      useName = "system-id"
  )
  private SystemId _systemId;

  @BoundAssembly(
      formalName = "Local Definitions",
      description = "Allows components, and inventory-items to be defined within the POA\\&M for circumstances where no OSCAL-based SSP exists, or is not delivered with the POA\\&M.",
      useName = "local-definitions"
  )
  private LocalDefinitions _localDefinitions;

  @BoundAssembly(
      formalName = "Observation",
      description = "Describes an individual observation.",
      useName = "observation",
      maxOccurs = -1
  )
  @GroupAs(
      name = "observations",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<Observation> _observations;

  @BoundAssembly(
      formalName = "Identified Risk",
      description = "An identified risk.",
      useName = "risk",
      maxOccurs = -1
  )
  @GroupAs(
      name = "risks",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<Risk> _risks;

  @BoundAssembly(
      formalName = "Finding",
      description = "Describes an individual finding.",
      useName = "finding",
      maxOccurs = -1
  )
  @GroupAs(
      name = "findings",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<Finding> _findings;

  @BoundAssembly(
      formalName = "POA&M Item",
      description = "Describes an individual POA\\&M item.",
      useName = "poam-item",
      minOccurs = 1,
      maxOccurs = -1
  )
  @GroupAs(
      name = "poam-items",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<PoamItem> _poamItems;

  @BoundAssembly(
      formalName = "Back matter",
      description = "A collection of resources that may be referenced from within the OSCAL document instance.",
      useName = "back-matter"
  )
  private BackMatter _backMatter;

  public PlanOfActionAndMilestones() {
  }

  public UUID getUuid() {
    return _uuid;
  }

  public void setUuid(UUID value) {
    _uuid = value;
  }

  public Metadata getMetadata() {
    return _metadata;
  }

  public void setMetadata(Metadata value) {
    _metadata = value;
  }

  public ImportSsp getImportSsp() {
    return _importSsp;
  }

  public void setImportSsp(ImportSsp value) {
    _importSsp = value;
  }

  public SystemId getSystemId() {
    return _systemId;
  }

  public void setSystemId(SystemId value) {
    _systemId = value;
  }

  public LocalDefinitions getLocalDefinitions() {
    return _localDefinitions;
  }

  public void setLocalDefinitions(LocalDefinitions value) {
    _localDefinitions = value;
  }

  public List<Observation> getObservations() {
    return _observations;
  }

  public void setObservations(List<Observation> value) {
    _observations = value;
  }

  /**
   * Add a new {@link Observation} item to the underlying collection.
   * @param item the item to add
   * @return {@code true}
   */
  public boolean addObservation(Observation item) {
    Observation value = ObjectUtils.requireNonNull(item,"item cannot be null");
    if (_observations == null) {
      _observations = new LinkedList<>();
    }
    return _observations.add(value);
  }

  /**
   * Remove the first matching {@link Observation} item from the underlying collection.
   * @param item the item to remove
   * @return {@code true} if the item was removed or {@code false} otherwise
   */
  public boolean removeObservation(Observation item) {
    Observation value = ObjectUtils.requireNonNull(item,"item cannot be null");
    return _observations == null ? false : _observations.remove(value);
  }

  public List<Risk> getRisks() {
    return _risks;
  }

  public void setRisks(List<Risk> value) {
    _risks = value;
  }

  /**
   * Add a new {@link Risk} item to the underlying collection.
   * @param item the item to add
   * @return {@code true}
   */
  public boolean addRisk(Risk item) {
    Risk value = ObjectUtils.requireNonNull(item,"item cannot be null");
    if (_risks == null) {
      _risks = new LinkedList<>();
    }
    return _risks.add(value);
  }

  /**
   * Remove the first matching {@link Risk} item from the underlying collection.
   * @param item the item to remove
   * @return {@code true} if the item was removed or {@code false} otherwise
   */
  public boolean removeRisk(Risk item) {
    Risk value = ObjectUtils.requireNonNull(item,"item cannot be null");
    return _risks == null ? false : _risks.remove(value);
  }

  public List<Finding> getFindings() {
    return _findings;
  }

  public void setFindings(List<Finding> value) {
    _findings = value;
  }

  /**
   * Add a new {@link Finding} item to the underlying collection.
   * @param item the item to add
   * @return {@code true}
   */
  public boolean addFinding(Finding item) {
    Finding value = ObjectUtils.requireNonNull(item,"item cannot be null");
    if (_findings == null) {
      _findings = new LinkedList<>();
    }
    return _findings.add(value);
  }

  /**
   * Remove the first matching {@link Finding} item from the underlying collection.
   * @param item the item to remove
   * @return {@code true} if the item was removed or {@code false} otherwise
   */
  public boolean removeFinding(Finding item) {
    Finding value = ObjectUtils.requireNonNull(item,"item cannot be null");
    return _findings == null ? false : _findings.remove(value);
  }

  public List<PoamItem> getPoamItems() {
    return _poamItems;
  }

  public void setPoamItems(List<PoamItem> value) {
    _poamItems = value;
  }

  /**
   * Add a new {@link PoamItem} item to the underlying collection.
   * @param item the item to add
   * @return {@code true}
   */
  public boolean addPoamItem(PoamItem item) {
    PoamItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
    if (_poamItems == null) {
      _poamItems = new LinkedList<>();
    }
    return _poamItems.add(value);
  }

  /**
   * Remove the first matching {@link PoamItem} item from the underlying collection.
   * @param item the item to remove
   * @return {@code true} if the item was removed or {@code false} otherwise
   */
  public boolean removePoamItem(PoamItem item) {
    PoamItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
    return _poamItems == null ? false : _poamItems.remove(value);
  }

  public BackMatter getBackMatter() {
    return _backMatter;
  }

  public void setBackMatter(BackMatter value) {
    _backMatter = value;
  }

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