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 Details

    • CycloneSpdxConverter

      public CycloneSpdxConverter​(org.cyclonedx.model.Bom cycloneBom, org.spdx.storage.IModelStore spdxModelStore)
      Parameters:
      cycloneBom - CycloneDX input BOM
      spdxModelStore - SPDX model store to store the output
  • Method Details

    • convert

      public void convert() throws CycloneConversionException
      Perform the conversion of
      Throws:
      CycloneConversionException
    • checkSetConverted

      public void checkSetConverted() throws CycloneConversionException
      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 CycloneConversionException
      Prevent 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.InvalidSPDXAnalysisException
      CycloneConversionException
    • 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

      public List<String> getWarnings()
      Returns:
      the warnings
    • getDocumentUri

      public String getDocumentUri()
      Returns:
      the documentUri
    • isConverted

      public boolean isConverted()
      Returns:
      the converted