Class License

  • Direct Known Subclasses:
    SpdxListedLicense

    public abstract class License
    extends SimpleLicensingInfo
    Describes a license All licenses have an ID. Subclasses should extend this class to add additional properties.
    Author:
    Gary O'Neall
    • Constructor Detail

      • License

        public License​(String id)
                throws org.spdx.core.InvalidSPDXAnalysisException
        Open or create a model object with the default store and default document URI
        Parameters:
        id - ID for this object - must be unique within the SPDX document
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
    • Method Detail

      • getLicenseText

        public String getLicenseText()
                              throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the text of the license
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setLicenseText

        public void setLicenseText​(String text)
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        text - the license text to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getStandardLicenseHeader

        public String getStandardLicenseHeader()
                                        throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the standardLicenseHeader
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getStandardLicenseHeaderTemplate

        public String getStandardLicenseHeaderTemplate()
                                                throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        standard license header template
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setStandardLicenseHeaderTemplate

        public void setStandardLicenseHeaderTemplate​(String standardLicenseHeaderTemplate)
                                              throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        standardLicenseHeaderTemplate -
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setStandardLicenseHeader

        public void setStandardLicenseHeader​(String standardLicenseHeader)
                                      throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        standardLicenseHeader - the standardLicenseHeader to set
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getStandardLicenseTemplate

        public String getStandardLicenseTemplate()
                                          throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        the template
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setStandardLicenseTemplate

        public void setStandardLicenseTemplate​(String template)
                                        throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        template - the template to set
        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
      • isFsfLibre

        public boolean isFsfLibre()
                           throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        true if FSF describes the license as free / libre, false if FSF describes the license as not free / libre or if FSF does not reference the license
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
        org.spdx.core.InvalidSPDXAnalysisException
      • isNotFsfLibre

        public boolean isNotFsfLibre()
                              throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        true if FSF specified this license as not free/libre, false if it has been specified by the FSF as free / libre or if it has not been specified
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getFsfLibre

        public Boolean getFsfLibre()
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        true if FSF describes the license as free / libre, false if FSF describes the license as not free / libre, null if FSF does not reference the license
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • isOsiApproved

        public boolean isOsiApproved()
                              throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        true if the license is listed as an approved license on the OSI website
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • isDeprecated

        public boolean isDeprecated()
                             throws org.spdx.core.InvalidSPDXAnalysisException
        Returns:
        true if this license is marked as being deprecated
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setOsiApproved

        public void setOsiApproved​(Boolean osiApproved)
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setFsfLibre

        public void setFsfLibre​(Boolean fsfLibre)
                         throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        fsfLibre - true if FSF describes the license as free / libre, false if FSF describes the license as not free / libre, null if FSF does not reference the license
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setDeprecated

        public void setDeprecated​(Boolean deprecated)
                           throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        deprecated - true if this license is deprecated
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • updateSetDeprecated

        public org.spdx.storage.IModelStore.ModelUpdate updateSetDeprecated​(Boolean deprecated)
                                                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Parameters:
        deprecated -
        Returns:
        a ModelUpdate that can be applied through the ModelObjectV2
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException