Package org.spdx.merge
Class SpdxLicenseMapper
java.lang.Object
org.spdx.merge.SpdxLicenseMapper
public class SpdxLicenseMapper extends Object
- Author:
- Gary
-
Constructor Summary
Constructors Constructor Description SpdxLicenseMapper() -
Method Summary
Modifier and Type Method Description voidclearNonStdLicIdMap()booleandocInNonStdLicIdMap(SpdxDocument spdxDoc)Map<AnyLicenseInfo,AnyLicenseInfo>foundInterMap(SpdxDocument spdxDoc)booleanisNonStdLicIdMapEmpty()AnyLicenseInfomapLicenseInfo(SpdxDocument spdxDoc, AnyLicenseInfo license)a method gets a sub SPDX document and licenses from declared licenses in document package.AnyLicenseInfomapNonStdLicInMap(SpdxDocument spdxDoc, AnyLicenseInfo license)a method gets a sub SPDX document and one of its license (non-standard license).voidmappingExistingNonStdLic(SpdxDocument output, ExtractedLicenseInfo outputDocLicense, SpdxDocument subDocs, ExtractedLicenseInfo subLicense)Maps a subDoc nonstandard license to an existing output document nonstandard licenseExtractedLicenseInfomappingNewNonStdLic(SpdxDocument outputDoc, SpdxDocument subDoc, ExtractedLicenseInfo subNonStdLicInfo)Creates a new non-standard license in the outputDoc and creates a mapping between the output document non-standard license and the subDoc non standard license This particular non-standard license is unique to the outputDoc document.SpdxFilereplaceNonStdLicInFile(SpdxDocument spdxDoc, SpdxFile subFileInfo)a method gets a sub SPDX document and its file information.
-
Constructor Details
-
SpdxLicenseMapper
public SpdxLicenseMapper()
-
-
Method Details
-
mappingNewNonStdLic
public ExtractedLicenseInfo mappingNewNonStdLic(SpdxDocument outputDoc, SpdxDocument subDoc, ExtractedLicenseInfo subNonStdLicInfo)Creates a new non-standard license in the outputDoc and creates a mapping between the output document non-standard license and the subDoc non standard license This particular non-standard license is unique to the outputDoc document. The return variable subNonStdLicInfo is cloned from input non-standard license, but replace the license id.- Parameters:
outputDoc-subDoc-subNonStdLicInfo-- Returns:
-
mappingExistingNonStdLic
public void mappingExistingNonStdLic(SpdxDocument output, ExtractedLicenseInfo outputDocLicense, SpdxDocument subDocs, ExtractedLicenseInfo subLicense)Maps a subDoc nonstandard license to an existing output document nonstandard license- Parameters:
output-subDocs-subLicense-outputDocLicense-
-
replaceNonStdLicInFile
public SpdxFile replaceNonStdLicInFile(SpdxDocument spdxDoc, SpdxFile subFileInfo) throws InvalidSPDXAnalysisExceptiona method gets a sub SPDX document and its file information. Check the non-standard licenses in the file information. Replace the non-standard licenses if this particular license in the HashMap.- Parameters:
spdxDoc-subFileInfo-- Returns:
- Throws:
InvalidSPDXAnalysisException
-
mapNonStdLicInMap
a method gets a sub SPDX document and one of its license (non-standard license). Replace the input license if it is found in the HashMap. And return the mapped license. If the input license doesn't in the HashMap, return the original input license.- Parameters:
spdxDoc-license-- Returns:
-
mapLicenseInfo
a method gets a sub SPDX document and licenses from declared licenses in document package. Check the object type of input license. If the license is non-standard license, run the license through mapNonStdLicIndMap. Otherwise, return the original input license.- Parameters:
spdxDoc-license-- Returns:
-
docInNonStdLicIdMap
- Parameters:
spdxDoc-- Returns:
- foundDocMatch
-
foundInterMap
- Parameters:
spdxDoc-- Returns:
- idMap
-
isNonStdLicIdMapEmpty
public boolean isNonStdLicIdMapEmpty()- Returns:
- emptyMap
-
clearNonStdLicIdMap
public void clearNonStdLicIdMap()
-