ReviewedControls.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.BoundFieldValue;
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.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.util.LinkedList;
import java.util.List;
import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

/**
 * Identifies the controls being assessed and their control objectives.
 */
@MetaschemaAssembly(
    formalName = "Reviewed Controls and Control Objectives",
    description = "Identifies the controls being assessed and their control objectives.",
    name = "reviewed-controls",
    metaschema = OscalAssessmentCommonMetaschema.class,
    remarks = "In the context of an assessment plan, this construct is used to identify the controls and control objectives that are to be assessed. In the context of an assessment result, this construct is used to identify the actual controls and objectives that were assessed, reflecting any changes from the plan.\n"
            + "\n"
            + "When resolving the selection of controls and control objectives, the following processing will occur:\n"
            + "\n"
            + "1. Controls will be resolved by creating a set of controls based on the control-selections by first handling the includes, and then removing any excluded controls.\n"
            + "\n"
            + "2. The set of control objectives will be resolved from the set of controls that was generated in the previous step. The set of control objectives is based on the control-objective-selection by first handling the includes, and then removing any excluded control objectives."
)
public class ReviewedControls {
  /**
   * "A human-readable description of control objectives."
   */
  @BoundField(
      formalName = "Control Objective Description",
      description = "A human-readable description of control objectives.",
      useName = "description"
  )
  @BoundFieldValue(
      typeAdapter = MarkupMultilineAdapter.class
  )
  private MarkupMultiline _description;

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

