Package org.spdx.library.model
Class ExternalDocumentRef
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.ExternalDocumentRef
- All Implemented Interfaces:
Comparable<ExternalDocumentRef>
public class ExternalDocumentRef extends ModelObject implements Comparable<ExternalDocumentRef>
Information about an external SPDX document reference including the checksum.
This allows for verification of the external references.
- Author:
- Gary O'Neall
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ExternalDocumentRef()Default model store, copy manager, and document URIExternalDocumentRef(String id)ExternalDocumentRef(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 objectintcompareTo(ExternalDocumentRef o)Optional<Checksum>getChecksum()static Optional<ExternalDocumentRef>getExternalDocRefByDocNamespace(IModelStore stModelStore, String stDocumentUri, String externalDocUri, ModelCopyManager copyManager)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.emptyStringgetSpdxDocumentNamespace()StringgetType()ExternalDocumentRefsetChecksum(Checksum checksum)ExternalDocumentRefsetSpdxDocument(SpdxDocument spdxDocument)ExternalDocumentRefsetSpdxDocumentNamespace(String documentNamespace)Set the document namespaceMethods 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, equals, equivalent, equivalent, getAnyLicenseInfoPropertyValue, getBooleanPropertyValue, getCopyManager, getDocumentUri, getElementPropertyValue, getEnumPropertyValue, getId, getIntegerPropertyValue, getModelStore, getObjectPropertyValue, getObjectPropertyValue, getObjectPropertyValueCollection, getObjectPropertyValueSet, getPropertyValueNames, getStringCollection, getStringPropertyValue, hashCode, idToIdType, isCollectionMembersAssignableTo, isStrict, leaveCriticalSection, removeProperty, removeProperty, removePropertyValueFromCollection, removePropertyValueFromCollection, replacePropertyValueCollection, setCopyManager, setPropertyValue, setPropertyValue, setStrict, toString, toTypedValue, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verify, verifyCollection
-
Constructor Details
-
ExternalDocumentRef
Default model store, copy manager, and document URI- Throws:
InvalidSPDXAnalysisException
-
ExternalDocumentRef
- Parameters:
id-- Throws:
InvalidSPDXAnalysisException
-
ExternalDocumentRef
public ExternalDocumentRef(IModelStore modelStore, String documentUri, String id, @Nullable ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisException- Parameters:
modelStore- Storage for the model objectsdocumentUri- SPDX Document URI for a document associated with this modelid- ID for this object - must be unique within the SPDX documentcopyManager- - 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:
InvalidSPDXAnalysisException
-
-
Method Details
-
getExternalDocRefByDocNamespace
public static Optional<ExternalDocumentRef> getExternalDocRefByDocNamespace(IModelStore stModelStore, String stDocumentUri, String externalDocUri, @Nullable ModelCopyManager copyManager) throws InvalidSPDXAnalysisExceptionObtain 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 Document- Returns:
- Throws:
InvalidSPDXAnalysisException
-
getType
- Specified by:
getTypein classModelObject- Returns:
- The class name for this object. Class names are defined in the constants file
-
getChecksum
- Returns:
- the checksum
- Throws:
InvalidSPDXAnalysisException
-
setChecksum
- Parameters:
checksum- the checksum to set- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
getSpdxDocumentNamespace
- Returns:
- the spdxDocumentNamespace or empty string if no namespace
- Throws:
InvalidSPDXAnalysisException
-
setSpdxDocumentNamespace
public ExternalDocumentRef setSpdxDocumentNamespace(String documentNamespace) throws InvalidSPDXAnalysisExceptionSet the document namespace- Parameters:
documentNamespace-- Throws:
InvalidSPDXAnalysisException
-
getSpdxDocument
Returns the SPDX document if it exists within the same model store, otherwise it returns Optional.empty- Returns:
- the spdxDocument
- Throws:
InvalidSPDXAnalysisException
-
setSpdxDocument
public ExternalDocumentRef setSpdxDocument(SpdxDocument spdxDocument) throws InvalidSPDXAnalysisException- Parameters:
spdxDocument- the spdxDocument to set- Returns:
- this to chain setters
- Throws:
InvalidSPDXAnalysisException
-
_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
-
compareTo
- Specified by:
compareToin interfaceComparable<ExternalDocumentRef>
-