org.apache.poi
Class POIXMLDocumentPart

java.lang.Object
  extended by org.apache.poi.POIXMLDocumentPart
Direct Known Subclasses:
CalculationChain, CommentsTable, MapInfo, POIXMLDocument, SharedStringsTable, SingleXmlCells, StylesTable, ThemesTable, XSLFCommentAuthors, XSLFComments, XSLFPictureData, XSLFSheet, XSLFTableStyles, XSLFTheme, XSSFChart, XSSFDrawing, XSSFPictureData, XSSFSheet, XSSFTable, XSSFVMLDrawing, XWPFFootnotes, XWPFHeaderFooter, XWPFNumbering, XWPFPictureData, XWPFSettings, XWPFStyles

public class POIXMLDocumentPart
extends java.lang.Object

Represents an entry of a OOXML package.

Each POIXMLDocumentPart keeps a reference to the underlying a PackagePart.

Author:
Yegor Kozlov

Field Summary
static org.apache.xmlbeans.XmlOptions DEFAULT_XML_OPTIONS
           
 
Constructor Summary
POIXMLDocumentPart()
          Creates new POIXMLDocumentPart - called by client code to create new parts from scratch.
POIXMLDocumentPart(OPCPackage pkg)
          Construct POIXMLDocumentPart representing a "core document" package part.
POIXMLDocumentPart(PackagePart part, PackageRelationship rel)
          Creates an POIXMLDocumentPart representing the given package part and relationship.
POIXMLDocumentPart(POIXMLDocumentPart parent, PackagePart part, PackageRelationship rel)
          Creates an POIXMLDocumentPart representing the given package part, relationship and parent Called by read(POIXMLFactory, java.util.Map) when reading in an exisiting file.
 
Method Summary
 void addRelation(java.lang.String id, POIXMLDocumentPart part)
          Add a new child POIXMLDocumentPart
 POIXMLDocumentPart createRelationship(POIXMLRelation descriptor, POIXMLFactory factory)
          Create a new child POIXMLDocumentPart
 POIXMLDocumentPart createRelationship(POIXMLRelation descriptor, POIXMLFactory factory, int idx)
           
 PackagePart getPackagePart()
          Provides access to the underlying PackagePart
 PackageRelationship getPackageRelationship()
          Provides access to the PackageRelationship that identifies this POIXMLDocumentPart
 POIXMLDocumentPart getParent()
          Returns the parent POIXMLDocumentPart.
 POIXMLDocumentPart getRelationById(java.lang.String id)
          Returns the target POIXMLDocumentPart, where a PackageRelationship is set from the PackagePart of this POIXMLDocumentPart to the PackagePart of the target POIXMLDocumentPart with a PackageRelationship.getId() matching the given parameter value.
 java.lang.String getRelationId(POIXMLDocumentPart part)
          Returns the PackageRelationship.getId() of the PackageRelationship, that sources from the PackagePart of this POIXMLDocumentPart to the PackagePart of the given parameter value.
 java.util.List getRelations()
          Returns the list of child relations for this POIXMLDocumentPart
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_XML_OPTIONS

public static final org.apache.xmlbeans.XmlOptions DEFAULT_XML_OPTIONS
Constructor Detail

POIXMLDocumentPart

public POIXMLDocumentPart(OPCPackage pkg)
Construct POIXMLDocumentPart representing a "core document" package part.


POIXMLDocumentPart

public POIXMLDocumentPart()
Creates new POIXMLDocumentPart - called by client code to create new parts from scratch.

See Also:
createRelationship(POIXMLRelation, POIXMLFactory, int, boolean)

POIXMLDocumentPart

public POIXMLDocumentPart(PackagePart part,
                          PackageRelationship rel)
Creates an POIXMLDocumentPart representing the given package part and relationship. Called by read(POIXMLFactory, java.util.Map) when reading in an exisiting file.

Parameters:
part - - The package part that holds xml data represenring this sheet.
rel - - the relationship of the given package part
See Also:
read(POIXMLFactory, java.util.Map)

POIXMLDocumentPart

public POIXMLDocumentPart(POIXMLDocumentPart parent,
                          PackagePart part,
                          PackageRelationship rel)
Creates an POIXMLDocumentPart representing the given package part, relationship and parent Called by read(POIXMLFactory, java.util.Map) when reading in an exisiting file.

Parameters:
parent - - Parent part
part - - The package part that holds xml data represenring this sheet.
rel - - the relationship of the given package part
See Also:
read(POIXMLFactory, java.util.Map)
Method Detail

getPackagePart

public final PackagePart getPackagePart()
Provides access to the underlying PackagePart

Returns:
the underlying PackagePart

getPackageRelationship

public final PackageRelationship getPackageRelationship()
Provides access to the PackageRelationship that identifies this POIXMLDocumentPart

Returns:
the PackageRelationship that identifies this POIXMLDocumentPart

getRelations

public final java.util.List getRelations()
Returns the list of child relations for this POIXMLDocumentPart

Returns:
child relations

getRelationById

public final POIXMLDocumentPart getRelationById(java.lang.String id)
Returns the target POIXMLDocumentPart, where a PackageRelationship is set from the PackagePart of this POIXMLDocumentPart to the PackagePart of the target POIXMLDocumentPart with a PackageRelationship.getId() matching the given parameter value.

Parameters:
id - The relation id to look for
Returns:
the target part of the relation, or null, if none exists

getRelationId

public final java.lang.String getRelationId(POIXMLDocumentPart part)
Returns the PackageRelationship.getId() of the PackageRelationship, that sources from the PackagePart of this POIXMLDocumentPart to the PackagePart of the given parameter value.

Parameters:
part - The POIXMLDocumentPart for which the according relation-id shall be found.
Returns:
The value of the PackageRelationship.getId() or null, if parts are not related.

addRelation

public final void addRelation(java.lang.String id,
                              POIXMLDocumentPart part)
Add a new child POIXMLDocumentPart

Parameters:
part - the child to add

getParent

public final POIXMLDocumentPart getParent()
Returns the parent POIXMLDocumentPart. All parts except root have not-null parent.

Returns:
the parent POIXMLDocumentPart or null for the root element.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createRelationship

public final POIXMLDocumentPart createRelationship(POIXMLRelation descriptor,
                                                   POIXMLFactory factory)
Create a new child POIXMLDocumentPart

Parameters:
descriptor - the part descriptor
factory - the factory that will create an instance of the requested relation
Returns:
the created child POIXMLDocumentPart

createRelationship

public final POIXMLDocumentPart createRelationship(POIXMLRelation descriptor,
                                                   POIXMLFactory factory,
                                                   int idx)