LocalDefinitions.java
package gov.nist.secauto.oscal.lib.model;
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.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 org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Allows components, and inventory-items to be defined within the POA&M for circumstances where no OSCAL-based SSP exists, or is not delivered with the POA&M.
*/
@MetaschemaAssembly(
formalName = "Local Definitions",
description = "Allows components, and inventory-items to be defined within the POA\\&M for circumstances where no OSCAL-based SSP exists, or is not delivered with the POA\\&M.",
name = "local-definitions",
moduleClass = OscalPoamModule.class,
modelConstraints = @AssemblyConstraints(unique = @IsUnique(id = "unique-poam-local-definitions-component", level = IConstraint.Level.ERROR, target = "component", keyFields = @KeyField(target = "@uuid"), remarks = "Since multiple `component` entries can be provided, each component must have a unique `uuid`."))
)
public class LocalDefinitions implements IBoundObject {
private final IMetaschemaData __metaschemaData;
@BoundAssembly(
formalName = "Component",
description = "A defined component that can be part of an implemented system.",
useName = "component",
remarks = "Used to add any components, not defined via the System Security Plan (AR-\\>AP-\\>SSP)",
maxOccurs = -1,
groupAs = @GroupAs(name = "components", inJson = JsonGroupAsBehavior.LIST)
)
private List<SystemComponent> _components;
@BoundAssembly(
formalName = "Inventory Item",
description = "A single managed inventory item within the system.",
useName = "inventory-item",
remarks = "Used to add any inventory-items, not defined via the System Security Plan (AR-\\>AP-\\>SSP)",
maxOccurs = -1,
groupAs = @GroupAs(name = "inventory-items", inJson = JsonGroupAsBehavior.LIST)
)
private List<InventoryItem> _inventoryItems;
@BoundAssembly(
formalName = "Assessment Assets",
description = "Identifies the assets used to perform this assessment, such as the assessment team, scanning tools, and assumptions.",
useName = "assessment-assets",
remarks = "Specifies components or assessment-platforms used in the assessment."
)
private AssessmentAssets _assessmentAssets;
@BoundField(
formalName = "Remarks",
description = "Additional commentary about the containing object.",
useName = "remarks",
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _remarks;
public LocalDefinitions() {
this(null);
}
public LocalDefinitions(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public List<SystemComponent> getComponents() {
return _components;
}
public void setComponents(List<SystemComponent> value) {
_components = value;
}
/**
* Add a new {@link SystemComponent} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addComponent(SystemComponent item) {
SystemComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_components == null) {
_components = new LinkedList<>();
}
return _components.add(value);
}
/**
* Remove the first matching {@link SystemComponent} 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 removeComponent(SystemComponent item) {
SystemComponent value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _components != null && _components.remove(value);
}
public List<InventoryItem> getInventoryItems() {
return _inventoryItems;
}
public void setInventoryItems(List<InventoryItem> value) {
_inventoryItems = value;
}
/**
* Add a new {@link InventoryItem} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addInventoryItem(InventoryItem item) {
InventoryItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_inventoryItems == null) {
_inventoryItems = new LinkedList<>();
}
return _inventoryItems.add(value);
}
/**
* Remove the first matching {@link InventoryItem} 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 removeInventoryItem(InventoryItem item) {
InventoryItem value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _inventoryItems != null && _inventoryItems.remove(value);
}
public AssessmentAssets getAssessmentAssets() {
return _assessmentAssets;
}
public void setAssessmentAssets(AssessmentAssets value) {
_assessmentAssets = 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();
}
}