Result.java

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

import gov.nist.secauto.metaschema.binding.model.annotations.AssemblyConstraints;
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.BoundFieldValue;
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.IsUnique;
import gov.nist.secauto.metaschema.binding.model.annotations.KeyField;
import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
import gov.nist.secauto.metaschema.model.common.datatype.adapter.DateTimeWithTZAdapter;
import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLine;
import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLineAdapter;
import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultiline;
import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupMultilineAdapter;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
import java.lang.Override;
import java.lang.String;
import java.time.ZonedDateTime;
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;

/**
 * Used by the assessment results and POA&M. In the assessment results, this identifies all of the assessment observations and findings, initial and residual risks, deviations, and disposition. In the POA&M, this identifies initial and residual risks, deviations, and disposition.
 */
@MetaschemaAssembly(
    formalName = "Assessment Result",
    description = "Used by the assessment results and POA\\&M. In the assessment results, this identifies all of the assessment observations and findings, initial and residual risks, deviations, and disposition. In the POA\\&M, this identifies initial and residual risks, deviations, and disposition.",
    name = "result",
    metaschema = OscalArMetaschema.class
)
public class Result {
  @BoundFlag(
      formalName = "Results 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 [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference this set of results in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#ar-identifiers). The locally defined *UUID* of the `assessment result` 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.",
      useName = "uuid",
      required = true,
      typeAdapter = UuidAdapter.class
  )
  private UUID _uuid;

  /**
   * "The title for this set of results."
   */
  @BoundField(
      formalName = "Results Title",
      description = "The title for this set of results.",
      useName = "title",
      minOccurs = 1
  )
  @BoundFieldValue(
      typeAdapter = MarkupLineAdapter.class
  )
  private MarkupLine _title;

  /**
   * "A human-readable description of this set of test results."
   */
  @BoundField(
      formalName = "Results Description",
      description = "A human-readable description of this set of test results.",
      useName = "description",
      minOccurs = 1
  )
  @BoundFieldValue(
      typeAdapter = MarkupMultilineAdapter.class
  )
  private MarkupMultiline _description;

  /**
   * "Date/time stamp identifying the start of the evidence collection reflected in these results."
   */
  @BoundField(
      formalName = "start field",
      description = "Date/time stamp identifying the start of the evidence collection reflected in these results.",
      useName = "start",
      minOccurs = 1
  )
  @BoundFieldValue(
      typeAdapter = DateTimeWithTZAdapter.class
  )
  private ZonedDateTime _start;

  /**
   * "Date/time stamp identifying the end of the evidence collection reflected in these results. In a continuous motoring scenario, this may contain the same value as start if appropriate."
   */
  @BoundField(
      formalName = "end field",
      description = "Date/time stamp identifying the end of the evidence collection reflected in these results. In a continuous motoring scenario, this may contain the same value as start if appropriate.",
      useName = "end"
  )
  @BoundFieldValue(
      typeAdapter = DateTimeWithTZAdapter.class
  )
  private ZonedDateTime _end;

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

