Package org.spdx.cdx2spdx
Class CycloneSpdxConverter
java.lang.Object
org.spdx.cdx2spdx.CycloneSpdxConverter
public class CycloneSpdxConverter extends Object
- Author:
- Gary O'Neall
Primary class used to convert from a CycloneDX BOM to an SPDX Document
The
convert()method performs the actual conversion
-
Constructor Summary
Constructors Constructor Description CycloneSpdxConverter(org.cyclonedx.model.Bom cycloneBom, org.spdx.storage.IModelStore spdxModelStore) -
Method Summary
Modifier and Type Method Description voidcheckSetConverted()Checks to see if the the BOM has already been converted and sets the converted flagvoidconvert()Perform the conversion oforg.spdx.library.ModelCopyManagergetCopyManager()org.cyclonedx.model.BomgetCycloneBom()StringgetDocumentUri()org.spdx.storage.IModelStoregetSpdxModelStore()List<String>getWarnings()booleanisConverted()protected voidretainFidelity(org.spdx.library.model.SpdxElement spdxElement, String cycloneDxPropertyName, Object cycloneDxPropertyValue, List<String> warnings)Prevent a loss of fidelity by adding to the warnings creating an annotation with enough information to recreate the CycloneDX property and value.
-
Constructor Details
-
CycloneSpdxConverter
public CycloneSpdxConverter(org.cyclonedx.model.Bom cycloneBom, org.spdx.storage.IModelStore spdxModelStore)- Parameters:
cycloneBom- CycloneDX input BOMspdxModelStore- SPDX model store to store the output
-
-
Method Details
-
convert
Perform the conversion of- Throws:
CycloneConversionException
-
checkSetConverted
Checks to see if the the BOM has already been converted and sets the converted flag- Throws:
CycloneConversionException- thrown if the BOM has already been converted
-
retainFidelity
protected void retainFidelity(org.spdx.library.model.SpdxElement spdxElement, String cycloneDxPropertyName, Object cycloneDxPropertyValue, List<String> warnings) throws CycloneConversionExceptionPrevent a loss of fidelity by adding to the warnings creating an annotation with enough information to recreate the CycloneDX property and value. The annotation format is:MISSING_CDX_PROPERTY:[propertyName]=[propertyValue] where propertyName is the name of the CycloneDX property and the value is the JSON string representation of the value- Parameters:
spdxElement-warnings-- Throws:
org.spdx.library.InvalidSPDXAnalysisExceptionCycloneConversionException
-
getCycloneBom
public org.cyclonedx.model.Bom getCycloneBom()- Returns:
- the cycloneBom
-
getSpdxModelStore
public org.spdx.storage.IModelStore getSpdxModelStore()- Returns:
- the spdxModelStore
-
getCopyManager
public org.spdx.library.ModelCopyManager getCopyManager()- Returns:
- the copyManager
-
getWarnings
- Returns:
- the warnings
-
getDocumentUri
- Returns:
- the documentUri
-
isConverted
public boolean isConverted()- Returns:
- the converted
-