ControlImplementation.java
package gov.nist.secauto.oscal.lib.model;
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline;
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultilineAdapter;
import gov.nist.secauto.metaschema.core.model.IBoundObject;
import gov.nist.secauto.metaschema.core.model.IMetaschemaData;
import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior;
import gov.nist.secauto.metaschema.core.model.constraint.IConstraint;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.metaschema.databind.model.annotations.AssemblyConstraints;
import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly;
import gov.nist.secauto.metaschema.databind.model.annotations.BoundField;
import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
import gov.nist.secauto.metaschema.databind.model.annotations.Index;
import gov.nist.secauto.metaschema.databind.model.annotations.IsUnique;
import gov.nist.secauto.metaschema.databind.model.annotations.KeyField;
import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly;
import java.lang.Override;
import java.lang.String;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 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",
moduleClass = OscalSspModule.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.",
modelConstraints = @AssemblyConstraints(index = @Index(level = IConstraint.Level.ERROR, target = "implemented-requirement//by-component/export/provided", name = "by-component-export-provided-uuid", keyFields = @KeyField(target = "@uuid")), unique = @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 implements IBoundObject {
private final IMetaschemaData __metaschemaData;
@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,
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 = @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 = @GroupAs(name = "implemented-requirements", inJson = JsonGroupAsBehavior.LIST)
)
private List<ImplementedRequirement> _implementedRequirements;
public ControlImplementation() {
this(null);
}
public ControlImplementation(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
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 && _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 && _implementedRequirements.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}