Package org.spdx.library.model.v2
Class SpdxDocument
- java.lang.Object
-
- org.spdx.core.CoreModelObject
-
- org.spdx.library.model.v2.ModelObjectV2
-
- org.spdx.library.model.v2.SpdxElement
-
- org.spdx.library.model.v2.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
-
Fields inherited from class org.spdx.library.model.v2.ModelObjectV2
LATEST_SPDX_2_VERSION
-
-
Constructor Summary
Constructors Constructor Description SpdxDocument(String documentUri)
Obtains or creates an SPDX document using the default document storeSpdxDocument(org.spdx.storage.IModelStore modelStore, String documentUri, org.spdx.core.IModelCopyManager copyManager, boolean create)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<String>
_verify(Set<String> verifiedIds, String verifySpecVersion)
Implementation of the specific verifications for this model objectboolean
addExtractedLicenseInfos(ExtractedLicenseInfo licenseInfo)
Add a license info to the collection of extracted license infosSpdxCreatorInformation
getCreationInfo()
AnyLicenseInfo
getDataLicense()
Collection<SpdxElement>
getDocumentDescribes()
Collection<ExternalDocumentRef>
getExternalDocumentRefs()
Collection<ExtractedLicenseInfo>
getExtractedLicenseInfos()
protected org.spdx.storage.PropertyDescriptor
getNamePropertyDescriptor()
String
getType()
void
setCreationInfo(SpdxCreatorInformation creationInfo)
void
setDataLicense(AnyLicenseInfo dataLicense)
SpdxDocument
setDocumentDescribes(List<SpdxItem> documentDescribes)
clear and reset document describes to the parameter collectionSpdxDocument
setExternalDocumentRefs(Collection<ExternalDocumentRef> externalDocumentRefs)
Clear the externalDocumentRefs and add all elements from externalDocumentRefsSpdxDocument
setExtractedLicenseInfos(List<ExtractedLicenseInfo> extractedLicenseInfos)
Clear the extractedLicenseInfos and add all elements from extractedLicenseInfosvoid
setSpecVersion(String specVersion)
-
Methods inherited from class org.spdx.library.model.v2.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, getAnnotations, getComment, getName, getRelationships, removeAnnotation, removeRelationship, setAnnotations, setComment, setName, setRelationships
-
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
-
SpdxDocument
public SpdxDocument(org.spdx.storage.IModelStore modelStore, String documentUri, org.spdx.core.IModelCopyManager copyManager, boolean create) throws org.spdx.core.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:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxDocument
public SpdxDocument(String documentUri) throws org.spdx.core.InvalidSPDXAnalysisException
Obtains or creates an SPDX document using the default document store- Parameters:
documentUri
-- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
-
Method Detail
-
getType
public String getType()
- Specified by:
getType
in classorg.spdx.core.CoreModelObject
-
getNamePropertyDescriptor
protected org.spdx.storage.PropertyDescriptor getNamePropertyDescriptor()
- Overrides:
getNamePropertyDescriptor
in classSpdxElement
- Returns:
- the property name used for the Name property. Override this function if using a subproperty of SPDX Name
-
getDocumentDescribes
public Collection<SpdxElement> getDocumentDescribes() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- collection of items described by this SPDX document
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setDocumentDescribes
public SpdxDocument setDocumentDescribes(List<SpdxItem> documentDescribes)
clear and reset document describes to the parameter collection- Parameters:
documentDescribes
- collection of items described by this SPDX document- Returns:
- this to chain setters
-
getCreationInfo
@Nullable public SpdxCreatorInformation getCreationInfo() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the creationInfo, null if no creationInfo in the SPDX document
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setCreationInfo
public void setCreationInfo(SpdxCreatorInformation creationInfo) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
creationInfo
- the creationInfo to set- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getDataLicense
public AnyLicenseInfo getDataLicense() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the dataLicense
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setDataLicense
public void setDataLicense(AnyLicenseInfo dataLicense) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
dataLicense
- the dataLicense to set- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getExternalDocumentRefs
public Collection<ExternalDocumentRef> getExternalDocumentRefs() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the externalDocumentRefs
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getExtractedLicenseInfos
public Collection<ExtractedLicenseInfo> getExtractedLicenseInfos() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the extractedLicenseInfos
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
addExtractedLicenseInfos
public boolean addExtractedLicenseInfos(ExtractedLicenseInfo licenseInfo)
Add a license info to the collection of extracted license infos- Parameters:
licenseInfo
-- Returns:
-
setExtractedLicenseInfos
public SpdxDocument setExtractedLicenseInfos(List<ExtractedLicenseInfo> extractedLicenseInfos)
Clear the extractedLicenseInfos and add all elements from extractedLicenseInfos- Parameters:
extractedLicenseInfos
-- Returns:
- this to enable chaining of sets
-
setSpecVersion
public void setSpecVersion(String specVersion) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
specVersion
- the specVersion to set- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
_verify
protected List<String> _verify(Set<String> verifiedIds, String verifySpecVersion)
Description copied from class:ModelObjectV2
Implementation of the specific verifications for this model object- Overrides:
_verify
in 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
public SpdxDocument setExternalDocumentRefs(Collection<ExternalDocumentRef> externalDocumentRefs)
Clear the externalDocumentRefs and add all elements from externalDocumentRefs- Parameters:
externalDocumentRefs
-- Returns:
- this to enable chaining of sets
-
-