ComponentStatement.java
package gov.nist.secauto.oscal.lib.model;
import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter;
import gov.nist.secauto.metaschema.core.datatype.adapter.UuidAdapter;
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.BoundFlag;
import gov.nist.secauto.metaschema.databind.model.annotations.GroupAs;
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 java.util.UUID;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Identifies which statements within a control are addressed.
*/
@MetaschemaAssembly(
formalName = "Control Statement Implementation",
description = "Identifies which statements within a control are addressed.",
name = "statement",
moduleClass = OscalComponentDefinitionModule.class,
modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "unique-component-definition-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."))
)
public class ComponentStatement implements IBoundObject {
private final IMetaschemaData __metaschemaData;
/**
* "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented\">human-oriented</a> identifier reference to a <code>control statement</code>."
*/
@BoundFlag(
formalName = "Control Statement Reference",
description = "A [human-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#human-oriented) identifier reference to a `control statement`.",
name = "statement-id",
required = true,
typeAdapter = TokenAdapter.class,
remarks = "A reference to the specific implemented statement associated with a control."
)
private String _statementId;
/**
* "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a>, <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique\">globally unique</a> identifier with <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance\">cross-instance</a> scope that can be used to reference this control statement elsewhere in <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#component-definition-identifiers\">this or other OSCAL instances</a>. The <em>UUID</em> of the <code>control statement</code> in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance)."
*/
@BoundFlag(
formalName = "Control Statement Reference Universally Unique Identifier",
description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented), [globally unique](https://pages.nist.gov/OSCAL/concepts/identifier-use/#globally-unique) identifier with [cross-instance](https://pages.nist.gov/OSCAL/concepts/identifier-use/#cross-instance) scope that can be used to reference this control statement elsewhere in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#component-definition-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).",
name = "uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _uuid;
@BoundField(
formalName = "Statement Implementation Description",
description = "A summary of how the containing control statement is implemented by the component or capability.",
useName = "description",
minOccurs = 1,
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 = @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 = @GroupAs(name = "links", inJson = JsonGroupAsBehavior.LIST)
)
private List<Link> _links;
@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 = @GroupAs(name = "responsible-roles", inJson = JsonGroupAsBehavior.LIST)
)
private List<ResponsibleRole> _responsibleRoles;
@BoundField(
formalName = "Remarks",
description = "Additional commentary about the containing object.",
useName = "remarks",
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _remarks;
public ComponentStatement() {
this(null);
}
public ComponentStatement(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
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 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 && _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 && _links.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 && _responsibleRoles.remove(value);
}
public MarkupMultiline getRemarks() {
return _remarks;
}
public void setRemarks(MarkupMultiline value) {
_remarks = value;
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}