Package org.spdx.library.model.v2
Class ExternalDocumentRef
- java.lang.Object
-
- org.spdx.core.CoreModelObject
-
- org.spdx.library.model.v2.ModelObjectV2
-
- org.spdx.library.model.v2.ExternalDocumentRef
-
- All Implemented Interfaces:
Comparable<ExternalDocumentRef>
,org.spdx.core.IExternalElementInfo
public class ExternalDocumentRef extends ModelObjectV2 implements Comparable<ExternalDocumentRef>, org.spdx.core.IExternalElementInfo
Information about an external SPDX document reference including the checksum. This allows for verification of the external references.- 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 ExternalDocumentRef()
Default model store, copy manager, and document URIExternalDocumentRef(String id)
ExternalDocumentRef(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 objectint
compareTo(ExternalDocumentRef o)
Optional<Checksum>
getChecksum()
static Optional<ExternalDocumentRef>
getExternalDocRefByDocNamespace(org.spdx.storage.IModelStore stModelStore, String stDocumentUri, String externalDocUri, org.spdx.core.IModelCopyManager copyManager, String specVersion)
Obtain an ExternalDocumentRef which maps to the document URI for the external SPDX document.Optional<SpdxDocument>
getSpdxDocument()
Returns the SPDX document if it exists within the same model store, otherwise it returns Optional.emptyString
getSpdxDocumentNamespace()
String
getType()
ExternalDocumentRef
setChecksum(Checksum checksum)
ExternalDocumentRef
setSpdxDocument(SpdxDocument spdxDocument)
ExternalDocumentRef
setSpdxDocumentNamespace(String documentNamespace)
Set the document namespace-
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, toString, 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, isCollectionMembersAssignableTo, isExternal, isStrict, leaveCriticalSection, removeProperty, removePropertyValueFromCollection, setCopyManager, setIdPrefix, setPropertyValue, setStrict, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verifyCollection
-
-
-
-
Constructor Detail
-
ExternalDocumentRef
public ExternalDocumentRef() throws org.spdx.core.InvalidSPDXAnalysisException
Default model store, copy manager, and document URI- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
ExternalDocumentRef
public ExternalDocumentRef(String id) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
id
- identifier- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
ExternalDocumentRef
public ExternalDocumentRef(org.spdx.storage.IModelStore modelStore, String documentUri, String id, @Nullable org.spdx.core.IModelCopyManager copyManager, boolean create) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
modelStore
- Storage for the model objectsdocumentUri
- SPDX Document URI for a document associated with this modelid
- for the object - must be unique within the SPDX store and must match the pattern for the external document referencecopyManager
- - if supplied, model objects will be implicitly copied into this model store and document URI when referenced by setting methodscreate
- - if true, the object will be created in the store if it is not already present- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
-
Method Detail
-
getExternalDocRefByDocNamespace
public static Optional<ExternalDocumentRef> getExternalDocRefByDocNamespace(org.spdx.storage.IModelStore stModelStore, String stDocumentUri, String externalDocUri, @Nullable org.spdx.core.IModelCopyManager copyManager, String specVersion) throws org.spdx.core.InvalidSPDXAnalysisException
Obtain an ExternalDocumentRef which maps to the document URI for the external SPDX document.- Parameters:
stModelStore
- Model Store for the document referring to the external SPDX documentstDocumentUri
- Document URI for the document referring to the external SPDX documentexternalDocUri
- Document URI for the external document (a.k.a. eternalDocumentNamespace)copyManager
- if non-null, create the external Doc ref if it is not a property of the SPDX DocumentspecVersion
- - version of the SPDX spec the object complies with- Returns:
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getType
public String getType()
- Specified by:
getType
in classorg.spdx.core.CoreModelObject
-
getChecksum
public Optional<Checksum> getChecksum() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the checksum
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setChecksum
public ExternalDocumentRef setChecksum(Checksum checksum) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
checksum
- the checksum to set- Returns:
- this to chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getSpdxDocumentNamespace
public String getSpdxDocumentNamespace() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the spdxDocumentNamespace or empty string if no namespace
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setSpdxDocumentNamespace
public ExternalDocumentRef setSpdxDocumentNamespace(String documentNamespace) throws org.spdx.core.InvalidSPDXAnalysisException
Set the document namespace- Parameters:
documentNamespace
-- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getSpdxDocument
public Optional<SpdxDocument> getSpdxDocument() throws org.spdx.core.InvalidSPDXAnalysisException
Returns the SPDX document if it exists within the same model store, otherwise it returns Optional.empty- Returns:
- the spdxDocument
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setSpdxDocument
public ExternalDocumentRef setSpdxDocument(SpdxDocument spdxDocument) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
spdxDocument
- the spdxDocument to set- Returns:
- this to chain setters
- 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 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
-
compareTo
public int compareTo(ExternalDocumentRef o)
- Specified by:
compareTo
in interfaceComparable<ExternalDocumentRef>
-
-