ControlImplementation.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.GroupAs;
- import gov.nist.secauto.metaschema.binding.model.annotations.Index;
- 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.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;
- /**
- * Describes how the system satisfies a set of controls.
- */
- @MetaschemaAssembly(
- formalName = "Control Implementation",
- description = "Describes how the system satisfies a set of controls.",
- name = "control-implementation",
- metaschema = OscalSspMetaschema.class,
- remarks = "Use of `set-parameter` in this context, sets the parameter for all controls referenced by any `implemented-requirement` contained in this context. Any `set-parameter` defined in a child context will override this value. If not overridden by a child, this value applies in the child context."
- )
- @AssemblyConstraints(
- index = @Index(level = IConstraint.Level.ERROR, target = "implemented-requirement//by-component/export/provided", name = "by-component-export-provided-uuid", keyFields = @KeyField(target = "@uuid")),
- isUnique = @IsUnique(id = "unique-ssp-control-implementation-set-parameter", level = IConstraint.Level.ERROR, target = "set-parameter", keyFields = @KeyField(target = "@param-id"), remarks = "Since multiple `set-parameter` entries can be provided, each parameter must be set only once.")
- )
- public class ControlImplementation {
- /**
- * "A statement describing important things to know about how this set of control satisfaction documentation is approached."
- */
- @BoundField(
- formalName = "Control Implementation Description",
- description = "A statement describing important things to know about how this set of control satisfaction documentation is approached.",
- useName = "description",
- minOccurs = 1
- )
- @BoundFieldValue(
- typeAdapter = MarkupMultilineAdapter.class
- )
- private MarkupMultiline _description;
- @BoundAssembly(
- formalName = "Set Parameter Value",
- description = "Identifies the parameter that will be set by the enclosed value.",
- useName = "set-parameter",
- maxOccurs = -1
- )
- @GroupAs(
- name = "set-parameters",
- inJson = JsonGroupAsBehavior.LIST
- )
- private List<SetParameter> _setParameters;
- @BoundAssembly(
- formalName = "Control-based Requirement",
- description = "Describes how the system satisfies the requirements of an individual control.",
- useName = "implemented-requirement",
- minOccurs = 1,
- maxOccurs = -1
- )
- @GroupAs(
- name = "implemented-requirements",
- inJson = JsonGroupAsBehavior.LIST
- )
- private List<ImplementedRequirement> _implementedRequirements;
- public ControlImplementation() {
- }
- public MarkupMultiline getDescription() {
- return _description;
- }
- public void setDescription(MarkupMultiline value) {
- _description = value;
- }
- public List<SetParameter> getSetParameters() {
- return _setParameters;
- }
- public void setSetParameters(List<SetParameter> value) {
- _setParameters = value;
- }
- /**
- * Add a new {@link SetParameter} item to the underlying collection.
- * @param item the item to add
- * @return {@code true}
- */
- public boolean addSetParameter(SetParameter item) {
- SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
- if (_setParameters == null) {
- _setParameters = new LinkedList<>();
- }
- return _setParameters.add(value);
- }
- /**
- * Remove the first matching {@link SetParameter} 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 removeSetParameter(SetParameter item) {
- SetParameter value = ObjectUtils.requireNonNull(item,"item cannot be null");
- return _setParameters == null ? false : _setParameters.remove(value);
- }
- public List<ImplementedRequirement> getImplementedRequirements() {
- return _implementedRequirements;
- }
- public void setImplementedRequirements(List<ImplementedRequirement> value) {
- _implementedRequirements = value;
- }
- /**
- * Add a new {@link ImplementedRequirement} item to the underlying collection.
- * @param item the item to add
- * @return {@code true}
- */
- public boolean addImplementedRequirement(ImplementedRequirement item) {
- ImplementedRequirement value = ObjectUtils.requireNonNull(item,"item cannot be null");
- if (_implementedRequirements == null) {
- _implementedRequirements = new LinkedList<>();
- }
- return _implementedRequirements.add(value);
- }
- /**
- * Remove the first matching {@link ImplementedRequirement} 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 removeImplementedRequirement(ImplementedRequirement item) {
- ImplementedRequirement value = ObjectUtils.requireNonNull(item,"item cannot be null");
- return _implementedRequirements == null ? false : _implementedRequirements.remove(value);
- }
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
- }
- }