/** * Returns the prefixed JCR name for the namespace URI and local name * using the current namespace mappings. * * @param uri namespace URI * @param name namespace-local name * @return prefixed JCR name * @throws RepositoryException if an error occurs */ private String getName(String name) throws RepositoryException { return new NamespaceHelper(getSession()).getJcrName(name); }
/** * Returns the prefixed JCR name for the namespace URI and local name * using the current namespace mappings. * * @param uri namespace URI * @param name namespace-local name * @return prefixed JCR name * @throws RepositoryException if an error occurs */ private String getName(String name) throws RepositoryException { return new NamespaceHelper(getSession()).getJcrName(name); }
/** * Returns the prefixed JCR name for the namespace URI and local name * using the current namespace mappings. * * @param uri namespace URI * @param name namespace-local name * @return prefixed JCR name * @throws RepositoryException if an error occurs */ private String getName(String name) throws RepositoryException { return new NamespaceHelper(getSession()).getJcrName(name); }
/** * Exports the given node either as XML characters (if it's an * <code>xml:text</code> node) or as an XML element with properties * mapped to XML attributes. */ protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException { if (NamespaceHelper.JCR.equals(uri) && "xmltext".equals(local)) { try { // assume jcr:xmlcharacters is single-valued Property property = node.getProperty(helper.getJcrName("jcr:xmlcharacters")); char[] ch = property.getString().toCharArray(); characters(ch, 0, ch.length); } catch (PathNotFoundException e) { // jcr:xmlcharacters not found, ignore this node } } else { // attributes (properties) exportProperties(node); // encode node name to make sure it's a valid xml name String encoded = ISO9075.encode(local); startElement(uri, encoded); exportNodes(node); endElement(uri, encoded); } }
/** * Exports the given node either as XML characters (if it's an * <code>xml:text</code> node) or as an XML element with properties * mapped to XML attributes. */ protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException { if (NamespaceHelper.JCR.equals(uri) && "xmltext".equals(local)) { try { // assume jcr:xmlcharacters is single-valued Property property = node.getProperty(helper.getJcrName("jcr:xmlcharacters")); char[] ch = property.getString().toCharArray(); characters(ch, 0, ch.length); } catch (PathNotFoundException e) { // jcr:xmlcharacters not found, ignore this node } } else { // attributes (properties) exportProperties(node); // encode node name to make sure it's a valid xml name String encoded = ISO9075.encode(local); startElement(uri, encoded); exportNodes(node); endElement(uri, encoded); } }
/** * Exports the given node either as XML characters (if it's an * <code>xml:text</code> node) or as an XML element with properties * mapped to XML attributes. */ protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException { if (NamespaceHelper.JCR.equals(uri) && "xmltext".equals(local)) { try { // assume jcr:xmlcharacters is single-valued Property property = node.getProperty(helper.getJcrName("jcr:xmlcharacters")); char[] ch = property.getString().toCharArray(); characters(ch, 0, ch.length); } catch (PathNotFoundException e) { // jcr:xmlcharacters not found, ignore this node } } else { // attributes (properties) exportProperties(node); // encode node name to make sure it's a valid xml name String encoded = ISO9075.encode(local); startElement(uri, encoded); exportNodes(node); endElement(uri, encoded); } }
NamespaceHelper.JCR, "primaryType", factory.createValue( helper.getJcrName("nt:share"), PropertyType.NAME)); exportProperty( NamespaceHelper.JCR, "uuid", exportProperty(properties, helper.getJcrName("jcr:primaryType")); exportProperty(properties, helper.getJcrName("jcr:mixinTypes")); exportProperty(properties, helper.getJcrName("jcr:uuid"));
/** * Utility method for exporting the given node. Parses the node name * (or <code>jcr:root</code> if given the root node) and calls * {@link #exportNode(String, String, Node)} with the resolved namespace * URI and the local part of the name. * * @param node node * @throws RepositoryException if a repository error occurs * @throws SAXException if a SAX error occurs */ private void exportNode(Node node) throws RepositoryException, SAXException { share = node.isNodeType(helper.getJcrName("mix:shareable")) && !shareables.add(node.getUUID()); if (node.getDepth() == 0) { exportNode(NamespaceHelper.JCR, "root", node); } else { String name = node.getName(); int colon = name.indexOf(':'); if (colon == -1) { exportNode("", name, node); } else { String uri = session.getNamespaceURI(name.substring(0, colon)); exportNode(uri, name.substring(colon + 1), node); } } }
NamespaceHelper.JCR, "primaryType", factory.createValue( helper.getJcrName("nt:share"), PropertyType.NAME)); exportProperty( NamespaceHelper.JCR, "uuid", exportProperty(properties, helper.getJcrName("jcr:primaryType")); exportProperty(properties, helper.getJcrName("jcr:mixinTypes")); exportProperty(properties, helper.getJcrName("jcr:uuid"));
NamespaceHelper.JCR, "primaryType", factory.createValue( helper.getJcrName("nt:share"), PropertyType.NAME)); exportProperty( NamespaceHelper.JCR, "uuid", exportProperty(properties, helper.getJcrName("jcr:primaryType")); exportProperty(properties, helper.getJcrName("jcr:mixinTypes")); exportProperty(properties, helper.getJcrName("jcr:uuid"));
/** * Utility method for exporting the given node. Parses the node name * (or <code>jcr:root</code> if given the root node) and calls * {@link #exportNode(String, String, Node)} with the resolved namespace * URI and the local part of the name. * * @param node node * @throws RepositoryException if a repository error occurs * @throws SAXException if a SAX error occurs */ private void exportNode(Node node) throws RepositoryException, SAXException { share = node.isNodeType(helper.getJcrName("mix:shareable")) && !shareables.add(node.getUUID()); if (node.getDepth() == 0) { exportNode(NamespaceHelper.JCR, "root", node); } else { String name = node.getName(); int colon = name.indexOf(':'); if (colon == -1) { exportNode("", name, node); } else { String uri = session.getNamespaceURI(name.substring(0, colon)); exportNode(uri, name.substring(colon + 1), node); } } }
/** * Utility method for exporting the given node. Parses the node name * (or <code>jcr:root</code> if given the root node) and calls * {@link #exportNode(String, String, Node)} with the resolved namespace * URI and the local part of the name. * * @param node node * @throws RepositoryException if a repository error occurs * @throws SAXException if a SAX error occurs */ private void exportNode(Node node) throws RepositoryException, SAXException { share = node.isNodeType(helper.getJcrName("mix:shareable")) && !shareables.add(node.getUUID()); if (node.getDepth() == 0) { exportNode(NamespaceHelper.JCR, "root", node); } else { String name = node.getName(); int colon = name.indexOf(':'); if (colon == -1) { exportNode("", name, node); } else { String uri = session.getNamespaceURI(name.substring(0, colon)); exportNode(uri, name.substring(colon + 1), node); } } }