AuthorizedPrivilege.java
package gov.nist.secauto.oscal.lib.model;
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine;
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter;
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.util.ObjectUtils;
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.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;
/**
* Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.
*/
@MetaschemaAssembly(
formalName = "Privilege",
description = "Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.",
name = "authorized-privilege",
moduleClass = OscalImplementationCommonModule.class
)
public class AuthorizedPrivilege implements IBoundObject {
private final IMetaschemaData __metaschemaData;
@BoundField(
formalName = "Privilege Title",
description = "A human readable name for the privilege.",
useName = "title",
minOccurs = 1,
typeAdapter = MarkupLineAdapter.class
)
private MarkupLine _title;
@BoundField(
formalName = "Privilege Description",
description = "A summary of the privilege's purpose within the system.",
useName = "description",
typeAdapter = MarkupMultilineAdapter.class
)
private MarkupMultiline _description;
@BoundField(
formalName = "Functions Performed",
description = "Describes a function performed for a given authorized privilege by this user class.",
useName = "function-performed",
minOccurs = 1,
maxOccurs = -1,
groupAs = @GroupAs(name = "functions-performed", inJson = JsonGroupAsBehavior.LIST)
)
private List<String> _functionsPerformed;
public AuthorizedPrivilege() {
this(null);
}
public AuthorizedPrivilege(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
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<String> getFunctionsPerformed() {
return _functionsPerformed;
}
public void setFunctionsPerformed(List<String> value) {
_functionsPerformed = value;
}
/**
* Add a new {@link String} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addFunctionPerformed(String item) {
String value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_functionsPerformed == null) {
_functionsPerformed = new LinkedList<>();
}
return _functionsPerformed.add(value);
}
/**
* Remove the first matching {@link String} 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 removeFunctionPerformed(String item) {
String value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _functionsPerformed != null && _functionsPerformed.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}