Finding.java
package gov.nist.secauto.oscal.lib.model;
import gov.nist.secauto.metaschema.core.datatype.adapter.UuidAdapter;
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine;
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter;
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.util.ObjectUtils;
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.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;
/**
* Describes an individual finding.
*/
@MetaschemaAssembly(
formalName = "Finding",
description = "Describes an individual finding.",
name = "finding",
moduleClass = OscalAssessmentCommonModule.class
)
public class Finding implements IBoundObject {
private final IMetaschemaData __metaschemaData;
/**
* "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 finding in <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#ar-identifiers\">this or other OSCAL instances</a>. The locally defined <em>UUID</em> of the <code>finding</code> can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency\">per-subject</a>, which means it should be consistently used to identify the same subject across revisions of the document."
*/
@BoundFlag(
formalName = "Finding 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 finding in [this or other OSCAL instances](https://pages.nist.gov/OSCAL/concepts/identifier-use/#ar-identifiers). The locally defined *UUID* of the `finding` can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned [per-subject](https://pages.nist.gov/OSCAL/concepts/identifier-use/#consistency), which means it should be consistently used to identify the same subject across revisions of the document.",
name = "uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _uuid;
@BoundField(
formalName = "Finding Title",
description = "The title for this finding.",
useName = "title",
minOccurs = 1,
typeAdapter = MarkupLineAdapter.class
)
private MarkupLine _title;
@BoundField(
formalName = "Finding Description",
description = "A human-readable description of this finding.",
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 = "Origin",
description = "Identifies the source of the finding, such as a tool, interviewed person, or activity.",
useName = "origin",
remarks = "Used to identify the individual and/or tool generated this finding.",
maxOccurs = -1,
groupAs = @GroupAs(name = "origins", inJson = JsonGroupAsBehavior.LIST)
)
private List<Origin> _origins;
@BoundAssembly(
formalName = "Objective Status",
description = "Captures an assessor's conclusions regarding the degree to which an objective is satisfied.",
useName = "target",
minOccurs = 1
)
private FindingTarget _target;
@BoundField(
formalName = "Implementation Statement UUID",
description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to the implementation statement in the SSP to which this finding is related.",
useName = "implementation-statement-uuid",
typeAdapter = UuidAdapter.class
)
private UUID _implementationStatementUuid;
@BoundAssembly(
formalName = "Related Observation",
description = "Relates the finding to a set of referenced observations that were used to determine the finding.",
useName = "related-observation",
maxOccurs = -1,
groupAs = @GroupAs(name = "related-observations", inJson = JsonGroupAsBehavior.LIST)
)
private List<RelatedObservation> _relatedObservations;
@BoundAssembly(
formalName = "Associated Risk",
description = "Relates the finding to a set of referenced risks that were used to determine the finding.",
useName = "associated-risk",
maxOccurs = -1,
groupAs = @GroupAs(name = "related-risks", inJson = JsonGroupAsBehavior.LIST)
)
private List<AssociatedRisk> _relatedRisks;
@BoundField(
formalName = "Remarks",
description = "Additional commentary about the containing object.",
useName = "remarks",
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _remarks;
public Finding() {
this(null);
}
public Finding(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public UUID getUuid() {
return _uuid;
}
public void setUuid(UUID value) {
_uuid = value;
}
public MarkupLine getTitle() {
return _title;
}
public void setTitle(MarkupLine value) {
_title = 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<Origin> getOrigins() {
return _origins;
}
public void setOrigins(List<Origin> value) {
_origins = value;
}
/**
* Add a new {@link Origin} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addOrigin(Origin item) {
Origin value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_origins == null) {
_origins = new LinkedList<>();
}
return _origins.add(value);
}
/**
* Remove the first matching {@link Origin} 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 removeOrigin(Origin item) {
Origin value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _origins != null && _origins.remove(value);
}
public FindingTarget getTarget() {
return _target;
}
public void setTarget(FindingTarget value) {
_target = value;
}
public UUID getImplementationStatementUuid() {
return _implementationStatementUuid;
}
public void setImplementationStatementUuid(UUID value) {
_implementationStatementUuid = value;
}
public List<RelatedObservation> getRelatedObservations() {
return _relatedObservations;
}
public void setRelatedObservations(List<RelatedObservation> value) {
_relatedObservations = value;
}
/**
* Add a new {@link RelatedObservation} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addRelatedObservation(RelatedObservation item) {
RelatedObservation value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_relatedObservations == null) {
_relatedObservations = new LinkedList<>();
}
return _relatedObservations.add(value);
}
/**
* Remove the first matching {@link RelatedObservation} 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 removeRelatedObservation(RelatedObservation item) {
RelatedObservation value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _relatedObservations != null && _relatedObservations.remove(value);
}
public List<AssociatedRisk> getRelatedRisks() {
return _relatedRisks;
}
public void setRelatedRisks(List<AssociatedRisk> value) {
_relatedRisks = value;
}
/**
* Add a new {@link AssociatedRisk} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addAssociatedRisk(AssociatedRisk item) {
AssociatedRisk value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_relatedRisks == null) {
_relatedRisks = new LinkedList<>();
}
return _relatedRisks.add(value);
}
/**
* Remove the first matching {@link AssociatedRisk} 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 removeAssociatedRisk(AssociatedRisk item) {
AssociatedRisk value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _relatedRisks != null && _relatedRisks.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();
}
/**
* Relates the finding to a set of referenced observations that were used to determine the finding.
*/
@MetaschemaAssembly(
formalName = "Related Observation",
description = "Relates the finding to a set of referenced observations that were used to determine the finding.",
name = "related-observation",
moduleClass = OscalAssessmentCommonModule.class
)
public static class RelatedObservation implements IBoundObject {
private final IMetaschemaData __metaschemaData;
/**
* "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a> identifier reference to an observation defined in the list of observations."
*/
@BoundFlag(
formalName = "Observation Universally Unique Identifier Reference",
description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to an observation defined in the list of observations.",
name = "observation-uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _observationUuid;
public RelatedObservation() {
this(null);
}
public RelatedObservation(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public UUID getObservationUuid() {
return _observationUuid;
}
public void setObservationUuid(UUID value) {
_observationUuid = value;
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}
/**
* Relates the finding to a set of referenced risks that were used to determine the finding.
*/
@MetaschemaAssembly(
formalName = "Associated Risk",
description = "Relates the finding to a set of referenced risks that were used to determine the finding.",
name = "associated-risk",
moduleClass = OscalAssessmentCommonModule.class
)
public static class AssociatedRisk implements IBoundObject {
private final IMetaschemaData __metaschemaData;
/**
* "A <a href=\"https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented\">machine-oriented</a> identifier reference to a risk defined in the list of risks."
*/
@BoundFlag(
formalName = "Risk Universally Unique Identifier Reference",
description = "A [machine-oriented](https://pages.nist.gov/OSCAL/concepts/identifier-use/#machine-oriented) identifier reference to a risk defined in the list of risks.",
name = "risk-uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _riskUuid;
public AssociatedRisk() {
this(null);
}
public AssociatedRisk(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public UUID getRiskUuid() {
return _riskUuid;
}
public void setRiskUuid(UUID value) {
_riskUuid = value;
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}
}