Class SpdxPackageComparer
java.lang.Object
org.spdx.utility.compare.SpdxItemComparer
org.spdx.utility.compare.SpdxPackageComparer
Compares two SPDX package.
The compare(pkgA, pkgB) method will perform the comparison and
store the results. isDifferenceFound() will return true of any
differences were found.
- Author:
- Gary O'Neall
-
Field Summary
Fields inherited from class org.spdx.utility.compare.SpdxItemComparer
documentItem, extractedLicenseIdMap, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocumentPackage(org.spdx.library.model.v2.SpdxDocument spdxDocument, org.spdx.library.model.v2.SpdxPackage spdxPackage) Add a package to the comparer and performs the comparison to any existing documentsprotected voidchecks to make sure there is not a compare in progressorg.spdx.library.model.v2.SpdxPackagegetDocPackage(org.spdx.library.model.v2.SpdxDocument document) Return the package associated with the documentgetExternalRefDifferences(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) getFileDifferences(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Get any fileDifferences which are in docA but not in docBintList<org.spdx.library.model.v2.Checksum> getUniqueChecksums(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Get the checksums which are present in document A but not in document BList<org.spdx.library.model.v2.ExternalRef> getUniqueExternalRefs(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) List<org.spdx.library.model.v2.SpdxFile> getUniqueFiles(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) Return any unique files by name which are in docA but not in docBbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanMethods inherited from class org.spdx.utility.compare.SpdxItemComparer
addDocumentItem, checkCompareMade, getItem, getUniqueAnnotations, getUniqueRelationship, getUniqueSeenLicenses, isAnnotationsEquals, isAttributionTextEquals, isCommentsEquals, isConcludedLicenseEquals, isCopyrightsEquals, isLicenseCommentsEquals, isLicenseCommmentsEquals, isRelationshipsEquals, isSeenLicenseEquals
-
Constructor Details
-
SpdxPackageComparer
-
-
Method Details
-
addDocumentPackage
public void addDocumentPackage(org.spdx.library.model.v2.SpdxDocument spdxDocument, org.spdx.library.model.v2.SpdxPackage spdxPackage) throws SpdxCompareException, org.spdx.core.InvalidSPDXAnalysisException Add a package to the comparer and performs the comparison to any existing documents- Parameters:
spdxDocument- document containing the packagespdxPackage- packaged to be added- Throws:
SpdxCompareException- on compare errorsorg.spdx.core.InvalidSPDXAnalysisException- on SPDX parsing errors
-
isInProgress
public boolean isInProgress()- Overrides:
isInProgressin classSpdxItemComparer- Returns:
- the inProgress
-
isDifferenceFound
- Overrides:
isDifferenceFoundin classSpdxItemComparer- Returns:
- the differenceFound
- Throws:
SpdxCompareException- on compare errors
-
checkInProgress
checks to make sure there is not a compare in progress- Overrides:
checkInProgressin classSpdxItemComparer- Throws:
SpdxCompareException- on compare errors
-
isPackageVersionsEquals
- Returns:
- the packageVersionsEquals
- Throws:
SpdxCompareException- on compare errors
-
isPackageFilenamesEquals
- Returns:
- the packageFilenamesEquals
- Throws:
SpdxCompareException
-
isPackageSuppliersEquals
- Returns:
- the packageSuppliersEquals
- Throws:
SpdxCompareException
-
isPackageDownloadLocationsEquals
- Returns:
- the packageDownloadLocationsEquals
- Throws:
SpdxCompareException
-
isPackageVerificationCodesEquals
- Returns:
- the packageVerificationCodesEquals
- Throws:
SpdxCompareException
-
isFilesAnalyzedEquals
- Returns:
- the filesAnalyzedEquals
- Throws:
SpdxCompareException- on compare errors
-
isPackageChecksumsEquals
- Returns:
- the packageChecksumsEquals
- Throws:
SpdxCompareException
-
isPackageSourceInfosEquals
- Returns:
- the packageSourceInfosEquals
- Throws:
SpdxCompareException
-
isDeclaredLicensesEquals
- Returns:
- the declaredLicensesEquals
- Throws:
SpdxCompareException
-
isPackageSummaryEquals
- Returns:
- the packageSummaryEquals
- Throws:
SpdxCompareException
-
isPackageDescriptionsEquals
- Returns:
- the packageDescriptionsEquals
- Throws:
SpdxCompareException
-
isPackageOriginatorsEqual
- Returns:
- the packageOriginatorsEqual
- Throws:
SpdxCompareException
-
isPackageHomePagesEquals
- Returns:
- the packageHomePagesEquals
- Throws:
SpdxCompareException
-
isExternalRefsEquals
- Returns:
- the externalRefsEquals
- Throws:
SpdxCompareException- on compare errors
-
getDocPackage
public org.spdx.library.model.v2.SpdxPackage getDocPackage(org.spdx.library.model.v2.SpdxDocument document) Return the package associated with the document- Parameters:
document- document- Returns:
- The package associated with the document
-
getUniqueChecksums
public List<org.spdx.library.model.v2.Checksum> getUniqueChecksums(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException Get the checksums which are present in document A but not in document B- Returns:
- the uniqueChecksums
- Throws:
SpdxCompareException
-
getUniqueExternalRefs
public List<org.spdx.library.model.v2.ExternalRef> getUniqueExternalRefs(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException - Throws:
SpdxCompareException
-
getExternalRefDifferences
public List<SpdxExternalRefDifference> getExternalRefDifferences(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException - Throws:
SpdxCompareException
-
isPackageFilesEquals
- Returns:
- the packageFilesEquals
- Throws:
SpdxCompareException
-
getFileDifferences
public List<SpdxFileDifference> getFileDifferences(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException Get any fileDifferences which are in docA but not in docB- Parameters:
docA- A document to comparedocB- B document compare- Returns:
- any fileDifferences which are in docA but not in docB
- Throws:
SpdxCompareException
-
getUniqueFiles
public List<org.spdx.library.model.v2.SpdxFile> getUniqueFiles(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB) throws SpdxCompareException Return any unique files by name which are in docA but not in docB- Parameters:
docA- A document to comparedocB- B document compare- Returns:
- any unique files by name which are in docA but not in docB
- Throws:
SpdxCompareException
-
getPackageName
- Returns:
- package name
- Throws:
SpdxCompareException
-
getNumPackages
- Returns:
- number of package
- Throws:
SpdxCompareException- on compare errors
-