Class OrtResult
-
- All Implemented Interfaces:
public final class OrtResultThe common output format for the analyzer and scanner. It contains information about the scanned repository, and the analyzer and scanner will add their result to it.
-
-
Field Summary
Fields Modifier and Type Field Description public final static OrtResultEMPTYprivate final DependencyNavigatordependencyNavigatorprivate final Repositoryrepositoryprivate final AnalyzerRunanalyzerprivate final ScannerRunscannerprivate final AdvisorRunadvisorprivate final EvaluatorRunevaluatorprivate final ResolvedConfigurationresolvedConfigurationprivate final Map<String, String>labels
-
Constructor Summary
Constructors Constructor Description OrtResult(Repository repository, AnalyzerRun analyzer, ScannerRun scanner, AdvisorRun advisor, EvaluatorRun evaluator, ResolvedConfiguration resolvedConfiguration, Map<String, String> labels)
-
Method Summary
Modifier and Type Method Description final DependencyNavigatorgetDependencyNavigator()An object that can be used to navigate the dependency information contained in this result. final RepositorygetRepository()Information about the repository that was used as input. final AnalyzerRungetAnalyzer()An AnalyzerRun containing details about the analyzer that was run using repository as input. final ScannerRungetScanner()A ScannerRun containing details about the scanner that was run using the result from analyzer as input. final AdvisorRungetAdvisor()An AdvisorRun containing details about the advisor that was run using the result from analyzer as input. final EvaluatorRungetEvaluator()An EvaluatorRun containing details about the evaluation that was run using the result from scanner as input. final ResolvedConfigurationgetResolvedConfiguration()A ResolvedConfiguration containing data resolved during the analysis which augments the automatically determined data. final Map<String, String>getLabels()User defined labels associated to this result. final Map<Identifier, List<AdvisorResult>>getAdvisorResults(Boolean omitExcluded)Return all AdvisorResults contained in this OrtResult or only the non-excluded ones if omitExcluded is true. final List<AdvisorResult>getAdvisorResultsForId(Identifier id)Return the list of AdvisorResults for the given id. final StringgetDefinitionFilePathRelativeToAnalyzerRoot(Project project)Return the path of the definition file of the project, relative to the analyzer root. final Set<Identifier>getDependencies(Identifier id, Integer maxLevel, Boolean omitExcluded)Return the dependencies of the given id (which can refer to a Project or a Package), up to and including a depth of maxLevel where counting starts at 0 (for the Project or Package itself) and 1 are direct dependencies etc. final ExcludesgetExcludes()final StringgetFilePathRelativeToAnalyzerRoot(Project project, String path)Return the path of a file contained in project, relative to the analyzer root. final Map<Identifier, Set<Issue>>getIssues()Return a map of all de-duplicated Issues associated by Identifier. final Set<String>getLabelValues(String key)Return the label values corresponding to the given key split at the delimiter ',', or an empty set if the label is absent. final List<LicenseFindingCuration>getLicenseFindingCurations(Identifier id)Return the LicenseFindingCurations associated with the given package id. final List<Issue>getOpenIssues(Severity minSeverity)Retrieve non-excluded issues which are not resolved by resolutions in the repository configuration of this OrtResult with severities equal to or over minSeverity. final Set<Package>getOrgPackages(String names, Boolean omitExcluded)Return all projects and packages that are likely to belong to one of the organizations of the given names. final CuratedPackagegetPackage(Identifier id)Return the CuratedPackage denoted by the given id. final List<SpdxLicenseChoice>getPackageLicenseChoices(Identifier id)Return all SpdxLicenseChoices for the Package with id. final CuratedPackagegetPackageOrProject(Identifier id)Return a CuratedPackage which represents either a Package if the given id corresponds to a Package, a Project if the given id corresponds to a Project or nullotherwise.final Set<CuratedPackage>getPackages(Boolean omitExcluded)Return all CuratedPackages contained in this OrtResult or only the non-excluded ones if omitExcluded is true. final ProjectgetProject(Identifier id)Return the Project denoted by the given id. final Set<Project>getProjects(Boolean omitExcluded, Boolean includeSubProjects)Return the Projects contained in this OrtResult, optionally limited to only non-excluded ones if omitExcluded is true, or to only root projects if includeSubProjects is false. final Set<Identifier>getProjectsAndPackages(Boolean includeSubProjects)Return the set of all project or package identifiers in the result, optionally including those of subprojects. final List<SpdxLicenseChoice>getRepositoryLicenseChoices()Return all SpdxLicenseChoices applicable for the scope of the whole repository. final ResolutionsgetResolutions()Return the Resolutions contained in the repository configuration of this OrtResult. final List<RuleViolation>getRuleViolations(Boolean omitResolved, Severity minSeverity)Return all RuleViolations contained in this OrtResult. final List<ScanResult>getScanResultsForId(Identifier id)Return the list of ScanResults for the given id. final Map<Identifier, List<ScanResult>>getScanResults()Return the scan results associated with the respective identifiers. final FileListgetFileListForId(Identifier id)Return the FileList for the given id. final Map<Identifier, FileList>getFileLists()Return the FileList associated with the respective identifier. final PackagegetUncuratedPackageOrProject(Identifier id)Return an uncurated Package which represents either a Package if the given id corresponds to a Package, a Project if the given id corresponds to a Project or nullotherwise.final Set<Package>getUncuratedPackages(Boolean omitExcluded)Return all uncurated Packages contained in this OrtResult or only the non-excluded ones if omitExcluded is true. final Map<Identifier, List<Vulnerability>>getVulnerabilities(Boolean omitResolved, Boolean omitExcluded)final BooleanhasLabel(String label, String value, Boolean splitValue)Return true if a label with value exists in this OrtResult. final BooleanisExcluded(Identifier id)Return trueif the project or package with the given id is excluded.final BooleanisPackageExcluded(Identifier id)Return trueif all dependencies on the package or project identified by the given id are excluded.final BooleanisProjectExcluded(Identifier id)Return trueif the Project with the given id is excluded.final BooleanisPackage(Identifier id)Return true if and only if the given id denotes a Package contained in this OrtResult. final BooleanisProject(Identifier id)Return true if and only if the given id denotes a Project contained in this OrtResult. final OrtResultreplaceConfig(RepositoryConfiguration config)Return a copy of this OrtResult with the Repository.config replaced by config. final OrtResultwithResolvedScopes()Resolves the scopes of all Projects in this OrtResult with Project.withResolvedScopes. -
-
Constructor Detail
-
OrtResult
OrtResult(Repository repository, AnalyzerRun analyzer, ScannerRun scanner, AdvisorRun advisor, EvaluatorRun evaluator, ResolvedConfiguration resolvedConfiguration, Map<String, String> labels)
-
-
Method Detail
-
getDependencyNavigator
final DependencyNavigator getDependencyNavigator()
An object that can be used to navigate the dependency information contained in this result.
-
getRepository
final Repository getRepository()
Information about the repository that was used as input.
-
getAnalyzer
final AnalyzerRun getAnalyzer()
An AnalyzerRun containing details about the analyzer that was run using repository as input. Can be null if the repository was not yet analyzed.
-
getScanner
final ScannerRun getScanner()
A ScannerRun containing details about the scanner that was run using the result from analyzer as input. Can be null if no scanner was run.
-
getAdvisor
final AdvisorRun getAdvisor()
An AdvisorRun containing details about the advisor that was run using the result from analyzer as input. Can be null if no advisor was run.
-
getEvaluator
final EvaluatorRun getEvaluator()
An EvaluatorRun containing details about the evaluation that was run using the result from scanner as input. Can be null if no evaluation was run.
-
getResolvedConfiguration
final ResolvedConfiguration getResolvedConfiguration()
A ResolvedConfiguration containing data resolved during the analysis which augments the automatically determined data.
-
getLabels
final Map<String, String> getLabels()
User defined labels associated to this result. Labels are not used by ORT itself, but can be used in parts of ORT which are customizable by the user, for example in evaluator rules or in the notice reporter.
-
getAdvisorResults
final Map<Identifier, List<AdvisorResult>> getAdvisorResults(Boolean omitExcluded)
Return all AdvisorResults contained in this OrtResult or only the non-excluded ones if omitExcluded is true.
-
getAdvisorResultsForId
final List<AdvisorResult> getAdvisorResultsForId(Identifier id)
Return the list of AdvisorResults for the given id.
-
getDefinitionFilePathRelativeToAnalyzerRoot
final String getDefinitionFilePathRelativeToAnalyzerRoot(Project project)
Return the path of the definition file of the project, relative to the analyzer root. If the project was checked out from a VCS the analyzer root is the root of the working tree, if the project was not checked out from a VCS the analyzer root is the input directory of the analyzer.
-
getDependencies
final Set<Identifier> getDependencies(Identifier id, Integer maxLevel, Boolean omitExcluded)
Return the dependencies of the given id (which can refer to a Project or a Package), up to and including a depth of maxLevel where counting starts at 0 (for the Project or Package itself) and 1 are direct dependencies etc. A value below 0 means to not limit the depth. If omitExcluded is set to true, identifiers of excluded projects / packages are omitted from the result.
-
getExcludes
final Excludes getExcludes()
-
getFilePathRelativeToAnalyzerRoot
final String getFilePathRelativeToAnalyzerRoot(Project project, String path)
Return the path of a file contained in project, relative to the analyzer root. If the project was checked out from a VCS the analyzer root is the root of the working tree, if the project was not checked out from a VCS the analyzer root is the input directory of the analyzer.
-
getIssues
final Map<Identifier, Set<Issue>> getIssues()
Return a map of all de-duplicated Issues associated by Identifier.
-
getLabelValues
final Set<String> getLabelValues(String key)
Return the label values corresponding to the given key split at the delimiter ',', or an empty set if the label is absent.
-
getLicenseFindingCurations
final List<LicenseFindingCuration> getLicenseFindingCurations(Identifier id)
Return the LicenseFindingCurations associated with the given package id.
-
getOpenIssues
final List<Issue> getOpenIssues(Severity minSeverity)
Retrieve non-excluded issues which are not resolved by resolutions in the repository configuration of this OrtResult with severities equal to or over minSeverity.
-
getOrgPackages
final Set<Package> getOrgPackages(String names, Boolean omitExcluded)
Return all projects and packages that are likely to belong to one of the organizations of the given names. If omitExcluded is set to true, excluded projects / packages are omitted from the result. Projects are converted to packages in the result. If no analyzer result is present an empty set is returned.
-
getPackage
final CuratedPackage getPackage(Identifier id)
Return the CuratedPackage denoted by the given id.
-
getPackageLicenseChoices
final List<SpdxLicenseChoice> getPackageLicenseChoices(Identifier id)
-
getPackageOrProject
final CuratedPackage getPackageOrProject(Identifier id)
Return a CuratedPackage which represents either a Package if the given id corresponds to a Package, a Project if the given id corresponds to a Project or
nullotherwise.
-
getPackages
final Set<CuratedPackage> getPackages(Boolean omitExcluded)
Return all CuratedPackages contained in this OrtResult or only the non-excluded ones if omitExcluded is true.
-
getProject
final Project getProject(Identifier id)
-
getProjects
final Set<Project> getProjects(Boolean omitExcluded, Boolean includeSubProjects)
Return the Projects contained in this OrtResult, optionally limited to only non-excluded ones if omitExcluded is true, or to only root projects if includeSubProjects is false.
-
getProjectsAndPackages
final Set<Identifier> getProjectsAndPackages(Boolean includeSubProjects)
Return the set of all project or package identifiers in the result, optionally including those of subprojects.
-
getRepositoryLicenseChoices
final List<SpdxLicenseChoice> getRepositoryLicenseChoices()
Return all SpdxLicenseChoices applicable for the scope of the whole repository.
-
getResolutions
final Resolutions getResolutions()
Return the Resolutions contained in the repository configuration of this OrtResult.
-
getRuleViolations
final List<RuleViolation> getRuleViolations(Boolean omitResolved, Severity minSeverity)
Return all RuleViolations contained in this OrtResult. Optionally exclude resolved violations with omitResolved and remove violations below the minSeverity.
-
getScanResultsForId
final List<ScanResult> getScanResultsForId(Identifier id)
Return the list of ScanResults for the given id.
-
getScanResults
final Map<Identifier, List<ScanResult>> getScanResults()
Return the scan results associated with the respective identifiers.
-
getFileListForId
final FileList getFileListForId(Identifier id)
-
getFileLists
final Map<Identifier, FileList> getFileLists()
Return the FileList associated with the respective identifier.
-
getUncuratedPackageOrProject
final Package getUncuratedPackageOrProject(Identifier id)
Return an uncurated Package which represents either a Package if the given id corresponds to a Package, a Project if the given id corresponds to a Project or
nullotherwise.
-
getUncuratedPackages
final Set<Package> getUncuratedPackages(Boolean omitExcluded)
Return all uncurated Packages contained in this OrtResult or only the non-excluded ones if omitExcluded is true.
-
getVulnerabilities
final Map<Identifier, List<Vulnerability>> getVulnerabilities(Boolean omitResolved, Boolean omitExcluded)
-
hasLabel
final Boolean hasLabel(String label, String value, Boolean splitValue)
Return true if a label with value exists in this OrtResult. If value is null the value of the label is ignored. If splitValue is true, the label value is interpreted as comma-separated list.
-
isExcluded
final Boolean isExcluded(Identifier id)
Return
trueif the project or package with the given id is excluded.If the id references a Project it is seen as excluded if the project itself is excluded and also all dependencies on this project in other projects are excluded.
If the id references a Package it is seen as excluded if all dependencies on this package are excluded.
Return
falseif there is no project or package with this id.
-
isPackageExcluded
final Boolean isPackageExcluded(Identifier id)
Return
trueif all dependencies on the package or project identified by the given id are excluded. This is the case if all Projects or Scopes that have a dependency on this id are excluded.If the id references a Project it is only checked if all dependencies on this project are excluded, not if the project itself is excluded. If you need to check that also the project itself is excluded use isExcluded instead.
Return
falseif there is no dependency on this id.
-
isProjectExcluded
final Boolean isProjectExcluded(Identifier id)
Return
trueif the Project with the given id is excluded.This function only checks if the project itself is excluded, not if another non-excluded project has a dependency on this project. If you need to check that also all dependencies on this project are excluded use isExcluded instead.
Return
falseif no project with the given id is found.
-
isPackage
final Boolean isPackage(Identifier id)
-
isProject
final Boolean isProject(Identifier id)
-
replaceConfig
final OrtResult replaceConfig(RepositoryConfiguration config)
Return a copy of this OrtResult with the Repository.config replaced by config. The package curations within the given config only take effect in case the corresponding feature was enabled during the initial creation of this OrtResult.
-
withResolvedScopes
final OrtResult withResolvedScopes()
Resolves the scopes of all Projects in this OrtResult with Project.withResolvedScopes.
-
-
-
-