ComponentImplementedRequirement.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.TokenAdapter;
import gov.nist.secauto.metaschema.model.common.datatype.adapter.UuidAdapter;
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 java.util.UUID;
import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/**
* Describes how the containing component or capability implements an individual control.
*/
@MetaschemaAssembly(
formalName = "Control Implementation",
description = "Describes how the containing component or capability implements an individual control.",
name = "implemented-requirement",
metaschema = OscalComponentDefinitionMetaschema.class,
remarks = "Implemented requirements within a component or capability in a component definition provide a means for component suppliers to suggest possible control implementation details, which may be used by a different party (e.g., component consumers) when authoring a system security plan. Thus, these requirements defined in a component definition are only a suggestion of how to implement, which may be adopted wholesale, changed, or ignored by a person defining an information system implementation.\n"
+ "\n"
+ "Use of `set-parameter` in this context, sets the parameter for the referenced control and any associated statements."
)
@AssemblyConstraints(
isUnique = {
@IsUnique(id = "unique-component-definition-implemented-requirement-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."),
@IsUnique(id = "unique-component-definition-implemented-requirement-responsible-role", level = IConstraint.Level.ERROR, target = "responsible-role", keyFields = @KeyField(target = "@role-id"), remarks = "Since `responsible-role` associates multiple `party-uuid` entries with a single `role-id`, each role-id must be referenced only once."),
@IsUnique(id = "unique-component-definition-implemented-requirement-statement", level = IConstraint.Level.ERROR, target = "statement", keyFields = @KeyField(target = "@statement-id"), remarks = "Since `statement` entries can be referenced using the statement's statement-id, each statement must be referenced only once.")
}
)
public class ComponentImplementedRequirement {
@BoundFlag(
formalName = "Control Implementation Identifier",
description = "Provides a globally unique means to identify a given control implementation by a component.",
useName = "uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _uuid;
@BoundFlag(
formalName = "Control Identifier Reference",
description = "A reference to a control with a corresponding `id` value. When referencing an externally defined `control`, the `Control Identifier Reference` must be used in the context of the external / imported OSCAL instance (e.g., uri-reference).",
useName = "control-id",
required = true,
typeAdapter = TokenAdapter.class
)
private String _controlId;
/**
* "A suggestion from the supplier (e.g., component vendor or author) for how the specified control may be implemented if the containing component or capability is instantiated in a system security plan."
*/
@BoundField(
formalName = "Control Implementation Description",
description = "A suggestion from the supplier (e.g., component vendor or author) for how the specified control may be implemented if the containing component or capability is instantiated in a system security plan.",
useName = "description",
minOccurs = 1
)
@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 = "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 = "Responsible Role",
description = "A reference to a role with responsibility for performing a function relative to the containing object, optionally associated with a set of persons and/or organizations that perform that role.",
useName = "responsible-role",
maxOccurs = -1
)
@GroupAs(
name = "responsible-roles",
inJson = JsonGroupAsBehavior.LIST
)
private List<ResponsibleRole> _responsibleRoles;
@BoundAssembly(
formalName = "Control Statement Implementation",
description = "Identifies which statements within a control are addressed.",
useName = "statement",
maxOccurs = -1
)
@GroupAs(
name = "statements",
inJson = JsonGroupAsBehavior.LIST
)
private List<ComponentStatement> _statements;
@BoundField(
formalName = "Remarks",
description = "Additional commentary about the containing object.",
useName = "remarks"
)
@BoundFieldValue(
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _remarks;
public ComponentImplementedRequirement() {
}
public UUID getUuid() {
return _uuid;
}
public void setUuid(UUID value) {
_uuid = value;
}
public String getControlId() {
return _controlId;
}
public void setControlId(String value) {
_controlId = value;
}
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<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<ResponsibleRole> getResponsibleRoles() {
return _responsibleRoles;
}
public void setResponsibleRoles(List<ResponsibleRole> value) {
_responsibleRoles = value;
}
/**
* Add a new {@link ResponsibleRole} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addResponsibleRole(ResponsibleRole item) {
ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_responsibleRoles == null) {
_responsibleRoles = new LinkedList<>();
}
return _responsibleRoles.add(value);
}
/**
* Remove the first matching {@link ResponsibleRole} 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 removeResponsibleRole(ResponsibleRole item) {
ResponsibleRole value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _responsibleRoles == null ? false : _responsibleRoles.remove(value);
}
public List<ComponentStatement> getStatements() {
return _statements;
}
public void setStatements(List<ComponentStatement> value) {
_statements = value;
}
/**
* Add a new {@link ComponentStatement} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addStatement(ComponentStatement item) {
ComponentStatement value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_statements == null) {
_statements = new LinkedList<>();
}
return _statements.add(value);
}
/**
* Remove the first matching {@link ComponentStatement} 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 removeStatement(ComponentStatement item) {
ComponentStatement value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _statements == null ? false : _statements.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();
}
}