Package org.spdx.utility.compare
Class SpdxPackageComparer
- java.lang.Object
-
- org.spdx.utility.compare.SpdxItemComparer
-
- org.spdx.utility.compare.SpdxPackageComparer
-
public class SpdxPackageComparer extends SpdxItemComparer
Compares two SPDX package. Thecompare(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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDocumentPackage(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 void
checkInProgress()
checks to make sure there is not a compare in progressorg.spdx.library.model.v2.SpdxPackage
getDocPackage(org.spdx.library.model.v2.SpdxDocument document)
Return the package associated with the documentList<SpdxExternalRefDifference>
getExternalRefDifferences(org.spdx.library.model.v2.SpdxDocument docA, org.spdx.library.model.v2.SpdxDocument docB)
List<SpdxFileDifference>
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 docBint
getNumPackages()
String
getPackageName()
List<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 docBboolean
isDeclaredLicensesEquals()
boolean
isDifferenceFound()
boolean
isExternalRefsEquals()
boolean
isFilesAnalyzedEquals()
boolean
isInProgress()
boolean
isPackageChecksumsEquals()
boolean
isPackageDescriptionsEquals()
boolean
isPackageDownloadLocationsEquals()
boolean
isPackageFilenamesEquals()
boolean
isPackageFilesEquals()
boolean
isPackageHomePagesEquals()
boolean
isPackageOriginatorsEqual()
boolean
isPackageSourceInfosEquals()
boolean
isPackageSummaryEquals()
boolean
isPackageSuppliersEquals()
boolean
isPackageVerificationCodesEquals()
boolean
isPackageVersionsEquals()
-
Methods inherited from class org.spdx.utility.compare.SpdxItemComparer
addDocumentItem, checkCompareMade, getItem, getUniqueAnnotations, getUniqueRelationship, getUniqueSeenLicenses, isAnnotationsEquals, isAttributionTextEquals, isCommentsEquals, isConcludedLicenseEquals, isCopyrightsEquals, isLicenseCommmentsEquals, isRelationshipsEquals, isSeenLicenseEquals
-
-
-
-
Constructor Detail
-
SpdxPackageComparer
public SpdxPackageComparer(Map<org.spdx.library.model.v2.SpdxDocument,Map<org.spdx.library.model.v2.SpdxDocument,Map<String,String>>> extractedLicenseIdMap)
- Parameters:
extractedLicenseIdMap
- map of all extracted license IDs for any SPDX documents to be added to the comparer
-
-
Method Detail
-
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
org.spdx.core.InvalidSPDXAnalysisException
-
isInProgress
public boolean isInProgress()
- Overrides:
isInProgress
in classSpdxItemComparer
- Returns:
- the inProgress
-
isDifferenceFound
public boolean isDifferenceFound() throws SpdxCompareException
- Overrides:
isDifferenceFound
in classSpdxItemComparer
- Returns:
- the differenceFound
- Throws:
SpdxCompareException
-
checkInProgress
protected void checkInProgress() throws SpdxCompareException
checks to make sure there is not a compare in progress- Overrides:
checkInProgress
in classSpdxItemComparer
- Throws:
SpdxCompareException
-
isPackageVersionsEquals
public boolean isPackageVersionsEquals() throws SpdxCompareException
- Returns:
- the packageVersionsEquals
- Throws:
SpdxCompareException
-
isPackageFilenamesEquals
public boolean isPackageFilenamesEquals() throws SpdxCompareException
- Returns:
- the packageFilenamesEquals
- Throws:
SpdxCompareException
-
isPackageSuppliersEquals
public boolean isPackageSuppliersEquals() throws SpdxCompareException
- Returns:
- the packageSuppliersEquals
- Throws:
SpdxCompareException
-
isPackageDownloadLocationsEquals
public boolean isPackageDownloadLocationsEquals() throws SpdxCompareException
- Returns:
- the packageDownloadLocationsEquals
- Throws:
SpdxCompareException
-
isPackageVerificationCodesEquals
public boolean isPackageVerificationCodesEquals() throws SpdxCompareException
- Returns:
- the packageVerificationCodeesEquals
- Throws:
SpdxCompareException
-
isFilesAnalyzedEquals
public boolean isFilesAnalyzedEquals() throws SpdxCompareException
- Returns:
- the filesAnalyzedEquals
- Throws:
SpdxCompareException
-
isPackageChecksumsEquals
public boolean isPackageChecksumsEquals() throws SpdxCompareException
- Returns:
- the packageChecksumsEquals
- Throws:
SpdxCompareException
-
isPackageSourceInfosEquals
public boolean isPackageSourceInfosEquals() throws SpdxCompareException
- Returns:
- the packageSourceInfosEquals
- Throws:
SpdxCompareException
-
isDeclaredLicensesEquals
public boolean isDeclaredLicensesEquals() throws SpdxCompareException
- Returns:
- the declaredLicensesEquals
- Throws:
SpdxCompareException
-
isPackageSummaryEquals
public boolean isPackageSummaryEquals() throws SpdxCompareException
- Returns:
- the packageSummaryEquals
- Throws:
SpdxCompareException
-
isPackageDescriptionsEquals
public boolean isPackageDescriptionsEquals() throws SpdxCompareException
- Returns:
- the packageDescriptionsEquals
- Throws:
SpdxCompareException
-
isPackageOriginatorsEqual
public boolean isPackageOriginatorsEqual() throws SpdxCompareException
- Returns:
- the packageOriginatorsEqual
- Throws:
SpdxCompareException
-
isPackageHomePagesEquals
public boolean isPackageHomePagesEquals() throws SpdxCompareException
- Returns:
- the packageHomePagesEquals
- Throws:
SpdxCompareException
-
isExternalRefsEquals
public boolean isExternalRefsEquals() throws SpdxCompareException
- Returns:
- the externalRefsEquals
- Throws:
SpdxCompareException
-
getDocPackage
public org.spdx.library.model.v2.SpdxPackage getDocPackage(org.spdx.library.model.v2.SpdxDocument document) throws SpdxCompareException
Return the package associated with the document- Parameters:
document
-- Returns:
- The document associated with the document
- Throws:
SpdxCompareException
-
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
public boolean isPackageFilesEquals() throws SpdxCompareException
- 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
-docB
-- Returns:
- 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
-docB
-- Returns:
- Throws:
SpdxCompareException
-
getPackageName
public String getPackageName() throws SpdxCompareException
- Returns:
- Throws:
SpdxCompareException
-
getNumPackages
public int getNumPackages() throws SpdxCompareException
- Returns:
- Throws:
SpdxCompareException
-
-