#60331 - Remove deprecated classes - remove constructors with PackageRelationship argument

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1772424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-12-03 00:49:08 +00:00
parent fda7104fd2
commit 21009c9abe
55 changed files with 32 additions and 572 deletions

View File

@ -165,37 +165,6 @@ public class POIXMLDocumentPart {
this.parent = parent;
}
/**
* Creates an POIXMLDocumentPart representing the given package part and relationship.
* Called by {@link #read(POIXMLFactory, java.util.Map)} when reading in an existing file.
*
* @param part - The package part that holds xml data representing this sheet.
* @param rel - the relationship of the given package part
* @see #read(POIXMLFactory, java.util.Map)
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public POIXMLDocumentPart(PackagePart part, PackageRelationship rel){
this(null, part);
}
/**
* Creates an POIXMLDocumentPart representing the given package part, relationship and parent
* Called by {@link #read(POIXMLFactory, java.util.Map)} when reading in an exisiting file.
*
* @param parent - Parent part
* @param part - The package part that holds xml data represenring this sheet.
* @param rel - the relationship of the given package part
* @see #read(POIXMLFactory, java.util.Map)
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public POIXMLDocumentPart(POIXMLDocumentPart parent, PackagePart part, PackageRelationship rel){
this(parent, part);
}
/**
* When you open something like a theme, call this to
* re-base the XML Document onto the core child of the
@ -227,34 +196,6 @@ public class POIXMLDocumentPart {
return packagePart;
}
/**
* Provides access to the PackageRelationship that identifies this POIXMLDocumentPart
*
* @return the PackageRelationship that identifies this POIXMLDocumentPart
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
@SuppressWarnings("resource")
public final PackageRelationship getPackageRelationship() {
if (this.parent != null) {
for (RelationPart rp : parent.getRelationParts()) {
if (rp.getDocumentPart() == this) {
return rp.getRelationship();
}
}
} else {
OPCPackage pkg = getPackagePart().getPackage();
String partName = getPackagePart().getPartName().getName();
for (PackageRelationship rel : pkg.getRelationships()) {
if (rel.getTargetURI().toASCIIString().equals(partName)) {
return rel;
}
}
}
return null;
}
/**
* Returns the list of child relations for this POIXMLDocumentPart
*
@ -315,20 +256,6 @@ public class POIXMLDocumentPart {
return null;
}
/**
* Add a new child POIXMLDocumentPart
*
* @param id the id of an existing child to replace
* @param part the child to add
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public final void addRelation(String id, POIXMLDocumentPart part) {
PackageRelationship pr = part.getPackagePart().getRelationship(id);
addRelation(pr, part);
}
/**
* Add a new child POIXMLDocumentPart
*

View File

@ -93,22 +93,6 @@ public abstract class POIXMLFactory {
*/
protected abstract POIXMLRelation getDescriptor(String relationshipType);
/**
* Create a POIXMLDocumentPart from existing package part and relation. This method is called
* from {@link POIXMLDocument#load(POIXMLFactory)} when parsing a document
*
* @param parent parent part
* @param rel the package part relationship
* @param part the PackagePart representing the created instance
* @return A new instance of a POIXMLDocumentPart.
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public final POIXMLDocumentPart createDocumentPart(POIXMLDocumentPart parent, PackageRelationship rel, PackagePart part) {
return createDocumentPart(parent, part);
}
/**
* Create a new POIXMLDocumentPart using the supplied descriptor. This method is used when adding new parts
* to a document, for example, when adding a sheet to a workbook, slide to a presentation, etc.

View File

@ -60,14 +60,6 @@ public class XDGFBaseContents extends XDGFXMLDocumentPart {
super(part, document);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XDGFBaseContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
this(part, document);
}
@Internal
public PageContentsType getXmlObject() {
return _pageContents;

View File

@ -21,7 +21,6 @@ import java.io.IOException;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.xdgf.exceptions.XDGFException;
import org.apache.xmlbeans.XmlException;
@ -41,15 +40,6 @@ public class XDGFMasterContents extends XDGFBaseContents {
super(part, document);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XDGFMasterContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
this(part, document);
}
@Override
protected void onDocumentRead() {

View File

@ -26,7 +26,6 @@ import java.util.Map;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Internal;
import org.apache.poi.xdgf.exceptions.XDGFException;
import org.apache.poi.xdgf.xml.XDGFXMLDocumentPart;
@ -53,14 +52,6 @@ public class XDGFMasters extends XDGFXMLDocumentPart {
super(part, document);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XDGFMasters(PackagePart part, PackageRelationship rel, XDGFDocument document) {
this(part, document);
}
@Internal
protected MastersType getXmlObject() {
return _mastersObject;

View File

@ -24,7 +24,6 @@ import java.util.Map;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.xdgf.exceptions.XDGFException;
import org.apache.xmlbeans.XmlException;
@ -42,14 +41,6 @@ public class XDGFPageContents extends XDGFBaseContents {
super(part, document);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XDGFPageContents(PackagePart part, PackageRelationship rel, XDGFDocument document) {
this(part, document);
}
@Override
protected void onDocumentRead() {
try {

View File

@ -24,7 +24,6 @@ import java.util.List;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Internal;
import org.apache.poi.xdgf.exceptions.XDGFException;
import org.apache.poi.xdgf.xml.XDGFXMLDocumentPart;
@ -52,14 +51,6 @@ public class XDGFPages extends XDGFXMLDocumentPart {
super(part, document);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XDGFPages(PackagePart part, PackageRelationship rel, XDGFDocument document) {
this(part, document);
}
@Internal
PagesType getXmlObject() {
return _pagesObject;

View File

@ -18,7 +18,6 @@ package org.apache.poi.xdgf.xml;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.xdgf.usermodel.XDGFDocument;
public class XDGFXMLDocumentPart extends POIXMLDocumentPart {
@ -32,13 +31,4 @@ public class XDGFXMLDocumentPart extends POIXMLDocumentPart {
super(part);
_document = document;
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XDGFXMLDocumentPart(PackagePart part, PackageRelationship rel, XDGFDocument document) {
this(part, document);
}
}

View File

@ -28,7 +28,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlException;
@ -70,21 +69,6 @@ public final class XSLFChart extends POIXMLDocumentPart {
chart = chartSpace.getChart();
}
/**
* Construct a chart from a package part.
*
* @param part the package part holding the chart data,
* the content type must be <code>application/vnd.openxmlformats-officedocument.drawingml.chart+xml</code>
* @param rel the package relationship holding this chart,
* the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSLFChart(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
/**
* Return the underlying CTChartSpace bean, the root element of the Chart part.
*

View File

@ -23,7 +23,6 @@ import java.io.IOException;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.presentationml.x2006.main.CTCommentAuthor;
@ -58,21 +57,6 @@ public class XSLFCommentAuthors extends POIXMLDocumentPart {
_authors = doc.getCmAuthorLst();
}
/**
* Construct a SpreadsheetML slide authors from a package part
*
* @param part the package part holding the comment authors data,
* the content type must be <code>application/vnd.openxmlformats-officedocument.commentAuthors+xml</code>
* @param rel the package relationship holding this comment authors,
* the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
XSLFCommentAuthors(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
public CTCommentAuthorList getCTCommentAuthorsList() {
return _authors;
}

View File

@ -23,7 +23,6 @@ import java.io.IOException;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.presentationml.x2006.main.CTComment;
@ -59,21 +58,6 @@ public class XSLFComments extends POIXMLDocumentPart {
_comments = doc.getCmLst();
}
/**
* Construct a SpreadsheetML slide comments from a package part
*
* @param part the package part holding the comments data,
* the content type must be <code>application/vnd.openxmlformats-officedocument.comments+xml</code>
* @param rel the package relationship holding this comments,
* the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments
*
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
XSLFComments(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
public CTCommentList getCTCommentsList() {
return _comments;
}

View File

@ -24,7 +24,6 @@ import java.util.List;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.usermodel.Notes;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
@ -65,14 +64,6 @@ implements Notes<XSLFShape,XSLFTextParagraph> {
setCommonSlideData(_notes.getCSld());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
XSLFNotes(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
private static CTNotesSlide prototype(){
CTNotesSlide ctNotes = CTNotesSlide.Factory.newInstance();
CTCommonSlideData cSld = ctNotes.addNewCSld();

View File

@ -24,7 +24,6 @@ import java.io.InputStream;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.usermodel.MasterSheet;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
@ -70,14 +69,6 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument;
setCommonSlideData(_slide.getCSld());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSLFNotesMaster(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
private static CTNotesMaster prototype() {
InputStream is = XSLFNotesMaster.class.getResourceAsStream("notesMaster.xml");
if (is == null) {

View File

@ -27,7 +27,6 @@ import java.io.OutputStream;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.image.ImageHeaderBitmap;
import org.apache.poi.sl.image.ImageHeaderEMF;
import org.apache.poi.sl.image.ImageHeaderPICT;
@ -68,19 +67,6 @@ public final class XSLFPictureData extends POIXMLDocumentPart implements Picture
super(part);
}
/**
* Construct XSLFPictureData from a package part
*
* @param part the package part holding the drawing data,
* @param rel the package relationship holding this drawing,
* the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XSLFPictureData(PackagePart part, PackageRelationship rel) {
this(part);
}
/**
* An InputStream to read the picture data directly
* from the underlying package part

View File

@ -81,14 +81,6 @@ implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XSLFSheet(PackagePart part, PackageRelationship rel){
this(part);
}
/**
* @return the XMLSlideShow this sheet belongs to
*/

