gov.nist.secauto.oscal.lib.model.PoamItem Maven / Gradle / Ivy
package gov.nist.secauto.oscal.lib.model;
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.Expect;
import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
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.UuidAdapter;
import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLine;
import gov.nist.secauto.metaschema.model.common.datatype.markup.MarkupLineAdapter;
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 an individual POA&M item.
*/
@MetaschemaAssembly(
formalName = "POA&M Item",
description = "Describes an individual POA\\&M item.",
name = "poam-item",
metaschema = OscalPoamMetaschema.class
)
@ValueConstraints(
expect = @Expect(level = IConstraint.Level.WARNING, test = "@uuid", message = "It is a best practice to provide a UUID.")
)
public class PoamItem {
@BoundFlag(
formalName = "POA&M Item Universally Unique Identifier",
description = "A [machine-oriented](/concepts/identifier-use/#machine-oriented), [globally unique](/concepts/identifier-use/#globally-unique) identifier with [instance](/concepts/identifier-use/#instance) scope that can be used to reference this POA\\&M item entry in [this OSCAL instance](/concepts/identifier-use/#poam-identifiers). This UUID should be assigned [per-subject](/concepts/identifier-use/#consistency), which means it should be consistently used to identify the same subject across revisions of the document.",
useName = "uuid",
typeAdapter = UuidAdapter.class
)
private UUID _uuid;
/**
* "The title or name for this POA&M item .
"
*/
@BoundField(
formalName = "POA&M Item Title",
description = "The title or name for this POA\\&M item .",
useName = "title",
minOccurs = 1
)
@BoundFieldValue(
typeAdapter = MarkupLineAdapter.class
)
private MarkupLine _title;
/**
* "A human-readable description of POA&M item.
"
*/
@BoundField(
formalName = "POA&M Item Description",
description = "A human-readable description of POA\\&M item.",
useName = "description",
minOccurs = 1
)
@BoundFieldValue(
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _description;
@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;
/**
* "Identifies the source of the finding, such as a tool or person.
"
*/
@BoundAssembly(
formalName = "Origin",
description = "Identifies the source of the finding, such as a tool or person.",
useName = "origin",
maxOccurs = -1,
remarks = "Used to identify the individual and/or tool generated this poam-item."
)
@GroupAs(
name = "origins",
inJson = JsonGroupAsBehavior.LIST
)
private List _origins;
/**
* "Relates the poam-item to a set of referenced observations that were used to determine the finding.
"
*/
@BoundAssembly(
formalName = "Related Observation",
description = "Relates the poam-item to a set of referenced observations that were used to determine the finding.",
useName = "related-observation",
maxOccurs = -1
)
@GroupAs(
name = "related-observations",
inJson = JsonGroupAsBehavior.LIST
)
private List _relatedObservations;
/**
* "Relates the finding to a set of referenced risks that were used to determine the finding.
"
*/
@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(
name = "related-risks",
inJson = JsonGroupAsBehavior.LIST
)
private List _relatedRisks;
@BoundField(
useName = "remarks"
)
@BoundFieldValue(
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _remarks;
public PoamItem() {
}
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 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 getOrigins() {
return _origins;
}
public void setOrigins(List 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 ? false : _origins.remove(value);
}
public List getRelatedObservations() {
return _relatedObservations;
}
public void setRelatedObservations(List 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 ? false : _relatedObservations.remove(value);
}
public List getRelatedRisks() {
return _relatedRisks;
}
public void setRelatedRisks(List 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 ? false : _relatedRisks.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();
}
/**
* Relates the poam-item to a set of referenced observations that were used to determine the finding.
*/
@MetaschemaAssembly(
formalName = "Related Observation",
description = "Relates the poam-item to a set of referenced observations that were used to determine the finding.",
name = "related-observation",
metaschema = OscalPoamMetaschema.class
)
public static class RelatedObservation {
@BoundFlag(
formalName = "Observation Universally Unique Identifier Reference",
description = "A [machine-oriented](/concepts/identifier-use/#machine-oriented) identifier reference to an observation defined in the list of observations.",
useName = "observation-uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _observationUuid;
public RelatedObservation() {
}
public UUID getObservationUuid() {
return _observationUuid;
}
public void setObservationUuid(UUID value) {
_observationUuid = value;
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
}
}
/**
* Identifies the source of the finding, such as a tool or person.
*/
@MetaschemaAssembly(
formalName = "Origin",
description = "Identifies the source of the finding, such as a tool or person.",
name = "origin",
metaschema = OscalPoamMetaschema.class,
remarks = "Used to identify the individual and/or tool generated this poam-item."
)
public static class Origin {
@BoundAssembly(
useName = "actor",
minOccurs = 1,
maxOccurs = -1
)
@GroupAs(
name = "actors",
inJson = JsonGroupAsBehavior.LIST
)
private List _actors;
public Origin() {
}
public List getActors() {
return _actors;
}
public void setActors(List value) {
_actors = value;
}
/**
* Add a new {@link OriginActor} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addActor(OriginActor item) {
OriginActor value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_actors == null) {
_actors = new LinkedList<>();
}
return _actors.add(value);
}
/**
* Remove the first matching {@link OriginActor} 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 removeActor(OriginActor item) {
OriginActor value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _actors == null ? false : _actors.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.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",
metaschema = OscalPoamMetaschema.class
)
public static class AssociatedRisk {
@BoundFlag(
formalName = "Risk Universally Unique Identifier Reference",
description = "A [machine-oriented](/concepts/identifier-use/#machine-oriented) identifier reference to a risk defined in the list of risks.",
useName = "risk-uuid",
required = true,
typeAdapter = UuidAdapter.class
)
private UUID _riskUuid;
public AssociatedRisk() {
}
public UUID getRiskUuid() {
return _riskUuid;
}
public void setRiskUuid(UUID value) {
_riskUuid = value;
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
}
}
}