  /**
   * "Identifies the controls being assessed. In the assessment plan, these are the planned controls. In the assessment results, these are the actual controls, and reflects any changes from the plan."
   */
  @BoundAssembly(
      formalName = "Assessed Controls",
      description = "Identifies the controls being assessed. In the assessment plan, these are the planned controls. In the assessment results, these are the actual controls, and reflects any changes from the plan.",
      useName = "control-selection",
      minOccurs = 1,
      maxOccurs = -1,
      remarks = "The `include-all`, specifies all control identified in the **baseline** are included in the scope if this assessment, as specified by the `include-profile` statement within the linked SSP.\n"
              + "\n"
              + "Any control specified within `exclude-controls` must first be within a range of explicitly included controls, via `include-controls` or `include-all`."
  )
  @GroupAs(
      name = "control-selections",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<ControlSelection> _controlSelections;

  /**
   * "Identifies the control objectives of the assessment. In the assessment plan, these are the planned objectives. In the assessment results, these are the assessed objectives, and reflects any changes from the plan."
   */
  @BoundAssembly(
      formalName = "Referenced Control Objectives",
      description = "Identifies the control objectives of the assessment. In the assessment plan, these are the planned objectives. In the assessment results, these are the assessed objectives, and reflects any changes from the plan.",
      useName = "control-objective-selection",
      maxOccurs = -1,
      remarks = "The `include-all` field, specifies all control objectives for any in-scope control. In-scope controls are defined in the `control-selection`.\n"
              + "\n"
              + "Any control objective specified within `exclude-controls` must first be within a range of explicitly included control objectives, via `include-objectives` or `include-all`."
  )
  @GroupAs(
      name = "control-objective-selections",
      inJson = JsonGroupAsBehavior.LIST
  )
  private List<ControlObjectiveSelection> _controlObjectiveSelections;

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

  public ReviewedControls() {
  }

  public MarkupMultiline getDescription() {
    return _description;
  }

  public void setDescription(MarkupMultiline value) {
    _description = 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<ControlSelection> getControlSelections() {
    return _controlSelections;
  }

  public void setControlSelections(List<ControlSelection> value) {
    _controlSelections = value;
  }

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

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

  public List<ControlObjectiveSelection> getControlObjectiveSelections() {
    return _controlObjectiveSelections;
  }

  public void setControlObjectiveSelections(List<ControlObjectiveSelection> value) {
    _controlObjectiveSelections = value;
  }

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

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

  /**
   * Identifies the controls being assessed. In the assessment plan, these are the planned controls. In the assessment results, these are the actual controls, and reflects any changes from the plan.
   */
  @MetaschemaAssembly(
      formalName = "Assessed Controls",
      description = "Identifies the controls being assessed. In the assessment plan, these are the planned controls. In the assessment results, these are the actual controls, and reflects any changes from the plan.",
      name = "control-selection",
      metaschema = OscalAssessmentCommonMetaschema.class,
      remarks = "The `include-all`, specifies all control identified in the **baseline** are included in the scope if this assessment, as specified by the `include-profile` statement within the linked SSP.\n"
              + "\n"
              + "Any control specified within `exclude-controls` must first be within a range of explicitly included controls, via `include-controls` or `include-all`."
  )
  public static class ControlSelection {
    /**
     * "A human-readable description of in-scope controls specified for assessment."
     */
    @BoundField(
        formalName = "Assessed Controls Description",
        description = "A human-readable description of in-scope controls specified for assessment.",
        useName = "description"
    )
    @BoundFieldValue(
        typeAdapter = MarkupMultilineAdapter.class
    )
    private MarkupMultiline _description;

    @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 = "Include All",
        description = "Include all controls from the imported catalog or profile resources.",
        useName = "include-all",
        minOccurs = 1
    )
    private IncludeAll _includeAll;

    @BoundAssembly(
        formalName = "Select Control",
        description = "Used to select a control for inclusion/exclusion based on one or more control identifiers. A set of statement identifiers can be used to target the inclusion/exclusion to only specific control statements providing more granularity over the specific statements that are within the asessment scope.",
        useName = "include-control",
        minOccurs = 1,
        maxOccurs = -1,
        remarks = "Used to select a control for inclusion by the control's identifier. Specific control statements can be selected by their statement identifier."
    )
    @GroupAs(
        name = "include-controls",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<SelectControlById> _includeControls;

    @BoundAssembly(
        formalName = "Select Control",
        description = "Used to select a control for inclusion/exclusion based on one or more control identifiers. A set of statement identifiers can be used to target the inclusion/exclusion to only specific control statements providing more granularity over the specific statements that are within the asessment scope.",
        useName = "exclude-control",
        maxOccurs = -1,
        remarks = "Used to select a control for exclusion by the control's identifier. Specific control statements can be excluded by their statement identifier."
    )
    @GroupAs(
        name = "exclude-controls",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<SelectControlById> _excludeControls;

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

    public ControlSelection() {
    }

    public MarkupMultiline getDescription() {
      return _description;
    }

    public void setDescription(MarkupMultiline value) {
      _description = 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 IncludeAll getIncludeAll() {
      return _includeAll;
    }

    public void setIncludeAll(IncludeAll value) {
      _includeAll = value;
    }

    public List<SelectControlById> getIncludeControls() {
      return _includeControls;
    }

    public void setIncludeControls(List<SelectControlById> value) {
      _includeControls = value;
    }

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

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

    public List<SelectControlById> getExcludeControls() {
      return _excludeControls;
    }

    public void setExcludeControls(List<SelectControlById> value) {
      _excludeControls = value;
    }

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

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

  /**
   * Identifies the control objectives of the assessment. In the assessment plan, these are the planned objectives. In the assessment results, these are the assessed objectives, and reflects any changes from the plan.
   */
  @MetaschemaAssembly(
      formalName = "Referenced Control Objectives",
      description = "Identifies the control objectives of the assessment. In the assessment plan, these are the planned objectives. In the assessment results, these are the assessed objectives, and reflects any changes from the plan.",
      name = "control-objective-selection",
      metaschema = OscalAssessmentCommonMetaschema.class,
      remarks = "The `include-all` field, specifies all control objectives for any in-scope control. In-scope controls are defined in the `control-selection`.\n"
              + "\n"
              + "Any control objective specified within `exclude-controls` must first be within a range of explicitly included control objectives, via `include-objectives` or `include-all`."
  )
  public static class ControlObjectiveSelection {
    /**
     * "A human-readable description of this collection of control objectives."
     */
    @BoundField(
        formalName = "Control Objectives Description",
        description = "A human-readable description of this collection of control objectives.",
        useName = "description"
    )
    @BoundFieldValue(
        typeAdapter = MarkupMultilineAdapter.class
    )
    private MarkupMultiline _description;

    @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 = "Include All",
        description = "Include all controls from the imported catalog or profile resources.",
        useName = "include-all",
        minOccurs = 1
    )
    private IncludeAll _includeAll;

    @BoundAssembly(
        formalName = "Select Objective",
        description = "Used to select a control objective for inclusion/exclusion based on the control objective's identifier.",
        useName = "include-objective",
        minOccurs = 1,
        maxOccurs = -1,
        remarks = "Used to select a control objective for inclusion by the control objective's identifier."
    )
    @GroupAs(
        name = "include-objectives",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<SelectObjectiveById> _includeObjectives;

    @BoundAssembly(
        formalName = "Select Objective",
        description = "Used to select a control objective for inclusion/exclusion based on the control objective's identifier.",
        useName = "exclude-objective",
        maxOccurs = -1,
        remarks = "Used to select a control objective for exclusion by the control objective's identifier."
    )
    @GroupAs(
        name = "exclude-objectives",
        inJson = JsonGroupAsBehavior.LIST
    )
    private List<SelectObjectiveById> _excludeObjectives;

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

    public ControlObjectiveSelection() {
    }

    public MarkupMultiline getDescription() {
      return _description;
    }

    public void setDescription(MarkupMultiline value) {
      _description = 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 IncludeAll getIncludeAll() {
      return _includeAll;
    }

    public void setIncludeAll(IncludeAll value) {
      _includeAll = value;
    }

    public List<SelectObjectiveById> getIncludeObjectives() {
      return _includeObjectives;
    }

    public void setIncludeObjectives(List<SelectObjectiveById> value) {
      _includeObjectives = value;
    }

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

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

    public List<SelectObjectiveById> getExcludeObjectives() {
      return _excludeObjectives;
    }

    public void setExcludeObjectives(List<SelectObjectiveById> value) {
      _excludeObjectives = value;
    }

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

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