}
}
public OpcPackage get(Session jcrSession, Node docxNode ) throws Docx4JException {
OpcPackage p = null;
// 1. The idea is to walk the tree of relationships, getting
// everything we need from JCR.
// unusedJCRNodes = new HashMap();
try {
// Node docxContentNode = docxNode.getNode("jcr:content");
Node docxContentNode = nodeMapper.getContentNode(docxNode);
// Its a flat structure since we've URL Encoded '/'
// NodeIterator nodeIterator = docxContentNode.getNodes();
// while(nodeIterator.hasNext()) {
// Node n=nodeIterator.nextNode();
// log.info(n.getName());
// unusedJCRNodes.put(decodeSlashes(nodeMapper, n.getName()), new Boolean(true) );
// }
// 2. Create a new Package
// Eventually, you'll only be able to create an Excel package etc
// but only the WordML package exists at present
// Document ctmDocument = null;
// ctmDocument = deprecatedGetDocumentFromJCRPart(jcrSession, nodeMapper, docxContentNode, "[Content_Types].xml");
// debugPrint(ctmDocument);
initialiseContentTypeManager(ctm,
jcrSession,
docxContentNode , nodeMapper );
p = ctm.createPackage();
// 3. Get [Content_Types].xml
// Once we've got this, then we can look up the content type for
// each PartName, and use it in the Part constructor.
// p.setContentTypeManager(ctm); - 20080111 - done by ctm.createPackage();
// unusedJCRNodes.put("[Content_Types].xml", new Boolean(false));
// 4. Start with _rels/.rels
// <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
// <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
// <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
// <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
// </Relationships>
String partName = "_rels/.rels";
RelationshipsPart rp = getRelationshipsPartFromJCR(p, jcrSession, docxContentNode, partName);
p.setRelationships(rp);
//rp.setPackageRelationshipPart(true);
// unusedJCRNodes.put(partName, new Boolean(false));
log.info( "Object created for: " + partName);