InsertControls.java
package gov.nist.secauto.oscal.lib.model;
import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter;
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.AllowedValue;
import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues;
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 gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints;
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;
/**
* Specifies which controls to use in the containing context.
*/
@MetaschemaAssembly(
formalName = "Insert Controls",
description = "Specifies which controls to use in the containing context.",
name = "insert-controls",
moduleClass = OscalProfileModule.class,
remarks = "To be schema-valid, this element must contain either (but not both) a single `include-all` directive, or a sequence of `include-controls` directives.\n"
+ "\n"
+ "If this directive is not provided, then no controls are to be inserted; i.e., all controls are included explicitly."
)
public class InsertControls implements IBoundObject {
private final IMetaschemaData __metaschemaData;
/**
* "A designation of how a selection of controls in a profile is to be ordered."
*/
@BoundFlag(
formalName = "Order",
description = "A designation of how a selection of controls in a profile is to be ordered.",
name = "order",
typeAdapter = TokenAdapter.class,
valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, values = {@AllowedValue(value = "keep", description = ""), @AllowedValue(value = "ascending", description = ""), @AllowedValue(value = "descending", description = "")}))
)
private String _order;
@BoundAssembly(
formalName = "Include All",
description = "Include all controls from the imported catalog or profile resources.",
useName = "include-all",
minOccurs = 1
)
private IncludeAll _includeAll;
@BoundAssembly(
formalName = "Select Control",
description = "Select a control or controls from an imported control set.",
useName = "include-controls",
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 matching includes.",
maxOccurs = -1,
groupAs = @GroupAs(name = "exclude-controls", inJson = JsonGroupAsBehavior.LIST)
)
private List<ProfileSelectControlById> _excludeControls;
public InsertControls() {
this(null);
}
public InsertControls(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public String getOrder() {
return _order;
}
public void setOrder(String value) {
_order = 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();
}
}