Class ExternalDocumentRef

  • All Implemented Interfaces:
    Comparable<ExternalDocumentRef>, org.spdx.core.IExternalElementInfo

    public class ExternalDocumentRef
    extends ModelObjectV2
    implements Comparable<ExternalDocumentRef>, org.spdx.core.IExternalElementInfo
    Information about an external SPDX document reference including the checksum. This allows for verification of the external references.
    Author:
    Gary O'Neall
    • Constructor Detail

      • ExternalDocumentRef

        public ExternalDocumentRef()
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Default model store, copy manager, and document URI
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • ExternalDocumentRef

        public ExternalDocumentRef​(String id)
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        id - identifier
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • ExternalDocumentRef

        public ExternalDocumentRef​(org.spdx.storage.IModelStore modelStore,
                                   String documentUri,
                                   String id,
                                   @Nullable
                                   org.spdx.core.IModelCopyManager copyManager,
                                   boolean create)
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        modelStore - Storage for the model objects
        documentUri - SPDX Document URI for a document associated with this model
        id - for the object - must be unique within the SPDX store and must match the pattern for the external document reference
        copyManager - - if supplied, model objects will be implicitly copied into this model store and document URI when referenced by setting methods
        create - - if true, the object will be created in the store if it is not already present
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
    • Method Detail

      • getExternalDocRefByDocNamespace

        public static Optional<ExternalDocumentRef> getExternalDocRefByDocNamespace​(org.spdx.storage.IModelStore stModelStore,
                                                                                    String stDocumentUri,
                                                                                    String externalDocUri,
                                                                                    @Nullable
                                                                                    org.spdx.core.IModelCopyManager copyManager,
                                                                                    String specVersion)
                                                                             throws org.spdx.core.InvalidSPDXAnalysisException
        Obtain an ExternalDocumentRef which maps to the document URI for the external SPDX document.
        Parameters:
        stModelStore - Model Store for the document referring to the external SPDX document
        stDocumentUri - Document URI for the document referring to the external SPDX document
        externalDocUri - Document URI for the external document (a.k.a. eternalDocumentNamespace)
        copyManager - if non-null, create the external Doc ref if it is not a property of the SPDX Document
        specVersion - - version of the SPDX spec the object complies with
        Returns:
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getType

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

        public Optional<Checksum> getChecksum()
                                       throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the checksum
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setChecksum

        public ExternalDocumentRef setChecksum​(Checksum checksum)
                                        throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        checksum - the checksum to set
        Returns:
        this to chain setters
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getSpdxDocumentNamespace

        public String getSpdxDocumentNamespace()
                                        throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the spdxDocumentNamespace or empty string if no namespace
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setSpdxDocumentNamespace

        public ExternalDocumentRef setSpdxDocumentNamespace​(String documentNamespace)
                                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Set the document namespace
        Parameters:
        documentNamespace -
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getSpdxDocument

        public Optional<SpdxDocument> getSpdxDocument()
                                               throws org.spdx.core.InvalidSPDXAnalysisException
        Returns the SPDX document if it exists within the same model store, otherwise it returns Optional.empty
        Returns:
        the spdxDocument
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setSpdxDocument

        public ExternalDocumentRef setSpdxDocument​(SpdxDocument spdxDocument)
                                            throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        spdxDocument - the spdxDocument to set
        Returns:
        this to chain setters
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • _verify

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