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>
category
A categorization of the content of this package.protected Optional<String>
contentStatus
The status of the content.protected Optional<String>
contentType
The type of content represented, generally defined by a specific use and intended audience.protected Optional<Date>
created
Date of creation of the resource.protected Optional<String>
creator
An entity primarily responsible for making the content of the resource.protected Optional<String>
description
An explanation of the content of the resource.protected Optional<String>
identifier
An unambiguous reference to the resource within a given context.protected Optional<String>
keywords
A delimited set of keywords to support searching and indexing.protected Optional<String>
language
The language of the intellectual content of the resource.protected Optional<String>
lastModifiedBy
The user who performed the last modification.protected Optional<Date>
lastPrinted
The date and time of the last printing.protected Optional<Date>
modified
Date on which the resource was changed.static String
NAMESPACE_CP_URI
static String
NAMESPACE_DC_URI
static String
NAMESPACE_DCTERMS_URI
protected Optional<String>
revision
The revision number.protected Optional<String>
subject
The topic of the content of the resource.protected Optional<String>
title
The name given to the resource.protected Optional<String>
version
The 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 void
close()
Close this part : flush this part, close the input stream and output stream.void
flush()
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.String
getCreatedPropertyString()
Get created date formatted into a String.Optional<String>
getCreatorProperty()
Get creator.Optional<String>
getDescriptionProperty()
Get description.Optional<String>
getIdentifierProperty()
Get identifier.protected InputStream
getInputStreamImpl()
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.String
getLastPrintedPropertyString()
Get last printed date formatted into a String.Optional<Date>
getModifiedProperty()
Get modified date.String
getModifiedPropertyString()
Get modified date formatted into a String.protected OutputStream
getOutputStreamImpl()
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.boolean
load(InputStream ios)
Load the content of this part.boolean
save(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.void
setCategoryProperty(String category)
Set the category.void
setCategoryProperty(Optional<String> category)
Set the category.void
setContentStatusProperty(String contentStatus)
Set the content status.void
setContentStatusProperty(Optional<String> contentStatus)
Set the content status.void
setContentTypeProperty(String contentType)
Set the content type.void
setContentTypeProperty(Optional<String> contentType)
Set the content type.void
setCreatedProperty(String created)
Set the created date.void
setCreatedProperty(Optional<Date> created)
Set the created date.void
setCreatorProperty(String creator)
Set the creator.void
setCreatorProperty(Optional<String> creator)
Set the creator.void
setDescriptionProperty(String description)
Set the description.void
setDescriptionProperty(Optional<String> description)
Set the description.void
setIdentifierProperty(String identifier)
Set identifier.void
setIdentifierProperty(Optional<String> identifier)
Set identifier.void
setKeywordsProperty(String keywords)
Set keywords.void
setKeywordsProperty(Optional<String> keywords)
Set keywords.void
setLanguageProperty(String language)
Set language.void
setLanguageProperty(Optional<String> language)
Set language.void
setLastModifiedByProperty(String lastModifiedBy)
Set last modifications author.void
setLastModifiedByProperty(Optional<String> lastModifiedBy)
Set last modifications author.void
setLastPrintedProperty(String lastPrinted)
Set last printed date.void
setLastPrintedProperty(Optional<Date> lastPrinted)
Set last printed date.void
setModifiedProperty(String modified)
Set last modification date.void
setModifiedProperty(Optional<Date> modified)
Set last modification date.void
setRevisionProperty(String revision)
Set revision.void
setRevisionProperty(Optional<String> revision)
Set revision.void
setSubjectProperty(String subject)
Set subject.void
setSubjectProperty(Optional<String> subject)
Set subject.void
setTitleProperty(String title)
Set title.void
setTitleProperty(Optional<String> title)
Set title.void
setVersionProperty(String version)
Set version.void
setVersionProperty(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:
getCategoryProperty
in interfacePackageProperties
- Returns:
- property value
-
getContentStatusProperty
public Optional<String> getContentStatusProperty()
Get content status.- Specified by:
getContentStatusProperty
in interfacePackageProperties
- Returns:
- property value
-
getContentTypeProperty
public Optional<String> getContentTypeProperty()
Get content type.- Specified by:
getContentTypeProperty
in interfacePackageProperties
- Returns:
- property value
-
getCreatedProperty
public Optional<Date> getCreatedProperty()
Get created date.- Specified by:
getCreatedProperty
in 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:
getCreatorProperty
in interfacePackageProperties
- Returns:
- property value
-
getDescriptionProperty
public Optional<String> getDescriptionProperty()
Get description.- Specified by:
getDescriptionProperty
in interfacePackageProperties
-
getIdentifierProperty
public Optional<String> getIdentifierProperty()
Get identifier.- Specified by:
getIdentifierProperty
in interfacePackageProperties
- Returns:
- property value
-
getKeywordsProperty
public Optional<String> getKeywordsProperty()
Get keywords.- Specified by:
getKeywordsProperty
in interfacePackageProperties
- Returns:
- property value
-
getLanguageProperty
public Optional<String> getLanguageProperty()
Get the language.- Specified by:
getLanguageProperty
in interfacePackageProperties
- Returns:
- property value
-
getLastModifiedByProperty
public Optional<String> getLastModifiedByProperty()
Get the author of last modifications.- Specified by:
getLastModifiedByProperty
in interfacePackageProperties
-
getLastPrintedProperty
public Optional<Date> getLastPrintedProperty()
Get last printed date.- Specified by:
getLastPrintedProperty
in 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:
getModifiedProperty
in 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:
getRevisionProperty
in interfacePackageProperties
- Returns:
- property value
-
getSubjectProperty
public Optional<String> getSubjectProperty()
Get subject.- Specified by:
getSubjectProperty
in interfacePackageProperties
- Returns:
- property value
-
getTitleProperty
public Optional<String> getTitleProperty()
Get title.- Specified by:
getTitleProperty
in interfacePackageProperties
- Returns:
- property value
-
getVersionProperty
public Optional<String> getVersionProperty()
Get version.- Specified by:
getVersionProperty
in interfacePackageProperties
- Returns:
- property value
-
setCategoryProperty
public void setCategoryProperty(String category)
Set the category.- Specified by:
setCategoryProperty
in interfacePackageProperties
-
setCategoryProperty
public void setCategoryProperty(Optional<String> category)
Set the category.- Specified by:
setCategoryProperty
in interfacePackageProperties
-
setContentStatusProperty
public void setContentStatusProperty(String contentStatus)
Set the content status.- Specified by:
setContentStatusProperty
in interfacePackageProperties
-
setContentStatusProperty
public void setContentStatusProperty(Optional<String> contentStatus)
Set the content status.- Specified by:
setContentStatusProperty
in interfacePackageProperties
-
setContentTypeProperty
public void setContentTypeProperty(String contentType)
Set the content type.- Specified by:
setContentTypeProperty
in interfacePackageProperties
-
setContentTypeProperty
public void setContentTypeProperty(Optional<String> contentType)
Set the content type.- Specified by:
setContentTypeProperty
in interfacePackageProperties
-
setCreatedProperty
public void setCreatedProperty(String created) throws InvalidFormatException
Set the created date.- Specified by:
setCreatedProperty
in 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:
setCreatedProperty
in interfacePackageProperties
-
setCreatorProperty
public void setCreatorProperty(String creator)
Set the creator.- Specified by:
setCreatorProperty
in interfacePackageProperties
-
setCreatorProperty
public void setCreatorProperty(Optional<String> creator)
Set the creator.- Specified by:
setCreatorProperty
in interfacePackageProperties
-
setDescriptionProperty
public void setDescriptionProperty(String description)
Set the description.- Specified by:
setDescriptionProperty
in interfacePackageProperties
-
setDescriptionProperty
public void setDescriptionProperty(Optional<String> description)
Set the description.- Specified by:
setDescriptionProperty
in interfacePackageProperties
-
setIdentifierProperty
public void setIdentifierProperty(String identifier)
Set identifier.- Specified by:
setIdentifierProperty
in interfacePackageProperties
-
setIdentifierProperty
public void setIdentifierProperty(Optional<String> identifier)
Set identifier.- Specified by:
setIdentifierProperty
in interfacePackageProperties
-
setKeywordsProperty
public void setKeywordsProperty(String keywords)
Set keywords.- Specified by:
setKeywordsProperty
in interfacePackageProperties
-
setKeywordsProperty
public void setKeywordsProperty(Optional<String> keywords)
Set keywords.- Specified by:
setKeywordsProperty
in interfacePackageProperties
-
setLanguageProperty
public void setLanguageProperty(String language)
Set language.- Specified by:
setLanguageProperty
in interfacePackageProperties
-
setLanguageProperty
public void setLanguageProperty(Optional<String> language)
Set language.- Specified by:
setLanguageProperty
in interfacePackageProperties
-
setLastModifiedByProperty
public void setLastModifiedByProperty(String lastModifiedBy)
Set last modifications author.- Specified by:
setLastModifiedByProperty
in interfacePackageProperties
-
setLastModifiedByProperty
public void setLastModifiedByProperty(Optional<String> lastModifiedBy)
Set last modifications author.- Specified by:
setLastModifiedByProperty
in interfacePackageProperties
-
setLastPrintedProperty
public void setLastPrintedProperty(String lastPrinted) throws InvalidFormatException
Set last printed date.- Specified by:
setLastPrintedProperty
in 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:
setLastPrintedProperty
in interfacePackageProperties
-
setModifiedProperty
public void setModifiedProperty(String modified) throws InvalidFormatException
Set last modification date.- Specified by:
setModifiedProperty
in 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:
setModifiedProperty
in interfacePackageProperties
-
setRevisionProperty
public void setRevisionProperty(Optional<String> revision)
Set revision.- Specified by:
setRevisionProperty
in interfacePackageProperties
-
setRevisionProperty
public void setRevisionProperty(String revision)
Set revision.- Specified by:
setRevisionProperty
in interfacePackageProperties
-
setSubjectProperty
public void setSubjectProperty(String subject)
Set subject.- Specified by:
setSubjectProperty
in interfacePackageProperties
-
setSubjectProperty
public void setSubjectProperty(Optional<String> subject)
Set subject.- Specified by:
setSubjectProperty
in interfacePackageProperties
-
setTitleProperty
public void setTitleProperty(String title)
Set title.- Specified by:
setTitleProperty
in interfacePackageProperties
-
setTitleProperty
public void setTitleProperty(Optional<String> title)
Set title.- Specified by:
setTitleProperty
in interfacePackageProperties
-
setVersionProperty
public void setVersionProperty(String version)
Set version.- Specified by:
setVersionProperty
in interfacePackageProperties
-
setVersionProperty
public void setVersionProperty(Optional<String> version)
Set version.- Specified by:
setVersionProperty
in interfacePackageProperties
-
getInputStreamImpl
protected InputStream getInputStreamImpl()
Description copied from class:PackagePart
Method that gets the input stream for this part.- Specified by:
getInputStreamImpl
in classPackagePart
- Returns:
- input stream for this part
-
getOutputStreamImpl
protected OutputStream getOutputStreamImpl()
Description copied from class:PackagePart
Method that gets the output stream for this part.- Specified by:
getOutputStreamImpl
in classPackagePart
- Returns:
- output stream for this part
-
save
public boolean save(OutputStream zos)
Description copied from class:PackagePart
Save 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:
save
in 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:PackagePart
Load the content of this part.- Specified by:
load
in 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:PackagePart
Close 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:
close
in classPackagePart
-
flush
public void flush()
Description copied from class:PackagePart
Flush 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:
flush
in classPackagePart
-
-