MCPcopy Create free account
hub / github.com/apache/poi / read

Method read

src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java:255–290  ·  view source on GitHub ↗

Iterate through the underlying PackagePart and create child POIXMLFactory instances using the specified factory @param factory the factory object that creates POIXMLFactory instances @param context context map containing already visited noted keyed by targetURI

(POIXMLFactory factory, Map<PackagePart, POIXMLDocumentPart> context)

Source from the content-addressed store, hash-verified

253 * @param context context map containing already visited noted keyed by targetURI
254 */
255 protected void read(POIXMLFactory factory, Map<PackagePart, POIXMLDocumentPart> context) throws OpenXML4JException {
256 PackageRelationshipCollection rels = packagePart.getRelationships();
257 for (PackageRelationship rel : rels) {
258 if(rel.getTargetMode() == TargetMode.INTERNAL){
259 URI uri = rel.getTargetURI();
260
261 PackagePart p;
262 if(uri.getRawFragment() != null) {
263 /*
264 * For internal references (e.g. '#Sheet1!A1') the package part is null
265 */
266 p = null;
267 } else {
268 PackagePartName relName = PackagingURIHelper.createPartName(uri);
269 p = packagePart.getPackage().getPart(relName);
270 if(p == null) {
271 logger.log(POILogger.ERROR, "Skipped invalid entry " + rel.getTargetURI());
272 continue;
273 }
274 }
275
276 if (!context.containsKey(p)) {
277 POIXMLDocumentPart childPart = factory.createDocumentPart(rel, p);
278 childPart.parent = this;
279 addRelation(childPart);
280 if(p != null){
281 context.put(p, childPart);
282 if(p.hasRelationships()) childPart.read(factory, context);
283 }
284 }
285 else {
286 addRelation(context.get(p));
287 }
288 }
289 }
290 }
291
292 /**
293 * Fired when a new package part is created

Callers

nothing calls this directly

Calls 13

createPartNameMethod · 0.95
addRelationMethod · 0.95
hasRelationshipsMethod · 0.95
getTargetModeMethod · 0.80
getTargetURIMethod · 0.80
getRelationshipsMethod · 0.65
getPartMethod · 0.65
getPackageMethod · 0.45
logMethod · 0.45
containsKeyMethod · 0.45
createDocumentPartMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected