gov.nist.secauto.oscal.lib.model.ProfileImport 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.BoundFlag;
import gov.nist.secauto.metaschema.binding.model.annotations.GroupAs;
import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaAssembly;
import gov.nist.secauto.metaschema.model.common.JsonGroupAsBehavior;
import gov.nist.secauto.metaschema.model.common.datatype.adapter.UriReferenceAdapter;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
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.MultilineRecursiveToStringStyle;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
/**
* The import
designates a catalog or profile to be included (referenced and potentially modified) by this profile. The import also identifies which controls to select using the include-all
, include-controls
, and exclude-controls
directives.
*/
@MetaschemaAssembly(
formalName = "Import resource",
description = "The `import` designates a catalog or profile to be included (referenced and potentially modified) by this profile. The import also identifies which controls to select using the `include-all`, `include-controls`, and `exclude-controls` directives.",
name = "import",
metaschema = OscalProfileMetaschema.class,
remarks = "A profile must be based on an existing OSCAL catalog or another OSCAL profile. An `import` indicates such a source whose controls are to be included (referenced and modified) in a profile. This source will either be a catalog whose controls are given (\"by value\"), or a profile with its own control imports.\n"
+ "\n"
+ "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 {
@BoundFlag(
formalName = "Catalog or Profile Reference",
description = "A resolvable URL reference to the base catalog or profile that this profile is tailoring.",
useName = "href",
required = true,
typeAdapter = UriReferenceAdapter.class,
remarks = "The value of the `href` can be an internet resource, or an internal reference using a fragment e.g. #fragment that points to a `back-matter`\n"
+ "`resource` in the same document.\n"
+ "\n"
+ "If a local reference using a fragment is used, this will be indicated by a fragment \"#\" followed by an identifier which references the `uuid` value of a `resource` in the document's `back-matter`.\n"
+ "\n"
+ "If an internet resource is used, the `href` value will be an absolute or relative URL pointing to the location of the referenced resource. A relative URL will be resolved relative to the location of the document containing the link."
)
private URI _href;
@BoundAssembly(
useName = "include-all",
minOccurs = 1,
remarks = "Identifies that all controls are to be included from the imported catalog or profile."
)
private IncludeAll _includeAll;
@BoundAssembly(
useName = "include-controls",
minOccurs = 1,
maxOccurs = -1,
remarks = "Identifies a subset of controls to import from the referenced catalog or profile by control identifier or match pattern."
)
@GroupAs(
name = "include-controls",
inJson = JsonGroupAsBehavior.LIST
)
private List _includeControls;
@BoundAssembly(
useName = "exclude-controls",
maxOccurs = -1,
remarks = "Identifies which controls to exclude, or eliminate, from the set of included controls by control identifier or match pattern."
)
@GroupAs(
name = "exclude-controls",
inJson = JsonGroupAsBehavior.LIST
)
private List _excludeControls;
public ProfileImport() {
}
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 getIncludeControls() {
return _includeControls;
}
public void setIncludeControls(List 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 ? false : _includeControls.remove(value);
}
public List getExcludeControls() {
return _excludeControls;
}
public void setExcludeControls(List 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 ? false : _excludeControls.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
}
}