Run.java
package org.schemastore.json.sarif.x210;
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;
/**
* Describes a single run of an analysis tool, and contains the reported output of that run.
*/
@MetaschemaAssembly(
formalName = "Run",
description = "Describes a single run of an analysis tool, and contains the reported output of that run.",
name = "run",
moduleClass = SarifModule.class
)
public class Run implements IBoundObject {
private final IMetaschemaData __metaschemaData;
@BoundAssembly(
formalName = "Tool",
description = "Information about the tool or tool pipeline that generated the results in this run. A run can only contain results produced by a single tool or tool pipeline. A run can aggregate results from multiple log files, as long as context around the tool run (tool command-line arguments and the like) is identical for all aggregated files.",
useName = "tool"
)
private Tool _tool;
@BoundAssembly(
formalName = "Artifact",
description = "A sequence of artifacts relevant to the run.",
useName = "artifact",
maxOccurs = -1,
groupAs = @GroupAs(name = "artifacts", inJson = JsonGroupAsBehavior.LIST)
)
private List<Artifact> _artifacts;
@BoundAssembly(
formalName = "Result",
description = "The set of results contained in an SARIF log. The results array can be omitted when a run is solely exporting rules metadata. It must be present (but may be empty) if a log file represents an actual scan.",
useName = "result",
maxOccurs = -1,
groupAs = @GroupAs(name = "results", inJson = JsonGroupAsBehavior.LIST)
)
private List<Result> _results;
public Run() {
this(null);
}
public Run(IMetaschemaData data) {
this.__metaschemaData = data;
}
@Override
public IMetaschemaData getMetaschemaData() {
return __metaschemaData;
}
public Tool getTool() {
return _tool;
}
public void setTool(Tool value) {
_tool = value;
}
public List<Artifact> getArtifacts() {
return _artifacts;
}
public void setArtifacts(List<Artifact> value) {
_artifacts = value;
}
/**
* Add a new {@link Artifact} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addArtifact(Artifact item) {
Artifact value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_artifacts == null) {
_artifacts = new LinkedList<>();
}
return _artifacts.add(value);
}
/**
* Remove the first matching {@link Artifact} 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 removeArtifact(Artifact item) {
Artifact value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _artifacts != null && _artifacts.remove(value);
}
public List<Result> getResults() {
return _results;
}
public void setResults(List<Result> value) {
_results = value;
}
/**
* Add a new {@link Result} item to the underlying collection.
* @param item the item to add
* @return {@code true}
*/
public boolean addResult(Result item) {
Result value = ObjectUtils.requireNonNull(item,"item cannot be null");
if (_results == null) {
_results = new LinkedList<>();
}
return _results.add(value);
}
/**
* Remove the first matching {@link Result} 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 removeResult(Result item) {
Result value = ObjectUtils.requireNonNull(item,"item cannot be null");
return _results != null && _results.remove(value);
}
@Override
public String toString() {
return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString();
}
}