Class SpdxDocument


  • public class SpdxDocument
    extends SpdxElement
    An SpdxDocument is a summary of the contents, provenance, ownership and licensing analysis of a specific software package. This is, effectively, the top level of SPDX information.
    Author:
    Gary O'Neall
    • Constructor Detail

      • SpdxDocument

        public SpdxDocument​(org.spdx.storage.IModelStore modelStore,
                            String documentUri,
                            org.spdx.core.IModelCopyManager copyManager,
                            boolean create)
                     throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        modelStore - Storage for the model objects
        documentUri - SPDX Document URI for the document associated with this model
        copyManager - if non-null, allows for copying of any properties set which use other model stores or document URI's
        create - - if true, the object will be created in the store if it is not already present
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • SpdxDocument

        public SpdxDocument​(String documentUri)
                     throws org.spdx.core.InvalidSPDXAnalysisException
        Obtains or creates an SPDX document using the default document store
        Parameters:
        documentUri -
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
    • Method Detail

      • getType

        public String getType()
        Specified by:
        getType in class org.spdx.core.CoreModelObject
      • getNamePropertyDescriptor

        protected org.spdx.storage.PropertyDescriptor getNamePropertyDescriptor()
        Overrides:
        getNamePropertyDescriptor in class SpdxElement
        Returns:
        the property name used for the Name property. Override this function if using a subproperty of SPDX Name
      • getDocumentDescribes

        public Collection<SpdxElement> getDocumentDescribes()
                                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        collection of items described by this SPDX document
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setDocumentDescribes

        public SpdxDocument setDocumentDescribes​(List<SpdxItem> documentDescribes)
        clear and reset document describes to the parameter collection
        Parameters:
        documentDescribes - collection of items described by this SPDX document
        Returns:
        this to chain setters
      • getCreationInfo

        @Nullable
        public SpdxCreatorInformation getCreationInfo()
                                               throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the creationInfo, null if no creationInfo in the SPDX document
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setCreationInfo

        public void setCreationInfo​(SpdxCreatorInformation creationInfo)
                             throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        creationInfo - the creationInfo to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getDataLicense

        public AnyLicenseInfo getDataLicense()
                                      throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the dataLicense
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setDataLicense

        public void setDataLicense​(AnyLicenseInfo dataLicense)
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        dataLicense - the dataLicense to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getExternalDocumentRefs

        public Collection<ExternalDocumentRef> getExternalDocumentRefs()
                                                                throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the externalDocumentRefs
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getExtractedLicenseInfos

        public Collection<ExtractedLicenseInfo> getExtractedLicenseInfos()
                                                                  throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the extractedLicenseInfos
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • addExtractedLicenseInfos

        public boolean addExtractedLicenseInfos​(ExtractedLicenseInfo licenseInfo)
        Add a license info to the collection of extracted license infos
        Parameters:
        licenseInfo -
        Returns:
      • setExtractedLicenseInfos

        public SpdxDocument setExtractedLicenseInfos​(List<ExtractedLicenseInfo> extractedLicenseInfos)
        Clear the extractedLicenseInfos and add all elements from extractedLicenseInfos
        Parameters:
        extractedLicenseInfos -
        Returns:
        this to enable chaining of sets
      • setSpecVersion

        public void setSpecVersion​(String specVersion)
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        specVersion - the specVersion to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • _verify

        protected List<String> _verify​(Set<String> verifiedIds,
                                       String verifySpecVersion)
        Description copied from class: ModelObjectV2
        Implementation of the specific verifications for this model object
        Overrides:
        _verify in class SpdxElement
        Parameters:
        verifiedIds - list of all Element Id's which have already been verified - prevents infinite recursion
        verifySpecVersion - Version of the SPDX spec to verify against
        Returns:
        Any verification errors or warnings associated with this object
      • setExternalDocumentRefs

        public SpdxDocument setExternalDocumentRefs​(Collection<ExternalDocumentRef> externalDocumentRefs)
        Clear the externalDocumentRefs and add all elements from externalDocumentRefs
        Parameters:
        externalDocumentRefs -
        Returns:
        this to enable chaining of sets