Package org.spdx.merge
Class SpdxPackageInfoMerger
java.lang.Object
org.spdx.merge.SpdxPackageInfoMerger
public class SpdxPackageInfoMerger extends Object
Application to merge package information from input SPDX documents and file information merging result.
- Author:
- Gang Ling
-
Constructor Summary
Constructors Constructor Description SpdxPackageInfoMerger(List<SpdxPackage> masterPackagesInfo, SpdxDocument[] subDocs, SpdxLicenseMapper mapper) -
Method Summary
Modifier and Type Method Description AnyLicenseInfo[]checkLicenseFromFile(SpdxDocument doc, SpdxPackage temp)A method to check license from file information through mapLicenseInfo function.List<SpdxPackage>clonePackages(List<SpdxPackage> packagesList)A method to clone the packages in the listString[]collectSkippedFiles(SpdxPackage main, SpdxPackage sub)A method to collect all skipped files from input SPDX package.AnyLicenseInfolicsCombiner(AnyLicenseInfo lic1, AnyLicenseInfo lic2)A method to combine two licenses into oneList<SpdxPackage>mergePackagesInfo(SpdxFile[] fileMergeResult)A method to merge all packages' information from sub list documents into master documentStringstringCombiner(String line1, String line2)A method to combine two string variables into one stringStringtranslateSubDelcaredLicsIntoComments(SpdxDocument[] subDocs)Deprecated.
-
Constructor Details
-
SpdxPackageInfoMerger
public SpdxPackageInfoMerger(List<SpdxPackage> masterPackagesInfo, SpdxDocument[] subDocs, SpdxLicenseMapper mapper)- Parameters:
masterPackagesInfo-subDocs-
-
-
Method Details
-
mergePackagesInfo
public List<SpdxPackage> mergePackagesInfo(SpdxFile[] fileMergeResult) throws InvalidSPDXAnalysisException, NoSuchAlgorithmException, InvalidLicenseStringExceptionA method to merge all packages' information from sub list documents into master document- Parameters:
subDocs-fileMergeResult-- Returns:
- packagesResult
- Throws:
InvalidSPDXAnalysisExceptionNoSuchAlgorithmExceptionInvalidLicenseStringException
-
checkLicenseFromFile
A method to check license from file information through mapLicenseInfo function. If it is a non-standard license, check this particular license in the Mapper class. Replace the current license value with the return value from the mapNonStdLicInMap method. After all, all the declared license should remain the same and non-standard license should replaced with updated id- Parameters:
doc-temp-- Returns:
- licFromFile
-
clonePackages
A method to clone the packages in the list- Parameters:
packagesArray-- Returns:
- clonedPackagesArray
-
stringCombiner
A method to combine two string variables into one string- Parameters:
line1-line2-- Returns:
-
licsCombiner
public AnyLicenseInfo licsCombiner(AnyLicenseInfo lic1, AnyLicenseInfo lic2) throws InvalidLicenseStringExceptionA method to combine two licenses into one- Parameters:
lic1-lic2-- Returns:
- Throws:
InvalidLicenseStringException
-
collectSkippedFiles
public String[] collectSkippedFiles(SpdxPackage main, SpdxPackage sub) throws InvalidSPDXAnalysisExceptionA method to collect all skipped files from input SPDX package.- Returns:
- excludedFileNamesArray
- Throws:
InvalidSPDXAnalysisException
-
translateSubDelcaredLicsIntoComments
@Deprecated public String translateSubDelcaredLicsIntoComments(SpdxDocument[] subDocs) throws InvalidSPDXAnalysisExceptionDeprecated.- Throws:
InvalidSPDXAnalysisException
-