  @BoundAssembly(
      formalName = "Link",
      description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
      useName = "link",
      maxOccurs = -1
  )
  @GroupAs(
      name = "links",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<Link> _links;

  /**
   * "Used to define data objects that are used in the assessment plan, that do not appear in the referenced SSP."
   */
  @BoundAssembly(
      formalName = "Local Definitions",
      description = "Used to define data objects that are used in the assessment plan, that do not appear in the referenced SSP.",
      useName = "local-definitions"
  )
  private LocalDefinitions _localDefinitions;

  @BoundAssembly(
      formalName = "Reviewed Controls and Control Objectives",
      description = "Identifies the controls being assessed and their control objectives.",
      useName = "reviewed-controls",
      minOccurs = 1,
      remarks = "The Assessment Results `control-selection` ignores any control selection in the Assessment Plan and re-selects controls from the baseline identified by the SSP.\n"
              + "\n"
              + "The Assessment Results `control-objective-selection` ignores any control objective selection in the Assessment Plan and re-selects control objectives from the baseline identified by the SSP.\n"
              + "\n"
              + "Any additional control objectives defined in the Assessment Plan `local-definitions` do not need to be re-defined in the Assessment Results `local-definitions`; however, if they were explicitly referenced with an Assessment Plan `control-objective-selection`, they need to be selected again in the Assessment Results `control-objective-selection`."
  )
  private ReviewedControls _reviewedControls;

  /**
   * "A set of textual statements, typically written by the assessor."
   */
  @BoundAssembly(
      formalName = "Attestation Statements",
      description = "A set of textual statements, typically written by the assessor.",
      useName = "attestation",
      maxOccurs = -1
  )
  @GroupAs(
      name = "attestations",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<Attestation> _attestations;

  /**
   * "A log of all assessment-related actions taken."
   */
  @BoundAssembly(
      formalName = "Assessment Log",
      description = "A log of all assessment-related actions taken.",
      useName = "assessment-log"
  )
  private AssessmentLog _assessmentLog;

  @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;

  @BoundField(
      formalName = "Remarks",
      description = "Additional commentary about the containing object.",
      useName = "remarks"
  )
  @BoundFieldValue(
      typeAdapter = MarkupMultilineAdapter.class
  )
  private MarkupMultiline _remarks;

  public Result() {
  }

  public UUID getUuid() {
    return _uuid;
  }

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

  public MarkupLine getTitle() {
    return _title;
  }

  public void setTitle(MarkupLine value) {
    _title = value;
  }

  public MarkupMultiline getDescription() {
    return _description;
  }

  public void setDescription(MarkupMultiline value) {
    _description = value;
  }

  public ZonedDateTime getStart() {
    return _start;
  }

  public void setStart(ZonedDateTime value) {
    _start = value;
  }

  public ZonedDateTime getEnd() {
    return _end;
  }

  public void setEnd(ZonedDateTime value) {
    _end = value;
  }

  public List<Property> getProps() {
    return _props;
  }

  public void setProps(List<Property> value) {
    _props = value;
  }

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

  /**
   * Remove the first matching {@link Property} 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 removeProp(Property item) {
    Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
    return _props == null ? false : _props.remove(value);
  }

  public List<Link> getLinks() {
    return _links;
  }

  public void setLinks(List<Link> value) {
    _links = value;
  }

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

  /**
   * Remove the first matching {@link Link} 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 removeLink(Link item) {
    Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
    return _links == null ? false : _links.remove(value);
  }

  public LocalDefinitions getLocalDefinitions() {
    return _localDefinitions;
  }

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

  public ReviewedControls getReviewedControls() {
    return _reviewedControls;
  }

  public void setReviewedControls(ReviewedControls value) {
    _reviewedControls = value;
  }

  public List<Attestation> getAttestations() {
    return _attestations;
  }

  public void setAttestations(List<Attestation> value) {
    _attestations = value;
  }

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

  /**
   * Remove the first matching {@link Attestation} 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 removeAttestation(Attestation item) {
    Attestation value = ObjectUtils.requireNonNull(item,"item cannot be null");
    return _attestations == null ? false : _attestations.remove(value);
  }

  public AssessmentLog getAssessmentLog() {
    return _assessmentLog;
  }

  public void setAssessmentLog(AssessmentLog value) {
    _assessmentLog = 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 MarkupMultiline getRemarks() {
    return _remarks;
  }

  public void setRemarks(MarkupMultiline value) {
    _remarks = value;
  }

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

  /**
   * A log of all assessment-related actions taken.
   */
  @MetaschemaAssembly(
      formalName = "Assessment Log",
      description = "A log of all assessment-related actions taken.",
      name = "assessment-log",
      metaschema = OscalArMetaschema.class
  )
  public static class AssessmentLog {
    /**
     * "Identifies the result of an action and/or task that occurred as part of executing an assessment plan or an assessment event that occurred in producing the assessment results."
     */
    @BoundAssembly(
        formalName = "Assessment Log Entry",
        description = "Identifies the result of an action and/or task that occurred as part of executing an assessment plan or an assessment event that occurred in producing the assessment results.",
        useName = "entry",
        minOccurs = 1,
        maxOccurs = -1
    )
    @GroupAs(
        name = "entries",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<Entry> _entries;

    public AssessmentLog() {
    }

    public List<Entry> getEntries() {
      return _entries;
    }

    public void setEntries(List<Entry> value) {
      _entries = value;
    }

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

    /**
     * Remove the first matching {@link Entry} 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 removeEntry(Entry item) {
      Entry value = ObjectUtils.requireNonNull(item,"item cannot be null");
      return _entries == null ? false : _entries.remove(value);
    }

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

    /**
     * Identifies the result of an action and/or task that occurred as part of executing an assessment plan or an assessment event that occurred in producing the assessment results.
     */
    @MetaschemaAssembly(
        formalName = "Assessment Log Entry",
        description = "Identifies the result of an action and/or task that occurred as part of executing an assessment plan or an assessment event that occurred in producing the assessment results.",
        name = "entry",
        metaschema = OscalArMetaschema.class
    )
    public static class Entry {
      @BoundFlag(
          formalName = "Assessment Log Entry 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 [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference an assessment event in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#ar-identifiers). The locally defined *UUID* of the `assessment log entry` 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.",
          useName = "uuid",
          required = true,
          typeAdapter = UuidAdapter.class
      )
      private UUID _uuid;

      /**
       * "The title for this event."
       */
      @BoundField(
          formalName = "Action Title",
          description = "The title for this event.",
          useName = "title"
      )
      @BoundFieldValue(
          typeAdapter = MarkupLineAdapter.class
      )
      private MarkupLine _title;

      /**
       * "A human-readable description of this event."
       */
      @BoundField(
          formalName = "Action Description",
          description = "A human-readable description of this event.",
          useName = "description"
      )
      @BoundFieldValue(
          typeAdapter = MarkupMultilineAdapter.class
      )
      private MarkupMultiline _description;

      /**
       * "Identifies the start date and time of an event."
       */
      @BoundField(
          formalName = "Start",
          description = "Identifies the start date and time of an event.",
          useName = "start",
          minOccurs = 1
      )
      @BoundFieldValue(
          typeAdapter = DateTimeWithTZAdapter.class
      )
      private ZonedDateTime _start;

      /**
       * "Identifies the end date and time of an event. If the event is a point in time, the start and end will be the same date and time."
       */
      @BoundField(
          formalName = "End",
          description = "Identifies the end date and time of an event. If the event is a point in time, the start and end will be the same date and time.",
          useName = "end"
      )
      @BoundFieldValue(
          typeAdapter = DateTimeWithTZAdapter.class
      )
      private ZonedDateTime _end;

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

      @BoundAssembly(
          formalName = "Link",
          description = "A reference to a local or remote resource, that has a specific relation to the containing object.",
          useName = "link",
          maxOccurs = -1
      )
      @GroupAs(
          name = "links",
          inJson = JsonGroupAsBehavior.LIST
      )
      private List<Link> _links;

      @BoundAssembly(
          formalName = "Logged By",
          description = "Used to indicate who created a log entry in what role.",
          useName = "logged-by",
          maxOccurs = -1
      )
      @GroupAs(
          name = "logged-by",
          inJson = JsonGroupAsBehavior.LIST
      )
      private List<LoggedBy> _loggedBy;

      @BoundAssembly(
          formalName = "Task Reference",
          description = "Identifies an individual task for which the containing object is a consequence of.",
          useName = "related-task",
          maxOccurs = -1
      )
      @GroupAs(
          name = "related-tasks",
          inJson = JsonGroupAsBehavior.LIST
      )
      private List<RelatedTask> _relatedTasks;

      @BoundField(
          formalName = "Remarks",
          description = "Additional commentary about the containing object.",
          useName = "remarks"
      )
      @BoundFieldValue(
          typeAdapter = MarkupMultilineAdapter.class
      )
      private MarkupMultiline _remarks;

      public Entry() {
      }

      public UUID getUuid() {
        return _uuid;
      }

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

      public MarkupLine getTitle() {
        return _title;
      }

      public void setTitle(MarkupLine value) {
        _title = value;
      }

      public MarkupMultiline getDescription() {
        return _description;
      }

      public void setDescription(MarkupMultiline value) {
        _description = value;
      }

      public ZonedDateTime getStart() {
        return _start;
      }

      public void setStart(ZonedDateTime value) {
        _start = value;
      }

      public ZonedDateTime getEnd() {
        return _end;
      }

      public void setEnd(ZonedDateTime value) {
        _end = value;
      }

      public List<Property> getProps() {
        return _props;
      }

      public void setProps(List<Property> value) {
        _props = value;
      }

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

      /**
       * Remove the first matching {@link Property} 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 removeProp(Property item) {
        Property value = ObjectUtils.requireNonNull(item,"item cannot be null");
        return _props == null ? false : _props.remove(value);
      }

      public List<Link> getLinks() {
        return _links;
      }

      public void setLinks(List<Link> value) {
        _links = value;
      }

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

      /**
       * Remove the first matching {@link Link} 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 removeLink(Link item) {
        Link value = ObjectUtils.requireNonNull(item,"item cannot be null");
        return _links == null ? false : _links.remove(value);
      }

      public List<LoggedBy> getLoggedBy() {
        return _loggedBy;
      }

      public void setLoggedBy(List<LoggedBy> value) {
        _loggedBy = value;
      }

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

      /**
       * Remove the first matching {@link LoggedBy} 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 removeLoggedBy(LoggedBy item) {
        LoggedBy value = ObjectUtils.requireNonNull(item,"item cannot be null");
        return _loggedBy == null ? false : _loggedBy.remove(value);
      }

      public List<RelatedTask> getRelatedTasks() {
        return _relatedTasks;
      }

      public void setRelatedTasks(List<RelatedTask> value) {
        _relatedTasks = value;
      }

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

      /**
       * Remove the first matching {@link RelatedTask} 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 removeRelatedTask(RelatedTask item) {
        RelatedTask value = ObjectUtils.requireNonNull(item,"item cannot be null");
        return _relatedTasks == null ? false : _relatedTasks.remove(value);
      }

      public MarkupMultiline getRemarks() {
        return _remarks;
      }

      public void setRemarks(MarkupMultiline value) {
        _remarks = value;
      }

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

  /**
   * Used to define data objects that are used in the assessment plan, that do not appear in the referenced SSP.
   */
  @MetaschemaAssembly(
      formalName = "Local Definitions",
      description = "Used to define data objects that are used in the assessment plan, that do not appear in the referenced SSP.",
      name = "local-definitions",
      metaschema = OscalArMetaschema.class
  )
  @AssemblyConstraints(
      isUnique = {
          @IsUnique(id = "unique-ar-local-definitions-component", level = IConstraint.Level.ERROR, target = "component", keyFields = @KeyField(target = "@uuid"), remarks = "Since multiple `component` entries can be provided, each component must have a unique `uuid`."),
          @IsUnique(id = "unique-ar-local-definitions-user", level = IConstraint.Level.ERROR, target = "user", keyFields = @KeyField(target = "@uuid"), remarks = "A given `uuid` must be assigned only once to a user.")
      }
  )
  public static class LocalDefinitions {
    @BoundAssembly(
        formalName = "Component",
        description = "A defined component that can be part of an implemented system.",
        useName = "component",
        maxOccurs = -1,
        remarks = "Used to add any components, not defined via the System Security Plan (AR-\\>AP-\\>SSP)"
    )
    @GroupAs(
        name = "components",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<SystemComponent> _components;

    @BoundAssembly(
        formalName = "Inventory Item",
        description = "A single managed inventory item within the system.",
        useName = "inventory-item",
        maxOccurs = -1,
        remarks = "Used to add any inventory-items, not defined via the System Security Plan (AR-\\>AP-\\>SSP)"
    )
    @GroupAs(
        name = "inventory-items",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<InventoryItem> _inventoryItems;

    @BoundAssembly(
        formalName = "System User",
        description = "A type of user that interacts with the system based on an associated role.",
        useName = "user",
        maxOccurs = -1,
        remarks = "Used to add any users, not defined via the System Security Plan (AR-\\>AP-\\>SSP)"
    )
    @GroupAs(
        name = "users",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<SystemUser> _users;

    @BoundAssembly(
        formalName = "Assessment Assets",
        description = "Identifies the assets used to perform this assessment, such as the assessment team, scanning tools, and assumptions.",
        useName = "assessment-assets",
        remarks = "This needs to be defined in the results if an assessment platform used is different from the one described in the assessment plan. Else the platform(s) defined in the plan may be referenced within the results."
    )
    private AssessmentAssets _assessmentAssets;

    @BoundAssembly(
        formalName = "Task",
        description = "Represents a scheduled event or milestone, which may be associated with a series of assessment actions.",
        useName = "assessment-task",
        maxOccurs = -1
    )
    @GroupAs(
        name = "tasks",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<Task> _tasks;

    public LocalDefinitions() {
    }

    public List<SystemComponent> getComponents() {
      return _components;
    }

    public void setComponents(List<SystemComponent> value) {
      _components = value;
    }

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

    /**
     * Remove the first matching {@link SystemComponent} 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 removeComponent(SystemComponent item) {
      SystemComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
      return _components == null ? false : _components.remove(value);
    }

    public List<InventoryItem> getInventoryItems() {
      return _inventoryItems;
    }

    public void setInventoryItems(List<InventoryItem> value) {
      _inventoryItems = value;
    }

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

    /**
     * Remove the first matching {@link InventoryItem} 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 removeInventoryItem(InventoryItem item) {
      InventoryItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
      return _inventoryItems == null ? false : _inventoryItems.remove(value);
    }

    public List<SystemUser> getUsers() {
      return _users;
    }

    public void setUsers(List<SystemUser> value) {
      _users = value;
    }

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

    /**
     * Remove the first matching {@link SystemUser} 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 removeUser(SystemUser item) {
      SystemUser value = ObjectUtils.requireNonNull(item,"item cannot be null");
      return _users == null ? false : _users.remove(value);
    }

    public AssessmentAssets getAssessmentAssets() {
      return _assessmentAssets;
    }

    public void setAssessmentAssets(AssessmentAssets value) {
      _assessmentAssets = value;
    }

    public List<Task> getTasks() {
      return _tasks;
    }

    public void setTasks(List<Task> value) {
      _tasks = value;
    }

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

    /**
     * Remove the first matching {@link Task} 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 removeAssessmentTask(Task item) {
      Task value = ObjectUtils.requireNonNull(item,"item cannot be null");
      return _tasks == null ? false : _tasks.remove(value);
    }

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

  /**
   * A set of textual statements, typically written by the assessor.
   */
  @MetaschemaAssembly(
      formalName = "Attestation Statements",
      description = "A set of textual statements, typically written by the assessor.",
      name = "attestation",
      metaschema = OscalArMetaschema.class
  )
  @AssemblyConstraints(
      isUnique = @IsUnique(id = "unique-ar-attestation-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.")
  )
  public static class Attestation {
    @BoundAssembly(
        formalName = "Responsible Party",
        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.",
        useName = "responsible-party",
        maxOccurs = -1
    )
    @GroupAs(
        name = "responsible-parties",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<ResponsibleParty> _responsibleParties;

    @BoundAssembly(
        formalName = "Assessment Part",
        description = "A partition of an assessment plan or results or a child of another part.",
        useName = "part",
        minOccurs = 1,
        maxOccurs = -1
    )
    @GroupAs(
        name = "parts",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<AssessmentPart> _parts;

    public Attestation() {
    }

    public List<ResponsibleParty> getResponsibleParties() {
      return _responsibleParties;
    }

    public void setResponsibleParties(List<ResponsibleParty> value) {
      _responsibleParties = value;
    }

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

    /**
     * Remove the first matching {@link ResponsibleParty} 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 removeResponsibleParty(ResponsibleParty item) {
      ResponsibleParty value = ObjectUtils.requireNonNull(item,"item cannot be null");
      return _responsibleParties == null ? false : _responsibleParties.remove(value);
    }

    public List<AssessmentPart> getParts() {
      return _parts;
    }

    public void setParts(List<AssessmentPart> value) {
      _parts = value;
    }

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

    /**
     * Remove the first matching {@link AssessmentPart} 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 removePart(AssessmentPart item) {
      AssessmentPart value = ObjectUtils.requireNonNull(item,"item cannot be null");
      return _parts == null ? false : _parts.remove(value);
    }

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