Package org.spdx.library.model.v2
Class SpdxPackage
- java.lang.Object
-
- org.spdx.core.CoreModelObject
-
- org.spdx.library.model.v2.ModelObjectV2
-
- org.spdx.library.model.v2.SpdxElement
-
- org.spdx.library.model.v2.SpdxItem
-
- org.spdx.library.model.v2.SpdxPackage
-
- All Implemented Interfaces:
Comparable<SpdxPackage>
public class SpdxPackage extends SpdxItem implements Comparable<SpdxPackage>
A Package represents a collection of software files that are delivered as a single functional component.- Author:
- Gary O'Neall
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SpdxPackage.SpdxPackageBuilder
-
Field Summary
-
Fields inherited from class org.spdx.library.model.v2.ModelObjectV2
LATEST_SPDX_2_VERSION
-
-
Constructor Summary
Constructors Modifier Constructor Description SpdxPackage()
SpdxPackage(String id)
protected
SpdxPackage(SpdxPackage.SpdxPackageBuilder spdxPackageBuilder)
SpdxPackage(org.spdx.storage.IModelStore modelStore, String documentUri, String id, org.spdx.core.IModelCopyManager copyManager, boolean create)
-
Method Summary
-
Methods inherited from class org.spdx.library.model.v2.SpdxItem
getAttributionText, getCopyrightText, getLicenseComments, getLicenseConcluded, getLicenseInfoFromFiles, getLicenseInfoFromFilesPropertyDescriptor, setCopyrightText, setLicenseComments, setLicenseConcluded, setName
-
Methods inherited from class org.spdx.library.model.v2.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, getAnnotations, getComment, getName, getRelationships, removeAnnotation, removeRelationship, setAnnotations, setComment, 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
-
SpdxPackage
public SpdxPackage() throws org.spdx.core.InvalidSPDXAnalysisException
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxPackage
public SpdxPackage(org.spdx.storage.IModelStore modelStore, String documentUri, String id, @Nullable org.spdx.core.IModelCopyManager copyManager, boolean create) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
modelStore
- container which includes the model datadocumentUri
- URI for the SPDX document containing the model dataid
- identifiercopyManager
- if non-null, allows for copying of any properties set which use other model stores or document URI'screate
- if true, create the license if it does not exist- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxPackage
public SpdxPackage(String id) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
id
- identifier- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxPackage
protected SpdxPackage(SpdxPackage.SpdxPackageBuilder spdxPackageBuilder) throws org.spdx.core.InvalidSPDXAnalysisException
- 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
-
isFilesAnalyzed
public boolean isFilesAnalyzed() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- true unless the filesAnalyzed property is present and set to false (default is true)
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setFilesAnalyzed
public SpdxPackage setFilesAnalyzed(@Nullable Boolean filesAnalyzed) throws org.spdx.core.InvalidSPDXAnalysisException
Set files Analyzed for the package- Parameters:
filesAnalyzed
-- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getBuiltDate
public Optional<String> getBuiltDate() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- This field provides a place for recording the actual date the package was built.
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setBuiltDate
public void setBuiltDate(String builtDate) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
builtDate
- This field provides a place for recording the actual date the package was built.- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getReleaseDate
public Optional<String> getReleaseDate() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- This field provides a place for recording the date the package was released.
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setReleaseDate
public void setReleaseDate(String releaseDate) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
releaseDate
- This field provides a place for recording the date the package was released.- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getValidUntilDate
public Optional<String> getValidUntilDate() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- This field provides a place for recording the end of the support period for a package from the supplier.
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setValidUntilDate
public void setValidUntilDate(String validUntilDate) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
validUntilDate
- This field provides a place for recording the end of the support period for a package from the supplier.- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getLicenseDeclared
@Nullable public AnyLicenseInfo getLicenseDeclared() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the licenseDeclared or NOASSERTION if no license declared is found
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setLicenseDeclared
public SpdxPackage setLicenseDeclared(@Nullable AnyLicenseInfo licenseDeclared) throws org.spdx.core.InvalidSPDXAnalysisException
Set the licenseDeclared- Parameters:
licenseDeclared
-- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getChecksums
public Collection<Checksum> getChecksums() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- collection of checksums
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
addChecksum
public SpdxPackage addChecksum(Checksum checksum) throws org.spdx.core.InvalidSPDXAnalysisException
Add a checksum to the collection of checksums for this package- Parameters:
checksum
-- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getDescription
public Optional<String> getDescription() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the description
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setDescription
public SpdxPackage setDescription(String description) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
description
-- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getDownloadLocation
public Optional<String> getDownloadLocation() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the downloadLocation
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setDownloadLocation
public SpdxPackage setDownloadLocation(String downloadLocation) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
downloadLocation
- the download location- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getHomepage
public Optional<String> getHomepage() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the homepage
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setHomepage
public SpdxPackage setHomepage(String homepage) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
homepage
- the package homepage- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getOriginator
public Optional<String> getOriginator() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the originator
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setOriginator
public SpdxPackage setOriginator(String originator) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
originator
- the package originator- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getPackageFileName
public Optional<String> getPackageFileName() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the packageFileName
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setPackageFileName
public SpdxPackage setPackageFileName(String packageFileName) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
packageFileName
- the package filename to set- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getPackageVerificationCode
public Optional<SpdxPackageVerificationCode> getPackageVerificationCode() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the packageVerificationCode, null if not present
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setPackageVerificationCode
public SpdxPackage setPackageVerificationCode(SpdxPackageVerificationCode verificationCode) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
verificationCode
- the package verification code to set- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getSourceInfo
public Optional<String> getSourceInfo() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the sourceInfo
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setSourceInfo
public SpdxPackage setSourceInfo(String sourceInfo) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
sourceInfo
- package source info- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getSummary
public Optional<String> getSummary() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the summary
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setSummary
public SpdxPackage setSummary(String summary) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
summary
- package summary- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getSupplier
public Optional<String> getSupplier() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the supplier
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setSupplier
public SpdxPackage setSupplier(String supplier) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
supplier
- the package supplier to set- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getVersionInfo
public Optional<String> getVersionInfo() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the versionInfo
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setVersionInfo
public SpdxPackage setVersionInfo(String versionInfo) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
versionInfo
-- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getExternalRefs
public Collection<ExternalRef> getExternalRefs() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the externalRefs
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
addExternalRef
public SpdxPackage addExternalRef(ExternalRef externalRef) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
externalRef
-- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getFiles
public Collection<SpdxFile> getFiles() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the files
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
addFile
public SpdxPackage addFile(SpdxFile file) throws org.spdx.core.InvalidSPDXAnalysisException
Add a file to the collection of files attached to this package- Parameters:
file
-- Returns:
- this to build additional options
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getPrimaryPurpose
public Optional<Purpose> getPrimaryPurpose() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- provides information about the primary purpose of the package. Package Purpose is intrinsic to how the package is being used rather than the content of the package.
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setPrimaryPurpose
public void setPrimaryPurpose(Purpose purpose) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
purpose
- provides information about the primary purpose of the package. Package Purpose is intrinsic to how the package is being used rather than the content of the package.- 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
-
compareTo
public int compareTo(SpdxPackage pkg)
- Specified by:
compareTo
in interfaceComparable<SpdxPackage>
-
getSha1
public String getSha1() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the Sha1 checksum value for this package, or a blank string if no sha1 checksum has been set
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
-