Origin.java
package gov.nist.secauto.oscal.lib.model;
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.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 the source of the finding, such as a tool, interviewed person, or activity.
*/
@MetaschemaAssembly(
formalName = "Origin",
description = "Identifies the source of the finding, such as a tool, interviewed person, or activity.",
name = "origin",
moduleClass = OscalAssessmentCommonModule.class
)
public class Origin implements IBoundObject {
private final IMetaschemaData __metaschemaData;
@BoundAssembly(
formalName = "Originating Actor",
description = "The actor that produces an observation, a finding, or a risk. One or more actor type can be used to specify a person that is using a tool.",
useName = "actor",
minOccurs = 1,
maxOccurs = -1,
groupAs = @GroupAs(name = "actors", inJson = JsonGroupAsBehavior.LIST)
)
private List<OriginActor> _actors;
@BoundAssembly(
formalName = "Task Reference",
description = "Identifies an individual task for which the containing object is a consequence of.",
useName = "related-task",
maxOccurs = -1,
groupAs = @GroupAs(name = "related-tasks", inJson = JsonGroupAsBehavior.LIST)
)
private List<RelatedTask> _relatedTasks;
public Origin() {
this(null);
}
public Origin(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public List<OriginActor> getActors() {
return _actors;
}
public void setActors(List<OriginActor> value) {
_actors = value;
}
/**
* Add a new {@link OriginActor} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addActor(OriginActor item) {
OriginActor value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_actors == null) {
_actors = new LinkedList<>();
}
return _actors.add(value);
}
/**
* Remove the first matching {@link OriginActor} 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 removeActor(OriginActor item) {
OriginActor value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _actors != null && _actors.remove(value);
}
public List<RelatedTask> getRelatedTasks() {
return _relatedTasks;
}
public void setRelatedTasks(List<RelatedTask> value) {
_relatedTasks = value;
}
/**
* Add a new {@link RelatedTask} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addRelatedTask(RelatedTask item) {
RelatedTask value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_relatedTasks == null) {
_relatedTasks = new LinkedList<>();
}
return _relatedTasks.add(value);
}
/**
* Remove the first matching {@link RelatedTask} 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 removeRelatedTask(RelatedTask item) {
RelatedTask value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _relatedTasks != null && _relatedTasks.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}