View File

@ -23,7 +23,6 @@ import java.io.IOException;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.draw.Drawable;
import org.apache.poi.sl.usermodel.Notes;
@ -33,7 +32,6 @@ import org.apache.poi.util.Beta;
import org.apache.poi.util.DocumentHelper;
import org.apache.poi.util.NotImplemented;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGroupTransform2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
@ -88,15 +86,6 @@ implements Slide<XSLFShape,XSLFTextParagraph> {
setCommonSlideData(_slide.getCSld());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
XSLFSlide(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
private static CTSlide prototype(){
CTSlide ctSlide = CTSlide.Factory.newInstance();
CTCommonSlideData cSld = ctSlide.addNewCSld();

View File

@ -22,7 +22,6 @@ import java.io.IOException;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.usermodel.MasterSheet;
import org.apache.poi.sl.usermodel.Placeholder;
import org.apache.poi.util.Beta;
@ -55,14 +54,6 @@ implements MasterSheet<XSLFShape,XSLFTextParagraph> {
setCommonSlideData(_layout.getCSld());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XSLFSlideLayout(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
public String getName() {
return _layout.getCSld().getName();
}

View File

@ -25,7 +25,6 @@ import java.util.Map;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.sl.usermodel.MasterSheet;
import org.apache.poi.sl.usermodel.Placeholder;
import org.apache.poi.util.Beta;
@ -80,14 +79,6 @@ import org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument;
setCommonSlideData(_slide.getCSld());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSLFSlideMaster(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
@Override
public CTSlideMaster getXmlObject() {
return _slide;

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableStyle;
@ -58,14 +57,6 @@ public class XSLFTableStyles extends POIXMLDocumentPart implements Iterable<XSLF
}
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XSLFTableStyles(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
public CTTableStyleList getXmlObject(){
return _tblStyleLst;
}

View File

@ -27,7 +27,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlException;
@ -67,14 +66,6 @@ public class XSLFTheme extends POIXMLDocumentPart {
initialize();
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XSLFTheme(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
public void importTheme(XSLFTheme theme) {
_theme = theme.getXmlObject();
_schemeColors = theme._schemeColors;

View File

@ -28,7 +28,6 @@ import javax.xml.parsers.ParserConfigurationException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.SAXHelper;
import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.xml.sax.Attributes;
@ -123,15 +122,6 @@ public class ReadOnlySharedStringsTable extends DefaultHandler {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public ReadOnlySharedStringsTable(PackagePart part, PackageRelationship rel_ignored)
throws IOException, SAXException {
this(part);
}
/**
* Read this shared strings table from an XML file.
*

View File

@ -47,7 +47,6 @@ import org.apache.poi.xssf.usermodel.XSSFShape;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STSheetState;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument;
/**
@ -94,7 +93,7 @@ public class XSSFReader {
*/
public SharedStringsTable getSharedStringsTable() throws IOException, InvalidFormatException {
ArrayList<PackagePart> parts = pkg.getPartsByContentType( XSSFRelation.SHARED_STRINGS.getContentType());
return parts.size() == 0 ? null : new SharedStringsTable(parts.get(0), null);
return parts.size() == 0 ? null : new SharedStringsTable(parts.get(0));
}
/**
@ -106,10 +105,10 @@ public class XSSFReader {
if(parts.size() == 0) return null;
// Create the Styles Table, and associate the Themes if present
StylesTable styles = new StylesTable(parts.get(0), null);
StylesTable styles = new StylesTable(parts.get(0));
parts = pkg.getPartsByContentType( XSSFRelation.THEME.getContentType());
if(parts.size() != 0) {
styles.setTheme(new ThemesTable(parts.get(0), null));
styles.setTheme(new ThemesTable(parts.get(0)));
}
return styles;
}
@ -295,7 +294,7 @@ public class XSSFReader {
PackageRelationship comments = commentsList.getRelationship(0);
PackagePartName commentsName = PackagingURIHelper.createPartName(comments.getTargetURI());
PackagePart commentsPart = sheetPkg.getPackage().getPart(commentsName);
return new CommentsTable(commentsPart, comments);
return new CommentsTable(commentsPart);
}
} catch (InvalidFormatException e) {
return null;
@ -319,7 +318,7 @@ public class XSSFReader {
PackageRelationship drawings = drawingsList.getRelationship(i);
PackagePartName drawingsName = PackagingURIHelper.createPartName(drawings.getTargetURI());
PackagePart drawingsPart = sheetPkg.getPackage().getPart(drawingsName);
XSSFDrawing drawing = new XSSFDrawing(drawingsPart, drawings);
XSSFDrawing drawing = new XSSFDrawing(drawingsPart);
for (XSSFShape shape : drawing.getShapes()){
shapes.add(shape);
}

View File

@ -24,7 +24,6 @@ import java.io.OutputStream;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcCell;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcChain;
@ -52,14 +51,6 @@ public class CalculationChain extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public CalculationChain(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public void readFrom(InputStream is) throws IOException {
try {
CalcChainDocument doc = CalcChainDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);

View File

@ -28,7 +28,6 @@ import java.util.TreeMap;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.util.Internal;
import org.apache.poi.xssf.usermodel.XSSFComment;
@ -68,14 +67,6 @@ public class CommentsTable extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public CommentsTable(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public void readFrom(InputStream is) throws IOException {
try {
CommentsDocument doc = CommentsDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);

View File

@ -57,14 +57,6 @@ public class ExternalLinksTable extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public ExternalLinksTable(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public void readFrom(InputStream is) throws IOException {
try {
ExternalLinkDocument doc = ExternalLinkDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);

View File

@ -28,7 +28,6 @@ import java.util.Map;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.xssf.usermodel.XSSFMap;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.xmlbeans.XmlException;
@ -69,13 +68,6 @@ public class MapInfo extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
public MapInfo(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public void readFrom(InputStream is) throws IOException {
try {
MapInfoDocument doc = MapInfoDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);

View File

@ -31,7 +31,6 @@ import java.util.Map;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
@ -108,13 +107,6 @@ public class SharedStringsTable extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
public SharedStringsTable(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
/**
* Read this shared strings table from an XML file.
*

View File

@ -27,7 +27,6 @@ import java.util.Vector;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.helpers.XSSFSingleXmlCell;
import org.apache.xmlbeans.XmlException;
@ -63,14 +62,6 @@ public class SingleXmlCells extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public SingleXmlCells(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public void readFrom(InputStream is) throws IOException {
try {
SingleXmlCellsDocument doc = SingleXmlCellsDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);

View File

@ -33,7 +33,6 @@ import java.util.TreeMap;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.BuiltinFormats;
import org.apache.poi.ss.usermodel.FontFamily;
@ -146,14 +145,6 @@ public class StylesTable extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public StylesTable(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public void setWorkbook(XSSFWorkbook wb) {
this.workbook = wb;
}

View File

@ -23,7 +23,6 @@ import java.io.OutputStream;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.drawingml.x2006.main.CTColor;
@ -88,14 +87,6 @@ public class ThemesTable extends POIXMLDocumentPart {
}
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public ThemesTable(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
/**
* Construct a ThemesTable from an existing ThemeDocument.
* @param theme A ThemeDocument.

View File

@ -28,7 +28,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.usermodel.Chart;
import org.apache.poi.ss.usermodel.charts.AxisPosition;
import org.apache.poi.ss.usermodel.charts.ChartAxis;
@ -106,15 +105,6 @@ public final class XSSFChart extends POIXMLDocumentPart implements Chart, ChartA
chart = chartSpace.getChart();
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFChart(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
/**
* Construct a new CTChartSpace bean.
* By default, it's just an empty placeholder for chart objects.

View File

@ -29,7 +29,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTChartsheet;
@ -58,14 +57,6 @@ public class XSSFChartSheet extends XSSFSheet {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFChartSheet(PackagePart part, PackageRelationship rel) {
this(part);
}
protected void read(InputStream is) throws IOException {
//initialize the supeclass with a blank worksheet
super.read(new ByteArrayInputStream(BLANK_WORKSHEET));

View File

@ -17,7 +17,6 @@
package org.apache.poi.xssf.usermodel;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.usermodel.Sheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDialogsheet;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter;
@ -34,8 +33,8 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
public class XSSFDialogsheet extends XSSFSheet implements Sheet{
protected CTDialogsheet dialogsheet;
protected XSSFDialogsheet(XSSFSheet sheet, PackageRelationship rel) {
super(sheet.getPackagePart(), rel);
protected XSSFDialogsheet(XSSFSheet sheet) {
super(sheet.getPackagePart());
this.dialogsheet = CTDialogsheet.Factory.newInstance();
this.worksheet = CTWorksheet.Factory.newInstance();
}

View File

@ -89,14 +89,6 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
drawing = CTDrawing.Factory.parse(part.getInputStream(),options);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XSSFDrawing(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
/**
* Construct a new CTDrawing bean. By default, it's just an empty placeholder for drawing objects
*

View File

@ -23,7 +23,6 @@ import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.POIXMLRelation;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils;
@ -73,14 +72,6 @@ public class XSSFPictureData extends POIXMLDocumentPart implements PictureData {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFPictureData(PackagePart part, PackageRelationship rel) {
this(part);
}
/**
* Gets the picture data as a byte array.
* <p>

View File

@ -23,7 +23,6 @@ import java.io.InputStream;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
@ -59,14 +58,6 @@ public class XSSFPivotCache extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFPivotCache(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
@Beta
protected void readFrom(InputStream is) throws IOException {
try {

View File

@ -27,7 +27,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
@ -71,14 +70,6 @@ public class XSSFPivotCacheDefinition extends POIXMLDocumentPart{
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFPivotCacheDefinition(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
@Beta
public void readFrom(InputStream is) throws IOException {
try {

View File

@ -26,7 +26,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlException;
@ -56,14 +55,6 @@ public class XSSFPivotCacheRecords extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFPivotCacheRecords(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
@Beta
protected void readFrom(InputStream is) throws IOException {
try {

View File

@ -29,7 +29,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DataConsolidateFunction;
@ -79,14 +78,6 @@ public class XSSFPivotTable extends POIXMLDocumentPart {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFPivotTable(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
@Beta
public void readFrom(InputStream is) throws IOException {
try {

View File

@ -152,14 +152,6 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
dataValidationHelper = new XSSFDataValidationHelper(this);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFSheet(PackagePart part, PackageRelationship rel) {
this(part);
}
/**
* Returns the parent XSSFWorkbook
*

View File

@ -30,12 +30,11 @@ import java.util.Locale;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.ss.usermodel.Table;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.helpers.XSSFXmlColumnPr;
import org.apache.poi.util.Internal;
import org.apache.poi.util.StringUtil;
import org.apache.poi.xssf.usermodel.helpers.XSSFXmlColumnPr;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumn;
@ -77,14 +76,6 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
readFrom(part.getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XSSFTable(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public void readFrom(InputStream is) throws IOException {
try {
TableDocument doc = TableDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);

View File

@ -19,7 +19,6 @@ package org.apache.poi.xssf.usermodel;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
public class XSSFVBAPart extends POIXMLDocumentPart {
@ -41,14 +40,6 @@ public class XSSFVBAPart extends POIXMLDocumentPart {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFVBAPart(PackagePart part, PackageRelationship rel) {
this(part);
}
/**
* Like *PictureData, VBA objects store the actual content in the part
* directly without keeping a copy like all others therefore we need to

View File

@ -33,7 +33,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.DocumentHelper;
import org.apache.poi.xssf.util.EvilUnclosedBRFixingInputStream;
import org.apache.xmlbeans.XmlCursor;
@ -121,14 +120,6 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
read(getPackagePart().getInputStream());
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
protected XSSFVMLDrawing(PackagePart part, PackageRelationship rel) throws IOException, XmlException {
this(part);
}
@SuppressWarnings("resource")
protected void read(InputStream is) throws IOException, XmlException {
Document doc;

View File

@ -873,9 +873,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
protected XSSFDialogsheet createDialogsheet(String sheetname, CTDialogsheet dialogsheet) {
XSSFSheet sheet = createSheet(sheetname);
String sheetRelId = getRelationId(sheet);
PackageRelationship pr = getPackagePart().getRelationship(sheetRelId);
return new XSSFDialogsheet(sheet, pr);
return new XSSFDialogsheet(sheet);
}
private CTSheet addSheet(String sheetname) {

View File

@ -27,7 +27,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
@ -74,14 +73,6 @@ public class XWPFFooter extends XWPFHeaderFooter {
super(parent, part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFFooter(POIXMLDocumentPart parent, PackagePart part, PackageRelationship rel) throws IOException {
this(parent, part);
}
/**
* save and commit footer
*/

View File

@ -31,7 +31,6 @@ import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes;
@ -57,14 +56,6 @@ public class XWPFFootnotes extends POIXMLDocumentPart {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFFootnotes(PackagePart part, PackageRelationship rel) throws IOException, OpenXML4JException {
this(part);
}
/**
* Construct XWPFFootnotes from scratch for a new document.
*/

View File

@ -27,7 +27,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
@ -54,14 +53,6 @@ public class XWPFHeader extends XWPFHeaderFooter {
super(parent, part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFHeader(POIXMLDocumentPart parent, PackagePart part, PackageRelationship rel) throws IOException {
this(parent, part);
}
public XWPFHeader(XWPFDocument doc, CTHdrFtr hdrFtr) {
super(doc, hdrFtr);
XmlCursor cursor = headerFooter.newCursor();

View File

@ -28,7 +28,6 @@ import org.apache.poi.POIXMLException;
import org.apache.poi.POIXMLRelation;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlCursor;
@ -78,14 +77,6 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
}
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part, PackageRelationship rel) throws IOException {
this(parent, part);
}
@Override
protected void onDocumentRead() throws IOException {
for (POIXMLDocumentPart poixmlDocumentPart : getRelations()) {

View File

@ -31,7 +31,6 @@ import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
@ -58,14 +57,6 @@ public class XWPFNumbering extends POIXMLDocumentPart {
isNew = true;
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFNumbering(PackagePart part, PackageRelationship rel) throws IOException, OpenXML4JException {
this(part);
}
/**
* create a new XWPFNumbering object for use in a new document
*/

View File

@ -26,7 +26,6 @@ import org.apache.poi.POIXMLException;
import org.apache.poi.POIXMLRelation;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.util.IOUtils;
/**
@ -79,14 +78,6 @@ public class XWPFPictureData extends POIXMLDocumentPart {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFPictureData(PackagePart part, PackageRelationship rel) {
this(part);
}
@Override
protected void onDocumentRead() throws IOException {
super.onDocumentRead();

View File

@ -30,7 +30,6 @@ import javax.xml.namespace.QName;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.poifs.crypt.CryptoFunctions;
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.xmlbeans.XmlOptions;
@ -56,14 +55,6 @@ public class XWPFSettings extends POIXMLDocumentPart {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFSettings(PackagePart part, PackageRelationship rel) throws IOException {
this(part);
}
public XWPFSettings() {
super();
ctSettings = CTSettings.Factory.newInstance();

View File

@ -31,7 +31,6 @@ import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocDefaults;
@ -69,14 +68,6 @@ public class XWPFStyles extends POIXMLDocumentPart {
super(part);
}
/**
* @deprecated in POI 3.14, scheduled for removal in POI 3.16
*/
@Deprecated
public XWPFStyles(PackagePart part, PackageRelationship rel) throws IOException, OpenXML4JException {
this(part);
}
/**
* Construct XWPFStyles from scratch for a new document.
*/

View File

@ -34,6 +34,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.apache.poi.POIXMLDocumentPart.RelationPart;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
import org.apache.poi.openxml4j.opc.OPCPackage;
@ -43,7 +44,6 @@ import org.apache.poi.util.NullOutputStream;
import org.apache.poi.util.PackageHelper;
import org.apache.poi.util.TempFile;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFShape;
import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.apache.poi.xwpf.usermodel.XWPFRelation;
import org.junit.Test;
@ -95,23 +95,31 @@ public final class TestPOIXMLDocument {
}
}
private static void traverse(POIXMLDocument doc) throws IOException{
HashMap<String,POIXMLDocumentPart> context = new HashMap<String,POIXMLDocumentPart>();
for (RelationPart p : doc.getRelationParts()){
traverse(p, context);
}
}
/**
* Recursively traverse a OOXML document and assert that same logical parts have the same physical instances
*/
private static void traverse(POIXMLDocumentPart part, HashMap<String,POIXMLDocumentPart> context) throws IOException{
assertEquals(part.getPackageRelationship().getTargetURI().toString(), part.getPackagePart().getPartName().getName());
private static void traverse(RelationPart rp, HashMap<String,POIXMLDocumentPart> context) throws IOException{
POIXMLDocumentPart dp = rp.getDocumentPart();
assertEquals(rp.getRelationship().getTargetURI().toString(), dp.getPackagePart().getPartName().getName());
context.put(part.getPackagePart().getPartName().getName(), part);
for(POIXMLDocumentPart p : part.getRelations()){
assertNotNull(p.toString());
context.put(dp.getPackagePart().getPartName().getName(), dp);
for(RelationPart p : dp.getRelationParts()){
assertNotNull(p.getRelationship().toString());
String uri = p.getPackagePart().getPartName().getURI().toString();
assertEquals(uri, p.getPackageRelationship().getTargetURI().toString());
String uri = p.getDocumentPart().getPackagePart().getPartName().getURI().toString();
assertEquals(uri, p.getRelationship().getTargetURI().toString());
if (!context.containsKey(uri)) {
traverse(p, context);
} else {
POIXMLDocumentPart prev = context.get(uri);
assertSame("Duplicate POIXMLDocumentPart instance for targetURI=" + uri, prev, p);
assertSame("Duplicate POIXMLDocumentPart instance for targetURI=" + uri, prev, p.getDocumentPart());
}
}
}
@ -121,9 +129,7 @@ public final class TestPOIXMLDocument {
OPCParser doc = new OPCParser(pkg1);
doc.parse(new TestFactory());
HashMap<String,POIXMLDocumentPart> context = new HashMap<String,POIXMLDocumentPart>();
traverse(doc, context);
context.clear();
traverse(doc);
File tmp = TempFile.createTempFile("poi-ooxml", ".tmp");
FileOutputStream out = new FileOutputStream(tmp);
@ -167,9 +173,7 @@ public final class TestPOIXMLDocument {
doc = new OPCParser(pkg1);
try {
doc.parse(new TestFactory());
context = new HashMap<String,POIXMLDocumentPart>();
traverse(doc, context);
context.clear();
traverse(doc);
assertEquals(pkg1.getRelationships().size(), pkg2.getRelationships().size());

View File

@ -44,8 +44,8 @@ public final class TestReadOnlySharedStringsTable extends TestCase {
List<PackagePart> parts = pkg.getPartsByName(Pattern.compile("/xl/sharedStrings.xml"));
assertEquals(1, parts.size());
SharedStringsTable stbl = new SharedStringsTable(parts.get(0), null);
ReadOnlySharedStringsTable rtbl = new ReadOnlySharedStringsTable(parts.get(0), null);
SharedStringsTable stbl = new SharedStringsTable(parts.get(0));
ReadOnlySharedStringsTable rtbl = new ReadOnlySharedStringsTable(parts.get(0));
assertEquals(stbl.getCount(), rtbl.getCount());
assertEquals(stbl.getUniqueCount(), rtbl.getUniqueCount());

View File

@ -37,9 +37,7 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackagePartName;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
import org.apache.poi.openxml4j.opc.TargetMode;
import org.apache.poi.xwpf.XWPFTestDataSamples;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.xmlbeans.XmlCursor;
@ -264,8 +262,7 @@ public final class TestXWPFDocument {
os.write(nature1);
os.close();
XWPFHeader xwpfHeader = doc.getHeaderArray(0);
PackageRelationship relationship = xwpfHeader.getPackagePart().addRelationship(partName, TargetMode.INTERNAL, jpgRelation.getRelation());
XWPFPictureData newPicData = new XWPFPictureData(newImagePart, relationship);
XWPFPictureData newPicData = new XWPFPictureData(newImagePart);
/* new part is now ready to rumble */
assertFalse(xwpfHeader.getAllPictures().contains(newPicData));