ProfileImport.java
package gov.nist.secauto.oscal.lib.model;
import gov.nist.secauto.metaschema.core.datatype.adapter.UriReferenceAdapter;
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.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.net.URI;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Designates a referenced source catalog or profile that provides a source of control information for use in creating a new overlay or baseline.
*/
@MetaschemaAssembly(
formalName = "Import Resource",
description = "Designates a referenced source catalog or profile that provides a source of control information for use in creating a new overlay or baseline.",
name = "import",
moduleClass = OscalProfileModule.class,
remarks = "The contents of the `import` element indicate which controls from the source will be included. Controls from the source catalog or profile may be either selected, using the `include-all` or `include-controls` directives, or de-selected (using an `exclude-controls` directive)."
)
public class ProfileImport implements IBoundObject {
private final IMetaschemaData __metaschemaData;
/**
* "A resolvable URL reference to the base catalog or profile that this profile is tailoring."
*/
@BoundFlag(
formalName = "Catalog or Profile Reference",
description = "A resolvable URL reference to the base catalog or profile that this profile is tailoring.",
name = "href",
required = true,
typeAdapter = UriReferenceAdapter.class,
remarks = "This value may be one of:\n"
+ "\n"
+ "1. an [absolute URI](https://pages.nist.gov/OSCAL/concepts/uri-use/#absolute-uri) that points to a network resolvable resource,\n"
+ "2. a [relative reference](https://pages.nist.gov/OSCAL/concepts/uri-use/#relative-reference) pointing to a network resolvable resource whose base URI is the URI of the containing document, or\n"
+ "3. a bare URI fragment (i.e., \\`#uuid\\`) pointing to a `back-matter` resource in this or an imported document (see [linking to another OSCAL object](https://pages.nist.gov/OSCAL/concepts/uri-use/#linking-to-another-oscal-object))."
)
private URI _href;
@BoundAssembly(
formalName = "Include All",
description = "Include all controls from the imported catalog or profile resources.",
useName = "include-all",
remarks = "Identifies that all controls are to be included from the imported catalog or profile.",
minOccurs = 1
)
private IncludeAll _includeAll;
@BoundAssembly(
formalName = "Select Control",
description = "Select a control or controls from an imported control set.",
useName = "include-controls",
remarks = "If `with-child-controls` is \"yes\" on the call to a control, any controls appearing within it (child controls) will be selected, with no additional `call` directives required. This flag provides a way to include controls with all their dependent controls (enhancements) without having to call them individually.",
minOccurs = 1,
maxOccurs = -1,
groupAs = @GroupAs(name = "include-controls", inJson = JsonGroupAsBehavior.LIST)
)
private List<ProfileSelectControlById> _includeControls;
@BoundAssembly(
formalName = "Select Control",
description = "Select a control or controls from an imported control set.",
useName = "exclude-controls",
remarks = "Identifies which controls to exclude, or eliminate, from the set of included controls by control identifier or match pattern.",
maxOccurs = -1,
groupAs = @GroupAs(name = "exclude-controls", inJson = JsonGroupAsBehavior.LIST)
)
private List<ProfileSelectControlById> _excludeControls;
public ProfileImport() {
this(null);
}
public ProfileImport(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public URI getHref() {
return _href;
}
public void setHref(URI value) {
_href = value;
}
public IncludeAll getIncludeAll() {
return _includeAll;
}
public void setIncludeAll(IncludeAll value) {
_includeAll = value;
}
public List<ProfileSelectControlById> getIncludeControls() {
return _includeControls;
}
public void setIncludeControls(List<ProfileSelectControlById> value) {
_includeControls = value;
}
/**
* Add a new {@link ProfileSelectControlById} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addIncludeControls(ProfileSelectControlById item) {
ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_includeControls == null) {
_includeControls = new LinkedList<>();
}
return _includeControls.add(value);
}
/**
* Remove the first matching {@link ProfileSelectControlById} 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 removeIncludeControls(ProfileSelectControlById item) {
ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _includeControls != null && _includeControls.remove(value);
}
public List<ProfileSelectControlById> getExcludeControls() {
return _excludeControls;
}
public void setExcludeControls(List<ProfileSelectControlById> value) {
_excludeControls = value;
}
/**
* Add a new {@link ProfileSelectControlById} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addExcludeControls(ProfileSelectControlById item) {
ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_excludeControls == null) {
_excludeControls = new LinkedList<>();
}
return _excludeControls.add(value);
}
/**
* Remove the first matching {@link ProfileSelectControlById} 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 removeExcludeControls(ProfileSelectControlById item) {
ProfileSelectControlById value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _excludeControls != null && _excludeControls.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}