Package org.spdx.library.model.license
Class ExternalExtractedLicenseInfo
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.AbstractExtractedLicenseInfo
org.spdx.library.model.license.ExternalExtractedLicenseInfo
- All Implemented Interfaces:
Comparable<AbstractExtractedLicenseInfo>,IndividualUriValue
public class ExternalExtractedLicenseInfo extends AbstractExtractedLicenseInfo implements IndividualUriValue
- Author:
- Gary O'Neall
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. The ID must be in the formSpdxConstants.EXTERNAL_LICENSE_REF_PATTERN.pattern()
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ExternalExtractedLicenseInfo(String id)ExternalExtractedLicenseInfo(IModelStore modelStore, String documentUri, String id, ModelCopyManager copyManager, boolean create) -
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 comp)booleanequivalent(ModelObject compare)booleanequivalent(ModelObject compare, boolean ignoreRelatedElements)static StringexternalExtractedLicenseIdToURI(String externalExtractedLicenseId, IModelStore stModelStore, String stDocumentUri, ModelCopyManager copyManager)StringgetComment()StringgetExternalDocumentId()StringgetExternalExtractedLicenseURI()StringgetExternalLicenseRef()StringgetExtractedText()StringgetIndividualURI()StringgetName()Collection<String>getSeeAlso()StringgetType()inthashCode()voidsetComment(String comment)voidsetName(String name)voidsetSeeAlso(Collection<String> seeAlsoUrl)static ExternalExtractedLicenseInfouriToExternalExtractedLicense(String externalLicenseUri, IModelStore stModelStore, String stDocumentUri, ModelCopyManager copyManager)static StringuriToExternalExtractedLicenseId(String uri, IModelStore stModelStore, String stDocumentUri, ModelCopyManager copyManager)Convert a URI to an ID for an External Extracted LicenseMethods inherited from class org.spdx.library.model.license.AbstractExtractedLicenseInfo
compareTo, toStringMethods 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, 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
-
ExternalExtractedLicenseInfo
- Throws:
InvalidSPDXAnalysisException
-
ExternalExtractedLicenseInfo
public ExternalExtractedLicenseInfo(IModelStore modelStore, String documentUri, String id, @Nullable ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisException- Parameters:
modelStore-documentUri-id-copyManager-create-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getExternalDocumentId
- Returns:
- external document ID for the external reference
- Throws:
InvalidSPDXAnalysisException
-
getExternalLicenseRef
- Returns:
- element ID used in the external document
- Throws:
InvalidSPDXAnalysisException
-
getType
- Specified by:
getTypein classModelObject- Returns:
- The class name for this object. Class names are defined in the constants file
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object- Specified by:
_verifyin classModelObject- 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
-
getExternalExtractedLicenseURI
- Returns:
- the URI associated with this external SPDX Extracted License
- Throws:
InvalidSPDXAnalysisException
-
externalExtractedLicenseIdToURI
public static String externalExtractedLicenseIdToURI(String externalExtractedLicenseId, IModelStore stModelStore, String stDocumentUri, ModelCopyManager copyManager) throws InvalidSPDXAnalysisException- Parameters:
externalExtractedLicenseId-stModelStore-stDocumentUri-copyManager-- Returns:
- The URI associated with the external LicenseRef with the ID externalLicenseRefId
- Throws:
InvalidSPDXAnalysisException
-
uriToExternalExtractedLicense
public static ExternalExtractedLicenseInfo uriToExternalExtractedLicense(String externalLicenseUri, IModelStore stModelStore, String stDocumentUri, ModelCopyManager copyManager) throws InvalidSPDXAnalysisException- Parameters:
externalLicenseUri- URI of the form externaldocumentnamespace#LicenseRef-XXXXXstModelStore-stDocumentUri-copyManager- if non-null, create the external doc ref if it is not already in the ModelStore- Returns:
- ExternalSpdxRef an ExternalLicenseRef based on a URI of the form externaldocumentnamespace#LicenseRef-XXXXX
- Throws:
InvalidSPDXAnalysisException
-
uriToExternalExtractedLicenseId
public static String uriToExternalExtractedLicenseId(String uri, IModelStore stModelStore, String stDocumentUri, ModelCopyManager copyManager) throws InvalidSPDXAnalysisExceptionConvert 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-XXXXstModelStore-stDocumentUri-copyManager- if non-null, create the external doc ref if it is not already in the ModelStore- Returns:
- external SPDX element ID in the form DocumentRef-XX:LicenseRef-XXXX
- Throws:
InvalidSPDXAnalysisException
-
equivalent
- Overrides:
equivalentin classModelObject- Returns:
- true if all the properties have the same or equivalent values
-
equivalent
public boolean equivalent(ModelObject compare, boolean ignoreRelatedElements) throws InvalidSPDXAnalysisException- Overrides:
equivalentin classModelObjectignoreRelatedElements- 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
-
getIndividualURI
- Specified by:
getIndividualURIin interfaceIndividualUriValue- Returns:
- a unique identifier for this value. Typically the namespace + the long name
-
getExtractedText
- Specified by:
getExtractedTextin classAbstractExtractedLicenseInfo- Returns:
- the text
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
getComment
- Overrides:
getCommentin classSimpleLicensingInfo- Returns:
- the comments
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setComment
- Overrides:
setCommentin classSimpleLicensingInfo- Parameters:
comment- the comment to set- Throws:
InvalidSPDXAnalysisException
-
getSeeAlso
- Overrides:
getSeeAlsoin classSimpleLicensingInfo- Returns:
- the urls which reference the same license information
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setSeeAlso
- Overrides:
setSeeAlsoin classSimpleLicensingInfo- Parameters:
seeAlsoUrl- the urls which are references to the same license to set- Throws:
InvalidSPDXAnalysisException
-
getName
- Overrides:
getNamein classSimpleLicensingInfo- Returns:
- the name
- Throws:
SpdxInvalidTypeExceptionInvalidSPDXAnalysisException
-
setName
- Overrides:
setNamein classSimpleLicensingInfo- Parameters:
name- the name to set- Throws:
InvalidSPDXAnalysisException
-
equals
- Overrides:
equalsin classModelObject
-
hashCode
public int hashCode()- Overrides:
hashCodein classModelObject
-