gov.nist.secauto.oscal.lib.model.Statement Maven / Gradle / Ivy
package gov.nist.secauto.oscal.lib.model;
import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
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.binding.model.annotations.ValueConstraints;
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;
/**
* Identifies which statements within a control are addressed.
*/
@MetaschemaAssembly(
formalName = "Specific Control Statement",
description = "Identifies which statements within a control are addressed.",
name = "statement",
metaschema = OscalSspMetaschema.class
)
@ValueConstraints(
allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, target = "responsible-role/@role-id", allowOthers = true, values = {@AllowedValue(value = "asset-owner", description = "Accountable for ensuring the asset is managed in accordance with organizational policies and procedures."), @AllowedValue(value = "asset-administrator", description = "Responsible for administering a set of assets."), @AllowedValue(value = "security-operations", description = "Members of the security operations center (SOC)."), @AllowedValue(value = "network-operations", description = "Members of the network operations center (NOC)."), @AllowedValue(value = "incident-response", description = "Responsible for responding to an event that could lead to loss of, or disruption to, an organization's operations, services or functions."), @AllowedValue(value = "help-desk", description = "Responsible for providing information and support to users."), @AllowedValue(value = "configuration-management", description = "Responsible for the configuration management processes governing changes to the asset.")})
)
@AssemblyConstraints(
isUnique = {
@IsUnique(id = "unique-ssp-statement-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-ssp-implemented-requirement-statement-by-component", level = IConstraint.Level.ERROR, target = "by-component", keyFields = @KeyField(target = "@component-uuid"), remarks = "Since `by-component` can reference `component` entries using the component's uuid, each component must be referenced only once. This ensures that all implementation statements are contained in the same `by-component` entry.")
}
)
public class Statement {
@BoundFlag(
useName = "statement-id",
required = true,
typeAdapter = TokenAdapter.class,
remarks = "A reference to the specific implemented statement associated with a control."
)
private String _statementId;
@BoundFlag(
formalName = "Control Statement Reference Universally Unique Identifier",
description = "A [machine-oriented](/concepts/identifier-use/#machine-oriented), [globally unique](/concepts/identifier-use/#globally-unique) identifier with [cross-instance](/concepts/identifier-use/#cross-instance) scope that can be used to reference this control statement elsewhere in [this or other OSCAL instances](/concepts/identifier-use/#ssp-identifiers). The *UUID* of the `control statement` in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).",
useName = "uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _uuid;
@BoundAssembly(
useName = "prop",
maxOccurs = -1
)
@GroupAs(
name = "props",
inJson = JsonGroupAsBehavior.LIST
)
private List _props;
@BoundAssembly(
useName = "link",
maxOccurs = -1
)
@GroupAs(
name = "links",
inJson = JsonGroupAsBehavior.LIST
)
private List _links;
@BoundAssembly(
useName = "responsible-role",
maxOccurs = -1
)
@GroupAs(
name = "responsible-roles",
inJson = JsonGroupAsBehavior.LIST
)
private List _responsibleRoles;
@BoundAssembly(
useName = "by-component",
maxOccurs = -1
)
@GroupAs(
name = "by-components",
inJson = JsonGroupAsBehavior.LIST
)
private List _byComponents;
@BoundField(
useName = "remarks"
)
@BoundFieldValue(
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _remarks;
public Statement() {
}
public String getStatementId() {
return _statementId;
}
public void setStatementId(String value) {
_statementId = value;
}
public UUID getUuid() {
return _uuid;
}
public void setUuid(UUID value) {
_uuid = value;
}
public List getProps() {
return _props;
}
public void setProps(List 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 getLinks() {
return _links;
}
public void setLinks(List 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 getResponsibleRoles() {
return _responsibleRoles;
}
public void setResponsibleRoles(List 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 getByComponents() {
return _byComponents;
}
public void setByComponents(List value) {
_byComponents = value;
}
/**
* Add a new {@link ByComponent} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addByComponent(ByComponent item) {
ByComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_byComponents == null) {
_byComponents = new LinkedList<>();
}
return _byComponents.add(value);
}
/**
* Remove the first matching {@link ByComponent} 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 removeByComponent(ByComponent item) {
ByComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _byComponents == null ? false : _byComponents.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();
}
}