Package org.spdx.library.model.license
Class SpdxListedLicense
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.license.AnyLicenseInfo
org.spdx.library.model.license.SimpleLicensingInfo
org.spdx.library.model.license.License
org.spdx.library.model.license.SpdxListedLicense
public class SpdxListedLicense extends License
Listed license for SPDX as listed at spdx.org/licenses
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpdxListedLicense.Builder -
Field Summary
-
Constructor Summary
Constructors Constructor Description SpdxListedLicense(String id)Open or create a model object with the default store and default document URISpdxListedLicense(String name, String id, String text, Collection<String> sourceUrl, String comments, String standardLicenseHeader, String template, boolean osiApproved, Boolean fsfLibre, String licenseTextHtml, boolean isDeprecated, String deprecatedVersion)SpdxListedLicense(SpdxListedLicense.Builder builder)SpdxListedLicense(IModelStore modelStore, String documentUri, String id, ModelCopyManager copyManager, boolean create)Create a new SPDX Listed License object -
Method Summary
Modifier and Type Method Description protected List<String>_verify(Set<String> verifiedIds, String specVersion)Implementation of the specific verifications for this model objectbooleanequals(Object compare)booleanequivalent(ModelObject compare, boolean ignoreRelatedElements)Collection<CrossRef>getCrossRef()StringgetDeprecatedVersion()StringgetLicenseHeaderHtml()StringgetLicenseTextHtml()StringgetType()inthashCode()voidsetDeprecatedVersion(String deprecatedVersion)voidsetLicenseHeaderHtml(String licenseHeaderHtml)Set the licenseHeaderTemplateHtmlvoidsetLicenseTextHtml(String licenseTextHtml)Set the licenseTextHtmlMethods inherited from class org.spdx.library.model.license.License
getFsfLibre, getLicenseText, getStandardLicenseHeader, getStandardLicenseHeaderTemplate, getStandardLicenseTemplate, isDeprecated, isFsfLibre, isNotFsfLibre, isOsiApproved, setDeprecated, setFsfLibre, setLicenseText, setOsiApproved, setStandardLicenseHeader, setStandardLicenseHeaderTemplate, setStandardLicenseTemplate, toString, updateSetDeprecatedMethods inherited from class org.spdx.library.model.license.SimpleLicensingInfo
getComment, getLicenseId, getName, getSeeAlso, setComment, setName, setSeeAlsoMethods inherited from class org.spdx.library.model.ModelObject
addPropertyValueToCollection, addValueToCollection, clearValueCollection, clearValueCollection, clone, copyFrom, createAnnotation, createByteOffsetPointer, createChecksum, createConjunctiveLicenseSet, createCreationInfo, createCrossRef, createDisjunctiveLicenseSet, createExternalDocumentRef, createExternalRef, createLineCharPointer, createPackage, createPackageVerificationCode, createRelationship, createSpdxFile, createSpdxSnippet, createStartEndPointer, enterCriticalSection, equivalent, getAnyLicenseInfoPropertyValue, getBooleanPropertyValue, getCopyManager, getDocumentUri, getElementPropertyValue, getEnumPropertyValue, getId, getIntegerPropertyValue, getModelStore, getObjectPropertyValue, getObjectPropertyValue, getObjectPropertyValueCollection, getObjectPropertyValueSet, getPropertyValueNames, getStringCollection, getStringPropertyValue, idToIdType, isCollectionMembersAssignableTo, isStrict, leaveCriticalSection, removeProperty, removeProperty, removePropertyValueFromCollection, removePropertyValueFromCollection, replacePropertyValueCollection, setCopyManager, setPropertyValue, setPropertyValue, setStrict, toTypedValue, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verify, verifyCollection
-
Constructor Details
-
SpdxListedLicense
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:
InvalidSPDXAnalysisException
-
SpdxListedLicense
public SpdxListedLicense(IModelStore modelStore, String documentUri, String id, @Nullable ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisExceptionCreate a new SPDX Listed License object- Parameters:
modelStore- container which includes the licensedocumentUri- URI for the SPDX document containing the licenseid- identifier for the licensecopyManager- if non-null, allows for copying of any properties set which use other model stores or document URI'screate- if true, create the license if it does not exist- Throws:
InvalidSPDXAnalysisException
-
SpdxListedLicense
public SpdxListedLicense(String name, String id, String text, Collection<String> sourceUrl, String comments, String standardLicenseHeader, String template, boolean osiApproved, Boolean fsfLibre, String licenseTextHtml, boolean isDeprecated, String deprecatedVersion) throws InvalidSPDXAnalysisException- Parameters:
name- License nameid- License IDtext- License textsourceUrl- Optional URLs that reference this licensecomments- Optional commentsstandardLicenseHeader- Optional license headertemplate- Optional templateosiApproved- True if this is an OSI Approved licensefsfLibre- 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 licenselicenseTextHtml- HTML version for the license textisDeprecated- True if this license has been designated as deprecated by the SPDX legal teamdeprecatedVersion- License list version when this license was first deprecated (null if not deprecated)- Throws:
InvalidSPDXAnalysisException
-
SpdxListedLicense
- Parameters:
builder- Builder configured with desired parameters- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object -
getLicenseTextHtml
public String getLicenseTextHtml() throws InvalidLicenseTemplateException, InvalidSPDXAnalysisException- Returns:
- HTML fragment containing the License Text
- Throws:
InvalidLicenseTemplateExceptionSpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setLicenseTextHtml
Set the licenseTextHtml- Parameters:
licenseTextHtml- HTML fragment representing the license text- Throws:
InvalidSPDXAnalysisException
-
getLicenseHeaderHtml
public String getLicenseHeaderHtml() throws InvalidLicenseTemplateException, InvalidSPDXAnalysisException- Returns:
- HTML fragment containing the License standard header text
- Throws:
InvalidLicenseTemplateExceptionSpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setLicenseHeaderHtml
Set the licenseHeaderTemplateHtml- Parameters:
licenseHeaderHtml- HTML fragment representing the license standard header text- Throws:
InvalidSPDXAnalysisException
-
getDeprecatedVersion
- Returns:
- the deprecatedVersion
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setDeprecatedVersion
- Parameters:
deprecatedVersion- the deprecatedVersion to set- Throws:
InvalidSPDXAnalysisException
-
getCrossRef
- Throws:
InvalidSPDXAnalysisException
-
getType
- Specified by:
getTypein classModelObject- Returns:
- The class name for this object. Class names are defined in the constants file
-
equivalent
public boolean equivalent(ModelObject compare, boolean ignoreRelatedElements) throws InvalidSPDXAnalysisException- Overrides:
equivalentin classLicenseignoreRelatedElements- if true, do not compare properties relatedSpdxElement - used to prevent infinite recursion- Returns:
- true if all the properties have the same or equivalent values
- Throws:
InvalidSPDXAnalysisException
-
equals
- Overrides:
equalsin classModelObject
-
hashCode
public int hashCode()- Overrides:
hashCodein classModelObject
-