Class License
- java.lang.Object
-
- org.spdx.core.CoreModelObject
-
- org.spdx.library.model.v2.ModelObjectV2
-
- org.spdx.library.model.v2.license.AnyLicenseInfo
-
- org.spdx.library.model.v2.license.SimpleLicensingInfo
-
- org.spdx.library.model.v2.license.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
-
-
Field Summary
-
Fields inherited from class org.spdx.library.model.v2.ModelObjectV2
LATEST_SPDX_2_VERSION
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<String>
_verify(Set<String> verifiedIds, String specVersion)
Implementation of the specific verifications for this model objectBoolean
getFsfLibre()
String
getLicenseText()
String
getStandardLicenseHeader()
String
getStandardLicenseHeaderTemplate()
String
getStandardLicenseTemplate()
boolean
isDeprecated()
boolean
isFsfLibre()
boolean
isNotFsfLibre()
boolean
isOsiApproved()
void
setDeprecated(Boolean deprecated)
void
setFsfLibre(Boolean fsfLibre)
void
setLicenseText(String text)
void
setOsiApproved(Boolean osiApproved)
void
setStandardLicenseHeader(String standardLicenseHeader)
void
setStandardLicenseHeaderTemplate(String standardLicenseHeaderTemplate)
void
setStandardLicenseTemplate(String template)
String
toString()
org.spdx.storage.IModelStore.ModelUpdate
updateSetDeprecated(Boolean deprecated)
-
Methods inherited from class org.spdx.library.model.v2.license.SimpleLicensingInfo
getComment, getLicenseId, getName, getSeeAlso, setComment, setName, setSeeAlso
-
Methods inherited from class org.spdx.library.model.v2.ModelObjectV2
_verify, createAnnotation, createByteOffsetPointer, createChecksum, createConjunctiveLicenseSet, createCreationInfo, createCrossRef, createDisjunctiveLicenseSet, createExternalDocumentRef, createExternalRef, createExtractedLicense, createLineCharPointer, createPackage, createPackageVerificationCode, createRelationship, createSpdxFile, createSpdxSnippet, createStartEndPointer, equals, getAnyLicenseInfoPropertyValue, getDocumentUri, getElementPropertyValue, getId, hashCode, isEquivalentToNull, isNoAssertion, isRelatedElement, toTypedValue, verify
-
Methods inherited from class org.spdx.core.CoreModelObject
addPropertyValueToCollection, clearValueCollection, clone, copyFrom, enterCriticalSection, equivalent, equivalent, getBooleanPropertyValue, getCopyManager, getDoublePropertyValue, getEnumPropertyValue, getIdPrefix, getIntegerPropertyValue, getModelStore, getObjectPropertyValue, getObjectPropertyValue, getObjectPropertyValueCollection, getObjectPropertyValueSet, getObjectUri, getPropertyValueDescriptors, getSpecVersion, getStringCollection, getStringPropertyValue, getType, isCollectionMembersAssignableTo, isExternal, isStrict, leaveCriticalSection, removeProperty, removePropertyValueFromCollection, setCopyManager, setIdPrefix, setPropertyValue, setStrict, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verifyCollection
-
-
-
-
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
-
toString
public String toString()
- Specified by:
toString
in classAnyLicenseInfo
-
_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 classModelObjectV2
- Parameters:
verifiedIds
- list of all Element Id's which have already been verified - prevents infinite recursionspecVersion
- 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
-
-