Class PackagePropertiesPart
- java.lang.Object
-
- org.apache.poi.openxml4j.opc.PackagePart
-
- org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart
-
- All Implemented Interfaces:
Comparable<PackagePart>,PackageProperties,RelationshipSource
public final class PackagePropertiesPart extends PackagePart implements PackageProperties
Represents the core properties part of a package.
-
-
Field Summary
Fields Modifier and Type Field Description protected Optional<String>categoryA categorization of the content of this package.protected Optional<String>contentStatusThe status of the content.protected Optional<String>contentTypeThe type of content represented, generally defined by a specific use and intended audience.protected Optional<Date>createdDate of creation of the resource.protected Optional<String>creatorAn entity primarily responsible for making the content of the resource.protected Optional<String>descriptionAn explanation of the content of the resource.protected Optional<String>identifierAn unambiguous reference to the resource within a given context.protected Optional<String>keywordsA delimited set of keywords to support searching and indexing.protected Optional<String>languageThe language of the intellectual content of the resource.protected Optional<String>lastModifiedByThe user who performed the last modification.protected Optional<Date>lastPrintedThe date and time of the last printing.protected Optional<Date>modifiedDate on which the resource was changed.static StringNAMESPACE_CP_URIstatic StringNAMESPACE_DC_URIstatic StringNAMESPACE_DCTERMS_URIprotected Optional<String>revisionThe revision number.protected Optional<String>subjectThe topic of the content of the resource.protected Optional<String>titleThe name given to the resource.protected Optional<String>versionThe version number.-
Fields inherited from class org.apache.poi.openxml4j.opc.PackagePart
_container, _contentType, _partName
-
Fields inherited from interface org.apache.poi.openxml4j.opc.PackageProperties
NAMESPACE_DC, NAMESPACE_DCTERMS
-
-
Constructor Summary
Constructors Constructor Description PackagePropertiesPart(OPCPackage pack, PackagePartName partName)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close this part : flush this part, close the input stream and output stream.voidflush()Flush the content of this part.Optional<String>getCategoryProperty()Get the category property.Optional<String>getContentStatusProperty()Get content status.Optional<String>getContentTypeProperty()Get content type.Optional<Date>getCreatedProperty()Get created date.StringgetCreatedPropertyString()Get created date formatted into a String.Optional<String>getCreatorProperty()Get creator.Optional<String>getDescriptionProperty()Get description.Optional<String>getIdentifierProperty()Get identifier.protected InputStreamgetInputStreamImpl()Method that gets the input stream for this part.Optional<String>getKeywordsProperty()Get keywords.Optional<String>getLanguageProperty()Get the language.Optional<String>getLastModifiedByProperty()Get the author of last modifications.Optional<Date>getLastPrintedProperty()Get last printed date.StringgetLastPrintedPropertyString()Get last printed date formatted into a String.Optional<Date>getModifiedProperty()Get modified date.StringgetModifiedPropertyString()Get modified date formatted into a String.protected OutputStreamgetOutputStreamImpl()Method that gets the output stream for this part.Optional<String>getRevisionProperty()Get revision.Optional<String>getSubjectProperty()Get subject.Optional<String>getTitleProperty()Get title.Optional<String>getVersionProperty()Get version.booleanload(InputStream ios)Load the content of this part.booleansave(OutputStream zos)Save the content of this part and the associated relationships part (if this part own at least one relationship) into the specified output stream.voidsetCategoryProperty(String category)Set the category.voidsetCategoryProperty(Optional<String> category)Set the category.voidsetContentStatusProperty(String contentStatus)Set the content status.voidsetContentStatusProperty(Optional<String> contentStatus)Set the content status.voidsetContentTypeProperty(String contentType)Set the content type.voidsetContentTypeProperty(Optional<String> contentType)Set the content type.voidsetCreatedProperty(String created)Set the created date.voidsetCreatedProperty(Optional<Date> created)Set the created date.voidsetCreatorProperty(String creator)Set the creator.voidsetCreatorProperty(Optional<String> creator)Set the creator.voidsetDescriptionProperty(String description)Set the description.voidsetDescriptionProperty(Optional<String> description)Set the description.voidsetIdentifierProperty(String identifier)Set identifier.voidsetIdentifierProperty(Optional<String> identifier)Set identifier.voidsetKeywordsProperty(String keywords)Set keywords.voidsetKeywordsProperty(Optional<String> keywords)Set keywords.voidsetLanguageProperty(String language)Set language.voidsetLanguageProperty(Optional<String> language)Set language.voidsetLastModifiedByProperty(String lastModifiedBy)Set last modifications author.voidsetLastModifiedByProperty(Optional<String> lastModifiedBy)Set last modifications author.voidsetLastPrintedProperty(String lastPrinted)Set last printed date.voidsetLastPrintedProperty(Optional<Date> lastPrinted)Set last printed date.voidsetModifiedProperty(String modified)Set last modification date.voidsetModifiedProperty(Optional<Date> modified)Set last modification date.voidsetRevisionProperty(String revision)Set revision.voidsetRevisionProperty(Optional<String> revision)Set revision.voidsetSubjectProperty(String subject)Set subject.voidsetSubjectProperty(Optional<String> subject)Set subject.voidsetTitleProperty(String title)Set title.voidsetTitleProperty(Optional<String> title)Set title.voidsetVersionProperty(String version)Set version.voidsetVersionProperty(Optional<String> version)Set version.-
Methods inherited from class org.apache.poi.openxml4j.opc.PackagePart
addExternalRelationship, addExternalRelationship, addRelationship, addRelationship, addRelationship, addRelationship, clear, clearRelationships, compareTo, findExistingRelation, getContentType, getContentTypeDetails, getInputStream, getOutputStream, getPackage, getPartName, getRelatedPart, getRelationship, getRelationships, getRelationshipsByType, getSize, hasRelationships, isDeleted, isRelationshipExists, isRelationshipPart, removeRelationship, setContentType, setDeleted, toString
-
-
-
-
Field Detail
-
NAMESPACE_DC_URI
public static final String NAMESPACE_DC_URI
- See Also:
- Constant Field Values
-
NAMESPACE_CP_URI
public static final String NAMESPACE_CP_URI
- See Also:
- Constant Field Values
-
NAMESPACE_DCTERMS_URI
public static final String NAMESPACE_DCTERMS_URI
- See Also:
- Constant Field Values
-
category
protected Optional<String> category
A categorization of the content of this package. [Example: Example values for this property might include: Resume, Letter, Financial Forecast, Proposal, Technical Presentation, and so on. This value might be used by an application's user interface to facilitate navigation of a large set of documents. end example]
-
contentStatus
protected Optional<String> contentStatus
The status of the content. [Example: Values might include "Draft", "Reviewed", and "Final". end example]
-
contentType
protected Optional<String> contentType
The type of content represented, generally defined by a specific use and intended audience. [Example: Values might include "Whitepaper", "Security Bulletin", and "Exam". end example] [Note: This property is distinct from MIME content types as defined in RFC 2616. end note]
-
creator
protected Optional<String> creator
An entity primarily responsible for making the content of the resource.
-
description
protected Optional<String> description
An explanation of the content of the resource. [Example: Values might include an abstract, table of contents, reference to a graphical representation of content, and a free-text account of the content. end example]
-
identifier
protected Optional<String> identifier
An unambiguous reference to the resource within a given context.
-
keywords
protected Optional<String> keywords
A delimited set of keywords to support searching and indexing. This is typically a list of terms that are not available elsewhere in the properties.
-
language
protected Optional<String> language
The language of the intellectual content of the resource. [Note: IETF RFC 3066 provides guidance on encoding to represent languages. end note]
-
lastModifiedBy
protected Optional<String> lastModifiedBy
The user who performed the last modification. The identification is environment-specific. [Example: A name, email address, or employee ID. end example] It is recommended that this value be as concise as possible.
-
revision
protected Optional<String> revision
The revision number. [Example: This value might indicate the number of saves or revisions, provided the application updates it after each revision. end example]
-
-
Constructor Detail
-
PackagePropertiesPart
public PackagePropertiesPart(OPCPackage pack, PackagePartName partName) throws InvalidFormatException
Constructor.- Parameters:
pack- Container package.partName- Name of this part.- Throws:
InvalidFormatException- Throws if the content is invalid.
-
-
Method Detail
-
getCategoryProperty
public Optional<String> getCategoryProperty()
Get the category property.- Specified by:
getCategoryPropertyin interfacePackageProperties- Returns:
- property value
-
getContentStatusProperty
public Optional<String> getContentStatusProperty()
Get content status.- Specified by:
getContentStatusPropertyin interfacePackageProperties- Returns:
- property value
-
getContentTypeProperty
public Optional<String> getContentTypeProperty()
Get content type.- Specified by:
getContentTypePropertyin interfacePackageProperties- Returns:
- property value
-
getCreatedProperty
public Optional<Date> getCreatedProperty()
Get created date.- Specified by:
getCreatedPropertyin interfacePackageProperties- Returns:
- property value
-
getCreatedPropertyString
public String getCreatedPropertyString()
Get created date formatted into a String.- Returns:
- A string representation of the created date.
-
getCreatorProperty
public Optional<String> getCreatorProperty()
Get creator.- Specified by:
getCreatorPropertyin interfacePackageProperties- Returns:
- property value
-
getDescriptionProperty
public Optional<String> getDescriptionProperty()
Get description.- Specified by:
getDescriptionPropertyin interfacePackageProperties
-
getIdentifierProperty
public Optional<String> getIdentifierProperty()
Get identifier.- Specified by:
getIdentifierPropertyin interfacePackageProperties- Returns:
- property value
-
getKeywordsProperty
public Optional<String> getKeywordsProperty()
Get keywords.- Specified by:
getKeywordsPropertyin interfacePackageProperties- Returns:
- property value
-
getLanguageProperty
public Optional<String> getLanguageProperty()
Get the language.- Specified by:
getLanguagePropertyin interfacePackageProperties- Returns:
- property value
-
getLastModifiedByProperty
public Optional<String> getLastModifiedByProperty()
Get the author of last modifications.- Specified by:
getLastModifiedByPropertyin interfacePackageProperties
-
getLastPrintedProperty
public Optional<Date> getLastPrintedProperty()
Get last printed date.- Specified by:
getLastPrintedPropertyin interfacePackageProperties- Returns:
- property value
-
getLastPrintedPropertyString
public String getLastPrintedPropertyString()
Get last printed date formatted into a String.- Returns:
- A string representation of the last printed date.
-
getModifiedProperty
public Optional<Date> getModifiedProperty()
Get modified date.- Specified by:
getModifiedPropertyin interfacePackageProperties- Returns:
- property value
-
getModifiedPropertyString
public String getModifiedPropertyString()
Get modified date formatted into a String.- Returns:
- A string representation of the modified date.
-
getRevisionProperty
public Optional<String> getRevisionProperty()
Get revision.- Specified by:
getRevisionPropertyin interfacePackageProperties- Returns:
- property value
-
getSubjectProperty
public Optional<String> getSubjectProperty()
Get subject.- Specified by:
getSubjectPropertyin interfacePackageProperties- Returns:
- property value
-
getTitleProperty
public Optional<String> getTitleProperty()
Get title.- Specified by:
getTitlePropertyin interfacePackageProperties- Returns:
- property value
-
getVersionProperty
public Optional<String> getVersionProperty()
Get version.- Specified by:
getVersionPropertyin interfacePackageProperties- Returns:
- property value
-
setCategoryProperty
public void setCategoryProperty(String category)
Set the category.- Specified by:
setCategoryPropertyin interfacePackageProperties
-
setCategoryProperty
public void setCategoryProperty(Optional<String> category)
Set the category.- Specified by:
setCategoryPropertyin interfacePackageProperties
-
setContentStatusProperty
public void setContentStatusProperty(String contentStatus)
Set the content status.- Specified by:
setContentStatusPropertyin interfacePackageProperties
-
setContentStatusProperty
public void setContentStatusProperty(Optional<String> contentStatus)
Set the content status.- Specified by:
setContentStatusPropertyin interfacePackageProperties
-
setContentTypeProperty
public void setContentTypeProperty(String contentType)
Set the content type.- Specified by:
setContentTypePropertyin interfacePackageProperties
-
setContentTypeProperty
public void setContentTypeProperty(Optional<String> contentType)
Set the content type.- Specified by:
setContentTypePropertyin interfacePackageProperties
-
setCreatedProperty
public void setCreatedProperty(String created) throws InvalidFormatException
Set the created date.- Specified by:
setCreatedPropertyin interfacePackageProperties- Throws:
InvalidFormatException- only since POI 5.2.0, used to throw unchecked exception IllegalArgumentException if format was invalid- See Also:
PackageProperties.setCreatedProperty(java.util.Optional)
-
setCreatedProperty
public void setCreatedProperty(Optional<Date> created)
Set the created date.- Specified by:
setCreatedPropertyin interfacePackageProperties
-
setCreatorProperty
public void setCreatorProperty(String creator)
Set the creator.- Specified by:
setCreatorPropertyin interfacePackageProperties
-
setCreatorProperty
public void setCreatorProperty(Optional<String> creator)
Set the creator.- Specified by:
setCreatorPropertyin interfacePackageProperties
-
setDescriptionProperty
public void setDescriptionProperty(String description)
Set the description.- Specified by:
setDescriptionPropertyin interfacePackageProperties
-
setDescriptionProperty
public void setDescriptionProperty(Optional<String> description)
Set the description.- Specified by:
setDescriptionPropertyin interfacePackageProperties
-
setIdentifierProperty
public void setIdentifierProperty(String identifier)
Set identifier.- Specified by:
setIdentifierPropertyin interfacePackageProperties
-
setIdentifierProperty
public void setIdentifierProperty(Optional<String> identifier)
Set identifier.- Specified by:
setIdentifierPropertyin interfacePackageProperties
-
setKeywordsProperty
public void setKeywordsProperty(String keywords)
Set keywords.- Specified by:
setKeywordsPropertyin interfacePackageProperties
-
setKeywordsProperty
public void setKeywordsProperty(Optional<String> keywords)
Set keywords.- Specified by:
setKeywordsPropertyin interfacePackageProperties
-
setLanguageProperty
public void setLanguageProperty(String language)
Set language.- Specified by:
setLanguagePropertyin interfacePackageProperties
-
setLanguageProperty
public void setLanguageProperty(Optional<String> language)
Set language.- Specified by:
setLanguagePropertyin interfacePackageProperties
-
setLastModifiedByProperty
public void setLastModifiedByProperty(String lastModifiedBy)
Set last modifications author.- Specified by:
setLastModifiedByPropertyin interfacePackageProperties
-
setLastModifiedByProperty
public void setLastModifiedByProperty(Optional<String> lastModifiedBy)
Set last modifications author.- Specified by:
setLastModifiedByPropertyin interfacePackageProperties
-
setLastPrintedProperty
public void setLastPrintedProperty(String lastPrinted) throws InvalidFormatException
Set last printed date.- Specified by:
setLastPrintedPropertyin interfacePackageProperties- Throws:
InvalidFormatException- only since POI 5.2.0, used to throw unchecked exception IllegalArgumentException if format was invalid- See Also:
PackageProperties.setLastPrintedProperty(java.util.Optional)
-
setLastPrintedProperty
public void setLastPrintedProperty(Optional<Date> lastPrinted)
Set last printed date.- Specified by:
setLastPrintedPropertyin interfacePackageProperties
-
setModifiedProperty
public void setModifiedProperty(String modified) throws InvalidFormatException
Set last modification date.- Specified by:
setModifiedPropertyin interfacePackageProperties- Throws:
InvalidFormatException- only since POI 5.2.0, used to throw unchecked exception IllegalArgumentException if format was invalid- See Also:
PackageProperties.setModifiedProperty(java.util.Optional)
-
setModifiedProperty
public void setModifiedProperty(Optional<Date> modified)
Set last modification date.- Specified by:
setModifiedPropertyin interfacePackageProperties
-
setRevisionProperty
public void setRevisionProperty(Optional<String> revision)
Set revision.- Specified by:
setRevisionPropertyin interfacePackageProperties
-
setRevisionProperty
public void setRevisionProperty(String revision)
Set revision.- Specified by:
setRevisionPropertyin interfacePackageProperties
-
setSubjectProperty
public void setSubjectProperty(String subject)
Set subject.- Specified by:
setSubjectPropertyin interfacePackageProperties
-
setSubjectProperty
public void setSubjectProperty(Optional<String> subject)
Set subject.- Specified by:
setSubjectPropertyin interfacePackageProperties
-
setTitleProperty
public void setTitleProperty(String title)
Set title.- Specified by:
setTitlePropertyin interfacePackageProperties
-
setTitleProperty
public void setTitleProperty(Optional<String> title)
Set title.- Specified by:
setTitlePropertyin interfacePackageProperties
-
setVersionProperty
public void setVersionProperty(String version)
Set version.- Specified by:
setVersionPropertyin interfacePackageProperties
-
setVersionProperty
public void setVersionProperty(Optional<String> version)
Set version.- Specified by:
setVersionPropertyin interfacePackageProperties
-
getInputStreamImpl
protected InputStream getInputStreamImpl()
Description copied from class:PackagePartMethod that gets the input stream for this part.- Specified by:
getInputStreamImplin classPackagePart- Returns:
- input stream for this part
-
getOutputStreamImpl
protected OutputStream getOutputStreamImpl()
Description copied from class:PackagePartMethod that gets the output stream for this part.- Specified by:
getOutputStreamImplin classPackagePart- Returns:
- output stream for this part
-
save
public boolean save(OutputStream zos)
Description copied from class:PackagePartSave the content of this part and the associated relationships part (if this part own at least one relationship) into the specified output stream.- Specified by:
savein classPackagePart- Parameters:
zos- Output stream to save this part.- Returns:
- true if the content has been successfully stored, false otherwise. More information about errors may be logged via Log4j 2.
-
load
public boolean load(InputStream ios)
Description copied from class:PackagePartLoad the content of this part.- Specified by:
loadin classPackagePart- Parameters:
ios- The input stream of the content to load.- Returns:
- true if the content has been successfully loaded, false otherwise. More information about errors may be logged via Log4j 2.
-
close
public void close()
Description copied from class:PackagePartClose this part : flush this part, close the input stream and output stream. After this method call, the part must be available for packaging.- Specified by:
closein classPackagePart
-
flush
public void flush()
Description copied from class:PackagePartFlush the content of this part. If the input stream and/or output stream as in a waiting state to read or write, the must to empty their respective buffer.- Specified by:
flushin classPackagePart
-
-