Package org.spdx.rdfparser.model
Class SpdxFile
java.lang.Object
org.spdx.rdfparser.model.RdfModelObject
org.spdx.rdfparser.model.SpdxElement
org.spdx.rdfparser.model.SpdxItem
org.spdx.rdfparser.model.SpdxFile
- All Implemented Interfaces:
Cloneable,Comparable<SpdxFile>,IRdfModel
public class SpdxFile extends SpdxItem implements Comparable<SpdxFile>
A File represents a named sequence of information
that is contained in a software package.
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpdxFile.FileType -
Field Summary
Fields Modifier and Type Field Description static Map<SpdxFile.FileType,String>FILE_TYPE_TO_TAGDeprecated.static Map<String,SpdxFile.FileType>TAG_TO_FILE_TYPEDeprecated.Fields inherited from class org.spdx.rdfparser.model.SpdxElement
annotations, comment, name, relationshipsFields inherited from class org.spdx.rdfparser.model.RdfModelObject
model, modelContainer, node, refreshOnGet, resource -
Constructor Summary
Constructors Constructor Description SpdxFile(String name, String comment, Annotation[] annotations, Relationship[] relationships, AnyLicenseInfo licenseConcluded, AnyLicenseInfo[] licenseInfoInFile, String copyrightText, String licenseComment, SpdxFile.FileType[] fileTypes, Checksum[] checksums, String[] fileContributors, String noticeText, DoapProject[] artifactOf)SpdxFile(String fileName, SpdxFile.FileType[] fileTypes, String sha1Value, AnyLicenseInfo licenseConcluded, AnyLicenseInfo[] licenseInfoInFiles, String licenseComment, String copyrightText, DoapProject[] artifactOfs, String fileComment)SpdxFile(IModelContainer modelContainer, org.apache.jena.graph.Node node) -
Method Summary
Modifier and Type Method Description voidaddChecksum(Checksum checksum)Add a checksumvoidaddFileType(SpdxFile.FileType fileType)Add a file type to this fileSpdxFileclone()SpdxFileclone(Map<String,SpdxElement> clonedElementIds)Clones this element, but prevents infinite recursion by keeping track of all elements which have been clonedprotected DoapProject[]cloneArtifactOf()protected Checksum[]cloneChecksum()SpdxFile[]cloneFileDependencies(Map<String,SpdxElement> clonedElementIds)intcompareTo(SpdxFile file)This method is used for sorting a list of SPDX filesbooleanequivalent(IRdfModel o)Returns true if the compare object contains properties which would be equal if they were contained in the same RDF Modelbooleanequivalent(IRdfModel o, boolean testRelationships)Test for equivalentorg.apache.jena.rdf.model.ResourcefindDuplicateResource(IModelContainer modelContainer, String uri)Search the model to see if there is a duplicate resource either based on the URI or based on other information.protected static org.apache.jena.rdf.model.ResourcefindFileResource(IModelContainer modelContainer, SpdxFile spdxFile)Finds the resource for an existing file in the modelDoapProject[]getArtifactOf()Deprecated.Checksum[]getChecksums()AnyLicenseInfogetConcludedLicenses()Deprecated.String[]getContributors()Deprecated.StringgetCopyright()Deprecated.String[]getFileContributors()SpdxFile[]getFileDependencies()Deprecated.SpdxFile.FileType[]getFileTypes()protected StringgetLicenseInfoFromFilesPropertyName()protected StringgetNamePropertyName()StringgetNoticeText()voidgetPropertiesFromModel()Fetch all of the properties from the model and populate the local Java propertiesAnyLicenseInfo[]getSeenLicenses()Deprecated.StringgetSha1()org.apache.jena.rdf.model.ResourcegetType(org.apache.jena.rdf.model.Model model)voidpopulateModel()Populate the RDF model from the Java propertiesvoidsetArtifactOf(DoapProject[] artifactOf)Deprecated.voidsetChecksums(Checksum[] checksums)voidsetConcludedLicenses(AnyLicenseInfo concludedLicense)Deprecated.voidsetContributors(String[] contributors)Deprecated.voidsetCopyright(String copyright)Deprecated.voidsetFileContributors(String[] fileContributors)voidsetFileDependencies(SpdxFile[] fileDependencies)Deprecated.voidsetFileTypes(SpdxFile.FileType[] fileTypes)voidsetNoticeText(String noticeText)voidsetSeenLicenses(AnyLicenseInfo[] seenLicenses)Deprecated.List<String>verify()Methods inherited from class org.spdx.rdfparser.model.SpdxItem
cloneLicenseConcluded, cloneLicenseInfosFromFiles, getAttributionText, getCopyrightText, getLicenseComment, getLicenseComments, getLicenseConcluded, getLicenseInfoFromFiles, setAttributionText, setCopyrightText, setLicenseComment, setLicenseComments, setLicenseConcluded, setLicenseInfosFromFilesMethods inherited from class org.spdx.rdfparser.model.SpdxElement
addAnnotation, addNameToWarnings, addRelationship, arraysEquivalent, arraysEquivalent, cloneAnnotations, cloneRelationships, equivalentConsideringNull, equivalentConsideringNull, getAnnotations, getComment, getId, getName, getRelationships, getUri, setAnnotations, setComment, setId, setName, setRelationships, toStringMethods inherited from class org.spdx.rdfparser.model.RdfModelObject
addPropertyUriValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, createResource, createResource, equals, findAnnotationPropertyValues, findAnyLicenseInfoPropertyValue, findAnyLicenseInfoPropertyValues, findChecksumPropertyValue, findCreationInfoPropertyValue, findElementPropertyValue, findExternalDocRefPropertyValues, findExternalDocRefPropertyValues, findExternalRefPropertyValues, findIntPropertyValue, findMultipleChecksumPropertyValues, findMultipleDoapPropertyValues, findMultipleElementPropertyValues, findMultiplePropertyValues, findReferenceTypePropertyValue, findRelationshipPropertyValues, findReviewPropertyValues, findSinglePointerPropertyValue, findSinglePropertyValue, findStartEndPointerPropertyValues, findUriPropertyValue, findUriPropertyValues, findVerificationCodePropertyValue, getNode, hashCode, isRefreshOnGet, removePropertyValue, resourcesEqual, setMultipleObjectsForSameNode, setPropertyUriValue, setPropertyUriValues, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setSingleObjectForSameNode
-
Field Details
-
FILE_TYPE_TO_TAG
Deprecated. -
TAG_TO_FILE_TYPE
Deprecated.
-
-
Constructor Details
-
SpdxFile
public SpdxFile(String name, String comment, Annotation[] annotations, Relationship[] relationships, AnyLicenseInfo licenseConcluded, AnyLicenseInfo[] licenseInfoInFile, String copyrightText, String licenseComment, SpdxFile.FileType[] fileTypes, Checksum[] checksums, String[] fileContributors, String noticeText, DoapProject[] artifactOf) throws InvalidSPDXAnalysisException- Parameters:
name- fileNamecomment- Comment on the fileannotations- annotations for the filerelationships- Relationships to this filelicenseConcluded-licenseInfoInFile-copyrightText-licenseComment-- Throws:
InvalidSPDXAnalysisException
-
SpdxFile
public SpdxFile(String fileName, SpdxFile.FileType[] fileTypes, String sha1Value, AnyLicenseInfo licenseConcluded, AnyLicenseInfo[] licenseInfoInFiles, String licenseComment, String copyrightText, DoapProject[] artifactOfs, String fileComment) throws InvalidSPDXAnalysisException- Parameters:
fileName-fileTypes-sha1Value-licenseConcluded-licenseInfoInFiles-licenseComment-copyrightText-artifactOfs-fileComment-- Throws:
InvalidSPDXAnalysisException
-
SpdxFile
public SpdxFile(IModelContainer modelContainer, org.apache.jena.graph.Node node) throws InvalidSPDXAnalysisException- Parameters:
modelContainer-node-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
getPropertiesFromModel
Description copied from class:RdfModelObjectFetch all of the properties from the model and populate the local Java properties- Overrides:
getPropertiesFromModelin classSpdxItem- Throws:
InvalidSPDXAnalysisException
-
findFileResource
protected static org.apache.jena.rdf.model.Resource findFileResource(IModelContainer modelContainer, SpdxFile spdxFile) throws InvalidSPDXAnalysisExceptionFinds the resource for an existing file in the model- Parameters:
spdxFile-- Returns:
- resource of an SPDX file with the same name and checksum. Null if none found
- Throws:
InvalidSPDXAnalysisException
-
findDuplicateResource
public org.apache.jena.rdf.model.Resource findDuplicateResource(IModelContainer modelContainer, String uri) throws InvalidSPDXAnalysisExceptionDescription copied from class:RdfModelObjectSearch the model to see if there is a duplicate resource either based on the URI or based on other information. Subclasses may choose to override this method to prevent duplicate resource from being created with the same properties.- Overrides:
findDuplicateResourcein classRdfModelObject- Returns:
- Any duplicate resource found. Null if no duplicate resource was found.
- Throws:
InvalidSPDXAnalysisException
-
getSha1
- Returns:
- the Sha1 checksum value for this file, or a blank string if no sha1 checksum has been set
-
populateModel
Description copied from class:RdfModelObjectPopulate the RDF model from the Java properties- Overrides:
populateModelin classSpdxItem- Throws:
InvalidSPDXAnalysisException
-
getLicenseInfoFromFilesPropertyName
- Overrides:
getLicenseInfoFromFilesPropertyNamein classSpdxItem- Returns:
- Property name for licenseInfoFromFiles. Override if using a subproperty of "licenseDeclared".
-
getNamePropertyName
- Overrides:
getNamePropertyNamein classSpdxElement- Returns:
- the property name used for the Name property. Override this function if using a subproperty of SPDX Name
-
getType
public org.apache.jena.rdf.model.Resource getType(org.apache.jena.rdf.model.Model model) -
getFileTypes
- Returns:
- the fileType
-
setFileTypes
- Parameters:
fileTypes- the fileTypes to set- Throws:
InvalidSPDXAnalysisException
-
addFileType
Add a file type to this file- Parameters:
fileType-- Throws:
InvalidSPDXAnalysisException
-
getChecksums
- Returns:
- the checksums
-
setChecksums
- Parameters:
checksums- the checksums to set- Throws:
InvalidSPDXAnalysisException
-
addChecksum
Add a checksum- Parameters:
checksum-- Throws:
InvalidSPDXAnalysisException
-
getFileContributors
- Returns:
- the fileContributors
-
setFileContributors
- Parameters:
fileContributors- the fileContributors to set
-
getNoticeText
- Returns:
- the noticeText
-
setNoticeText
- Parameters:
noticeText- the noticeText to set
-
getArtifactOf
Deprecated.Artifact of has been replaced by a relationship to a package with the filesAnalyzed set to false- Returns:
- the artifactOf
-
setArtifactOf
@Deprecated public void setArtifactOf(DoapProject[] artifactOf) throws InvalidSPDXAnalysisExceptionDeprecated.Artifact of has been replaced by a relationship to a package with the filesAnalyzed set to false- Parameters:
artifactOf- the artifactOf to set- Throws:
InvalidSPDXAnalysisException
-
getFileDependencies
Deprecated.This method should no longer be used. The Relationship property should be used in its place.- Returns:
- the fileDependencies
-
setFileDependencies
@Deprecated public void setFileDependencies(SpdxFile[] fileDependencies) throws InvalidSPDXAnalysisExceptionDeprecated.This method should no longer be used. The Relationship property should be used in its place.- Parameters:
fileDependencies- the fileDependencies to set- Throws:
InvalidSPDXAnalysisException
-
equivalent
Description copied from interface:IRdfModelReturns true if the compare object contains properties which would be equal if they were contained in the same RDF Model- Specified by:
equivalentin interfaceIRdfModel- Overrides:
equivalentin classSpdxItem- Returns:
-
equivalent
Description copied from class:SpdxElementTest for equivalent- Overrides:
equivalentin classSpdxItemtestRelationships- If true, test relationships- Returns:
-
cloneChecksum
-
cloneArtifactOf
-
cloneFileDependencies
-
clone
Description copied from class:SpdxElementClones this element, but prevents infinite recursion by keeping track of all elements which have been cloned -
clone
-
verify
-
compareTo
This method is used for sorting a list of SPDX files- Specified by:
compareToin interfaceComparable<SpdxFile>- Parameters:
file- SPDXFile that is compared- Returns:
-
getCopyright
Deprecated.This method should be replaced by the more consistent getCopyrightText This method will be removed in a future release- Returns:
-
setCopyright
Deprecated.This method should be replaced by the more consistent setCopyrightText This method will be removed in a future release- Parameters:
copyright-
-
getConcludedLicenses
Deprecated.This method should be replaced by the more consistent getLicenseConcluded This method will be removed in a future release- Returns:
-
setConcludedLicenses
@Deprecated public void setConcludedLicenses(AnyLicenseInfo concludedLicense) throws InvalidSPDXAnalysisExceptionDeprecated.This method should be replaced by the more consistent setLicenseConcluded This method will be removed in a future release- Throws:
InvalidSPDXAnalysisException
-
getContributors
Deprecated.This method should be replaced by the more consistent getFileContributors This method will be removed in a future release- Returns:
-
setContributors
Deprecated.This method should be replaced by the more consistent setFileContributors This method will be removed in a future release -
getSeenLicenses
Deprecated.This method should be replaced by the more consistent getLicenseInfoFromFiles This method will be removed in a future release- Returns:
-
setSeenLicenses
@Deprecated public void setSeenLicenses(AnyLicenseInfo[] seenLicenses) throws InvalidSPDXAnalysisExceptionDeprecated.This method should be replaced by the more consistent setLicenseInfoFromFiles This method will be removed in a future release- Throws:
InvalidSPDXAnalysisException
-