Package org.spdx.library.model
Class SpdxDocument
java.lang.Object
org.spdx.library.model.ModelObject
org.spdx.library.model.SpdxElement
org.spdx.library.model.SpdxDocument
public class SpdxDocument extends SpdxElement
An SpdxDocument is a summary of the contents, provenance, ownership and licensing
analysis of a specific software package.
This is, effectively, the top level of SPDX information.
- Author:
- Gary O'Neall
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SpdxDocument(String documentUri)Obtains or creates an SPDX document using the default document storeSpdxDocument(IModelStore modelStore, String documentUri, ModelCopyManager copyManager, boolean create) -
Method Summary
Modifier and Type Method Description protected List<String>_verify(Set<String> verifiedIds, String verifySpecVersion)Implementation of the specific verifications for this model objectbooleanaddExtractedLicenseInfos(ExtractedLicenseInfo licenseInfo)Add a license info to the collection of extracted license infosSpdxCreatorInformationgetCreationInfo()AnyLicenseInfogetDataLicense()Collection<SpdxElement>getDocumentDescribes()Collection<ExternalDocumentRef>getExternalDocumentRefs()Collection<ExtractedLicenseInfo>getExtractedLicenseInfos()protected StringgetNamePropertyName()StringgetSpecVersion()StringgetType()voidsetCreationInfo(SpdxCreatorInformation creationInfo)voidsetDataLicense(AnyLicenseInfo dataLicense)SpdxDocumentsetDocumentDescribes(List<SpdxItem> documentDescribes)clear and reset document describes to the paramater collectionSpdxDocumentsetExternalDocumentRefs(Collection<ExternalDocumentRef> externalDocumentRefs)Clear the externalDocumentRefs and add all elements from externalDocumentRefsSpdxDocumentsetExtractedLicenseInfos(List<ExtractedLicenseInfo> extractedLicenseInfos)Clear the extractedLicenseInfos and add all elements from extractedLicenseInfosvoidsetSpecVersion(String specVersion)Methods inherited from class org.spdx.library.model.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, getAnnotations, getComment, getName, getRelationships, removeAnnotation, removeRelationship, setAnnotations, setComment, setName, setRelationshipsMethods 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
-
SpdxDocument
public SpdxDocument(IModelStore modelStore, String documentUri, ModelCopyManager copyManager, boolean create) throws InvalidSPDXAnalysisException- Parameters:
modelStore- Storage for the model objectsdocumentUri- SPDX Document URI for the document associated with this modelcopyManager- if non-null, allows for copying of any properties set which use other model stores or document URI'screate- - if true, the object will be created in the store if it is not already present- Throws:
InvalidSPDXAnalysisException
-
SpdxDocument
Obtains or creates an SPDX document using the default document store- Parameters:
documentUri-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getType
- Specified by:
getTypein classModelObject- Returns:
- The class name for this object. Class names are defined in the constants file
-
getNamePropertyName
- Overrides:
getNamePropertyNamein classSpdxElement- Returns:
- the property name used for the Name property. Override this function if using a subproperty of SPDX Name
-
getDocumentDescribes
- Returns:
- collection of items described by this SPDX document
- Throws:
InvalidSPDXAnalysisException
-
setDocumentDescribes
clear and reset document describes to the paramater collection- Parameters:
documentDescribes- collection of items described by this SPDX document- Returns:
- this to chain setters
-
getCreationInfo
- Returns:
- the creationInfo, null if no creationInfo in the SPDX document
- Throws:
InvalidSPDXAnalysisException
-
setCreationInfo
public void setCreationInfo(SpdxCreatorInformation creationInfo) throws InvalidSPDXAnalysisException- Parameters:
creationInfo- the creationInfo to set- Throws:
InvalidSPDXAnalysisException
-
getDataLicense
- Returns:
- the dataLicense
- Throws:
InvalidSPDXAnalysisException
-
setDataLicense
- Parameters:
dataLicense- the dataLicense to set- Throws:
InvalidSPDXAnalysisException
-
getExternalDocumentRefs
public Collection<ExternalDocumentRef> getExternalDocumentRefs() throws InvalidSPDXAnalysisException- Returns:
- the externalDocumentRefs
- Throws:
InvalidSPDXAnalysisException
-
getExtractedLicenseInfos
public Collection<ExtractedLicenseInfo> getExtractedLicenseInfos() throws InvalidSPDXAnalysisException- Returns:
- the extractedLicenseInfos
- Throws:
InvalidSPDXAnalysisException
-
addExtractedLicenseInfos
Add a license info to the collection of extracted license infos- Parameters:
licenseInfo-- Returns:
-
setExtractedLicenseInfos
Clear the extractedLicenseInfos and add all elements from extractedLicenseInfos- Parameters:
extractedLicenseInfos-- Returns:
- this to enable chaining of sets
-
getSpecVersion
- Returns:
- the specVersion
- Throws:
InvalidSPDXAnalysisException
-
setSpecVersion
- Parameters:
specVersion- the specVersion to set- Throws:
InvalidSPDXAnalysisException
-
_verify
Description copied from class:ModelObjectImplementation of the specific verifications for this model object- Overrides:
_verifyin classSpdxElement- Parameters:
verifiedIds- list of all Element Id's which have already been verified - prevents infinite recursionverifySpecVersion- Version of the SPDX spec to verify against- Returns:
- Any verification errors or warnings associated with this object
-
setExternalDocumentRefs
Clear the externalDocumentRefs and add all elements from externalDocumentRefs- Parameters:
externalDocumentRefs-- Returns:
- this to enable chaining of sets
-