Package org.spdx.library.model.v2
Class SpdxItem
- 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
-
- Direct Known Subclasses:
GenericSpdxItem
,SpdxFile
,SpdxPackage
,SpdxSnippet
public abstract class SpdxItem extends SpdxElement
An SpdxItem is a potentially copyrightable work.- Author:
- Gary O'Neall
-
-
Field Summary
-
Fields inherited from class org.spdx.library.model.v2.ModelObjectV2
LATEST_SPDX_2_VERSION
-
-
Method Summary
All 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 objectCollection<String>
getAttributionText()
String
getCopyrightText()
Optional<String>
getLicenseComments()
AnyLicenseInfo
getLicenseConcluded()
Collection<AnyLicenseInfo>
getLicenseInfoFromFiles()
protected org.spdx.storage.PropertyDescriptor
getLicenseInfoFromFilesPropertyDescriptor()
SpdxItem
setCopyrightText(String copyrightText)
SpdxItem
setLicenseComments(String licenseComments)
SpdxItem
setLicenseConcluded(AnyLicenseInfo license)
Set the licenseConcludedSpdxItem
setName(String name)
Set the name-
Methods inherited from class org.spdx.library.model.v2.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, getAnnotations, getComment, getName, getNamePropertyDescriptor, 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, getType, isCollectionMembersAssignableTo, isExternal, isStrict, leaveCriticalSection, removeProperty, removePropertyValueFromCollection, setCopyManager, setIdPrefix, setPropertyValue, setStrict, updateAddPropertyValueToCollection, updateClearValueCollection, updatePropertyValue, updateRemoveProperty, updateRemovePropertyValueFromCollection, verify, verify, verifyCollection
-
-
-
-
Constructor Detail
-
SpdxItem
public SpdxItem() throws org.spdx.core.InvalidSPDXAnalysisException
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxItem
public SpdxItem(String id) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
id
- identifier- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
SpdxItem
public SpdxItem(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
-
-
Method Detail
-
getLicenseInfoFromFilesPropertyDescriptor
protected org.spdx.storage.PropertyDescriptor getLicenseInfoFromFilesPropertyDescriptor()
- Returns:
- Property name for licenseInfoFromFiles. Override if using a subproperty of "licenseDeclared".
-
getLicenseConcluded
public AnyLicenseInfo getLicenseConcluded() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the licenseConcluded
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setLicenseConcluded
public SpdxItem setLicenseConcluded(@Nullable AnyLicenseInfo license) throws org.spdx.core.InvalidSPDXAnalysisException
Set the licenseConcluded- Parameters:
license
-- Returns:
- this so you can chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getLicenseInfoFromFiles
public Collection<AnyLicenseInfo> getLicenseInfoFromFiles() throws org.spdx.core.InvalidSPDXAnalysisException
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getCopyrightText
public String getCopyrightText() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the copyrightText, empty string if no copyright was set
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setCopyrightText
public SpdxItem setCopyrightText(@Nullable String copyrightText) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
copyrightText
- the copyrightText to set- Returns:
- myself - so you can chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getAttributionText
public Collection<String> getAttributionText() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- attribution text collection
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setName
public SpdxItem setName(String name) throws org.spdx.core.InvalidSPDXAnalysisException
Description copied from class:SpdxElement
Set the name- Overrides:
setName
in classSpdxElement
- Returns:
- this so that you can chain setters
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
getLicenseComments
public Optional<String> getLicenseComments() throws org.spdx.core.InvalidSPDXAnalysisException
- Returns:
- the licenseComment
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
-
setLicenseComments
public SpdxItem setLicenseComments(String licenseComments) throws org.spdx.core.InvalidSPDXAnalysisException
- Parameters:
licenseComments
- the licenseComment to set- Returns:
- this so you chan 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- Overrides:
_verify
in classSpdxElement
- 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
-
-