Class ExternalExtractedLicenseInfo

  • All Implemented Interfaces:
    Comparable<AbstractExtractedLicenseInfo>, org.spdx.core.IndividualUriValue

    public class ExternalExtractedLicenseInfo
    extends AbstractExtractedLicenseInfo
    implements org.spdx.core.IndividualUriValue
    This class represents an ExtractedLicenseInfo which is stored in an external SPDX document. Note that the actual properties for this ExtractedLicenseInfo is in an external document so it is not accessible through this class. The set methods will cause an exception. The getExtractedText() will return text that indicates the actual license text is in an external document. NOTE that this implementation is different from the previous major version of the SPDX Library. The documentUri is the documentUri where the extractedLicenseRef can be found. The ID is the ID for the LicenseRef in the external document.
    Author:
    Gary O'Neall
    • Constructor Detail

      • ExternalExtractedLicenseInfo

        public ExternalExtractedLicenseInfo​(String documentUri,
                                            String id)
                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        documentUri - Document URI for the EXTERNAL document
        id - ID used in the EXTERNAL document
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException - on error generating object
      • ExternalExtractedLicenseInfo

        public ExternalExtractedLicenseInfo​(org.spdx.storage.IModelStore modelStore,
                                            String documentUri,
                                            String id,
                                            @Nullable
                                            org.spdx.core.IModelCopyManager copyManager,
                                            boolean create)
                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        modelStore - Store to be used to store the external reference
        documentUri - Document URI for the EXTERNAL document
        id - ID used in the EXTERNAL document
        copyManager - to be used
        create - this parameter is ignored since it is external
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException - on error generating object
      • ExternalExtractedLicenseInfo

        public ExternalExtractedLicenseInfo​(org.spdx.storage.IModelStore modelStore,
                                            String documentUri,
                                            String id,
                                            @Nullable
                                            org.spdx.core.IModelCopyManager copyManager)
                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        modelStore - Store to be used to store the external reference
        documentUri - Document URI for the EXTERNAL document
        id - ID used in the EXTERNAL document
        copyManager - to be used
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException - on error generating object
    • Method Detail

      • isExternal

        public boolean isExternal()
        Overrides:
        isExternal in class org.spdx.core.CoreModelObject
      • getExternalDocumentId

        public String getExternalDocumentId()
                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        external document ID for the external reference
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getExternalLicenseRef

        public String getExternalLicenseRef()
                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        element ID used in the external document
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getType

        public String getType()
        Specified by:
        getType in class org.spdx.core.CoreModelObject
      • _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
      • getExternalExtractedLicenseURI

        public String getExternalExtractedLicenseURI()
                                              throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the URI associated with this external SPDX Extracted License
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • externalExtractedLicenseIdToURI

        public static String externalExtractedLicenseIdToURI​(String externalExtractedLicenseId,
                                                             org.spdx.storage.IModelStore stModelStore,
                                                             String stDocumentUri,
                                                             org.spdx.core.IModelCopyManager copyManager)
                                                      throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        externalExtractedLicenseId - id of the form documentRef:id
        stModelStore - model store
        stDocumentUri - document URI for the document which is referring to the external license
        copyManager - copyManager to use
        Returns:
        The URI associated with the external LicenseRef with the ID externalLicenseRefId
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException - on SPDX error
      • uriToExternalExtractedLicenseRef

        public static String uriToExternalExtractedLicenseRef​(String uri,
                                                              org.spdx.storage.IModelStore stModelStore,
                                                              String stDocumentUri,
                                                              org.spdx.core.IModelCopyManager copyManager,
                                                              String specVersion)
                                                       throws org.spdx.core.InvalidSPDXAnalysisException
        Convert a URI to an ID for an External Extracted License
        Parameters:
        uri - URI with the external document namespace and the external Extracted License in the form namespace#LicenseRef-XXXX
        stModelStore -
        stDocumentUri -
        copyManager - if non-null, create the external doc ref if it is not already in the ModelStore
        specVersion - - version of the SPDX spec the object complies with
        Returns:
        external SPDX element ID in the form DocumentRef-XX:LicenseRef-XXXX
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • referenceElementId

        public String referenceElementId​(SpdxDocument documentReferencingExternal)
                                  throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        documentReferencingExternal - document containing the external reference
        Returns:
        external document ID for the external reference
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • equivalent

        public boolean equivalent​(org.spdx.core.CoreModelObject compare)
        Overrides:
        equivalent in class org.spdx.core.CoreModelObject
      • equivalent

        public boolean equivalent​(org.spdx.core.CoreModelObject compare,
                                  boolean ignoreRelatedElements)
                           throws org.spdx.core.InvalidSPDXAnalysisException
        Overrides:
        equivalent in class org.spdx.core.CoreModelObject
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getIndividualURI

        public String getIndividualURI()
        Specified by:
        getIndividualURI in interface org.spdx.core.IndividualUriValue
      • getComment

        public String getComment()
                          throws org.spdx.core.InvalidSPDXAnalysisException
        Overrides:
        getComment in class SimpleLicensingInfo
        Returns:
        the comments
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setComment

        public void setComment​(String comment)
                        throws org.spdx.core.InvalidSPDXAnalysisException
        Overrides:
        setComment in class SimpleLicensingInfo
        Parameters:
        comment - the comment to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getSeeAlso

        public Collection<String> getSeeAlso()
                                      throws org.spdx.core.InvalidSPDXAnalysisException
        Overrides:
        getSeeAlso in class SimpleLicensingInfo
        Returns:
        the urls which reference the same license information
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setSeeAlso

        public void setSeeAlso​(Collection<String> seeAlsoUrl)
                        throws org.spdx.core.InvalidSPDXAnalysisException
        Overrides:
        setSeeAlso in class SimpleLicensingInfo
        Parameters:
        seeAlsoUrl - the urls which are references to the same license to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getName

        public String getName()
                       throws org.spdx.core.InvalidSPDXAnalysisException
        Overrides:
        getName in class SimpleLicensingInfo
        Returns:
        the name
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setName

        public void setName​(String name)
                     throws org.spdx.core.InvalidSPDXAnalysisException
        Overrides:
        setName in class SimpleLicensingInfo
        Parameters:
        name - the name to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException