Class ExternalExtractedLicenseInfo
- 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.AbstractExtractedLicenseInfo
-
- org.spdx.library.model.v2.license.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. ThegetExtractedText()
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
-
-
Field Summary
-
Fields inherited from class org.spdx.library.model.v2.ModelObjectV2
LATEST_SPDX_2_VERSION
-
-
Constructor Summary
Constructors Constructor Description ExternalExtractedLicenseInfo(String documentUri, String id)
ExternalExtractedLicenseInfo(org.spdx.storage.IModelStore modelStore, String documentUri, String id, org.spdx.core.IModelCopyManager copyManager)
ExternalExtractedLicenseInfo(org.spdx.storage.IModelStore modelStore, String documentUri, String id, org.spdx.core.IModelCopyManager copyManager, boolean create)
-
Method Summary
All Methods Static 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
equals(Object comp)
boolean
equivalent(org.spdx.core.CoreModelObject compare)
boolean
equivalent(org.spdx.core.CoreModelObject compare, boolean ignoreRelatedElements)
static String
externalExtractedLicenseIdToURI(String externalExtractedLicenseId, org.spdx.storage.IModelStore stModelStore, String stDocumentUri, org.spdx.core.IModelCopyManager copyManager)
String
getComment()
String
getExternalDocumentId()
String
getExternalExtractedLicenseURI()
String
getExternalLicenseRef()
String
getExtractedText()
String
getIndividualURI()
String
getName()
Collection<String>
getSeeAlso()
String
getType()
int
hashCode()
boolean
isExternal()
String
referenceElementId(SpdxDocument documentReferencingExternal)
void
setComment(String comment)
void
setName(String name)
void
setSeeAlso(Collection<String> seeAlsoUrl)
String
toString()
static String
uriToExternalExtractedLicenseRef(String uri, org.spdx.storage.IModelStore stModelStore, String stDocumentUri, org.spdx.core.IModelCopyManager copyManager, String specVersion)
Convert a URI to an ID for an External Extracted License-
Methods inherited from class org.spdx.library.model.v2.license.AbstractExtractedLicenseInfo
compareTo
-
Methods inherited from class org.spdx.library.model.v2.license.SimpleLicensingInfo
getLicenseId
-
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, getAnyLicenseInfoPropertyValue, getDocumentUri, getElementPropertyValue, getId, isEquivalentToNull, isNoAssertion, isRelatedElement, toTypedValue, verify
-
Methods inherited from class org.spdx.core.CoreModelObject
addPropertyValueToCollection, clearValueCollection, clone, copyFrom, enterCriticalSection, getBooleanPropertyValue, getCopyManager, getDoublePropertyValue, getEnumPropertyValue, getIdPrefix, getIntegerPropertyValue, getModelStore, getObjectPropertyValue, getObjectPropertyValue, getObjectPropertyValueCollection, getObjectPropertyValueSet, getObjectUri, getPropertyValueDescriptors, getSpecVersion, getStringCollection, getStringPropertyValue, isCollectionMembersAssignableTo, isStrict, leaveCriticalSection, removeProperty, removePropertyValueFromCollection, setCopyManager, setIdPrefix, setPropertyValue, setStrict, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verifyCollection
-
-
-
-
Constructor Detail
-
ExternalExtractedLicenseInfo
public ExternalExtractedLicenseInfo(String documentUri, String id) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
documentUri
- Document URI for the EXTERNAL documentid
- 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 referencedocumentUri
- Document URI for the EXTERNAL documentid
- ID used in the EXTERNAL documentcopyManager
- to be usedcreate
- 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 referencedocumentUri
- Document URI for the EXTERNAL documentid
- ID used in the EXTERNAL documentcopyManager
- to be used- Throws:
org.spdx.core.InvalidSPDXAnalysisException
- on error generating object
-
-
Method Detail
-
isExternal
public boolean isExternal()
- Overrides:
isExternal
in classorg.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 classorg.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 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
-
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:idstModelStore
- model storestDocumentUri
- document URI for the document which is referring to the external licensecopyManager
- 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-XXXXstModelStore
-stDocumentUri
-copyManager
- if non-null, create the external doc ref if it is not already in the ModelStorespecVersion
- - 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 classorg.spdx.core.CoreModelObject
-
equivalent
public boolean equivalent(org.spdx.core.CoreModelObject compare, boolean ignoreRelatedElements) throws org.spdx.core.InvalidSPDXAnalysisException
- Overrides:
equivalent
in classorg.spdx.core.CoreModelObject
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getIndividualURI
public String getIndividualURI()
- Specified by:
getIndividualURI
in interfaceorg.spdx.core.IndividualUriValue
-
getExtractedText
public String getExtractedText() throws org.spdx.core.InvalidSPDXAnalysisException
- Specified by:
getExtractedText
in classAbstractExtractedLicenseInfo
- Returns:
- the text
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getComment
public String getComment() throws org.spdx.core.InvalidSPDXAnalysisException
- Overrides:
getComment
in classSimpleLicensingInfo
- Returns:
- the comments
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setComment
public void setComment(String comment) throws org.spdx.core.InvalidSPDXAnalysisException
- Overrides:
setComment
in classSimpleLicensingInfo
- Parameters:
comment
- the comment to set- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getSeeAlso
public Collection<String> getSeeAlso() throws org.spdx.core.InvalidSPDXAnalysisException
- Overrides:
getSeeAlso
in classSimpleLicensingInfo
- 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 classSimpleLicensingInfo
- 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 classSimpleLicensingInfo
- Returns:
- the name
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setName
public void setName(String name) throws org.spdx.core.InvalidSPDXAnalysisException
- Overrides:
setName
in classSimpleLicensingInfo
- Parameters:
name
- the name to set- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
equals
public boolean equals(Object comp)
- Overrides:
equals
in classModelObjectV2
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classModelObjectV2
-
toString
public String toString()
- Overrides:
toString
in classAbstractExtractedLicenseInfo
-
-