Tabnine Logo
DocumentViewExporter
Code IndexAdd Tabnine to your IDE (free)

How to use
DocumentViewExporter
in
org.apache.jackrabbit.commons.xml

Best Java code snippets using org.apache.jackrabbit.commons.xml.DocumentViewExporter (Showing top 20 results out of 315)

origin: org.apache.jackrabbit/oak-jcr

@Override
public void exportDocumentView(String absPath,
    ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)
    throws SAXException, RepositoryException {
  export(checkNotNull(absPath), new DocumentViewExporter(this,
      checkNotNull(contentHandler), !noRecurse, !skipBinary));
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * 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);
  }
}
origin: info.magnolia/magnolia-core

  @Override
  protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException {
    if ("jcr:system".equals(node.getName())) {
      // skip version history
      return;
    }
    super.exportNode(uri, local, node);
  }
});
origin: info.magnolia/magnolia-core

@Override
protected void exportProperty(String uri, String local, int type, Value[] values) {
  try {
    final StringBuilder attribute = new StringBuilder("");
    for (Value value : values) {
      attribute.append(getPropertyTypePrefix(value));
      attribute.append(serializeValue(value, type));
      attribute.append(",");
    }
    final String name = StringUtils.isEmpty(uri) ? ISO9075.encode(serializeKey(uri, local)) : local;
    final String attributeString = "[" + (values.length == 0 ? "" : attribute.substring(0, attribute.length() - 1)) + "]";
    super.addAttribute(uri, name, attributeString);
  } catch (RepositoryException e) {
    throw new RuntimeException(e);
  }
}
origin: org.onehippo.cms7/hippo-repository-engine

@Override
protected void exportNodes(Node node) throws RepositoryException, SAXException {
  if (!JcrUtils.isVirtual(node)) {
    super.exportNodes(node);
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Maps the given single-valued property to an XML attribute.
 */
protected void exportProperty(String uri, String local, Value value)
    throws RepositoryException {
  // TODO: Serialized names and paths should use XML namespace mappings
  String attribute = ValueHelper.serialize(value, false);
  addAttribute(uri, ISO9075.encode(local), attribute);
}
origin: apache/jackrabbit

/**
 * 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);
  }
}
origin: apache/jackrabbit-oak

@Override
public void exportDocumentView(String absPath,
    ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)
    throws SAXException, RepositoryException {
  export(checkNotNull(absPath), new DocumentViewExporter(this,
      checkNotNull(contentHandler), !noRecurse, !skipBinary));
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Maps the given single-valued property to an XML attribute.
 */
protected void exportProperty(String uri, String local, Value value)
    throws RepositoryException {
  // TODO: Serialized names and paths should use XML namespace mappings
  String attribute = ValueHelper.serialize(value, false);
  addAttribute(uri, ISO9075.encode(local), attribute);
}
origin: info.magnolia/magnolia-core

@Override
protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException {
  if (node.getDepth() == 0) { //don't include root node
    final NodeIterator iterator = node.getNodes();
    while (iterator.hasNext()) {
      final Node child = iterator.nextNode();
      super.exportNode(StringUtils.EMPTY, serializeKey(uri, child.getName()), child); //omit jcr: prefix for all child nodes
    }
  } else {
    super.exportNode(uri, serializeKey(uri, local), node);
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * 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);
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void exportDocumentView(String absPath,
    ContentHandler contentHandler, boolean skipBinary, boolean noRecurse)
    throws SAXException, RepositoryException {
  export(checkNotNull(absPath), new DocumentViewExporter(this,
      checkNotNull(contentHandler), !noRecurse, !skipBinary));
}
origin: apache/jackrabbit

/**
 * Maps the given single-valued property to an XML attribute.
 */
protected void exportProperty(String uri, String local, Value value)
    throws RepositoryException {
  // TODO: Serialized names and paths should use XML namespace mappings
  String attribute = ValueHelper.serialize(value, false);
  addAttribute(uri, ISO9075.encode(local), attribute);
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Generates a document view export using a {@link DocumentViewExporter}
 * instance.
 *
 * @param path of the node to be exported
 * @param handler handler for the SAX events of the export
 * @param skipBinary whether binary values should be skipped
 * @param noRecurse whether to export just the identified node
 * @throws PathNotFoundException if a node at the given path does not exist
 * @throws SAXException if the SAX event handler failed
 * @throws RepositoryException if another error occurs
 */
public void exportDocumentView(
    String path, ContentHandler handler,
    boolean skipBinary, boolean noRecurse)
    throws PathNotFoundException, SAXException, RepositoryException {
  export(path, new DocumentViewExporter(
      this, handler, !noRecurse, !skipBinary));
}
origin: info.magnolia/magnolia-core

@Override
protected void exportProperty(String uri, String local, Value value) throws RepositoryException {
  //mgnl:contentNode is the default nodeType, no need to export it, this saves a lot of lines e.g. in the configuration workspace export
  if (JcrConstants.JCR_PRIMARYTYPE.equals(getXMLName(uri, local)) && NodeTypes.ContentNode.NAME.equals(value.getString())) {
    return;
  }
  final String name = ISO9075.encode(serializeKey(uri, local));
  final String attribute = serializeValue(value, value.getType());
  final String propertyType = getPropertyTypePrefix(value);
  super.addAttribute(uri, name, propertyType + attribute);
}
origin: apache/jackrabbit

/**
 * Generates a document view export using a {@link DocumentViewExporter}
 * instance.
 *
 * @param path of the node to be exported
 * @param handler handler for the SAX events of the export
 * @param skipBinary whether binary values should be skipped
 * @param noRecurse whether to export just the identified node
 * @throws PathNotFoundException if a node at the given path does not exist
 * @throws SAXException if the SAX event handler failed
 * @throws RepositoryException if another error occurs
 */
public void exportDocumentView(
    String path, ContentHandler handler,
    boolean skipBinary, boolean noRecurse)
    throws PathNotFoundException, SAXException, RepositoryException {
  export(path, new DocumentViewExporter(
      this, handler, !noRecurse, !skipBinary));
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Generates a document view export using a {@link DocumentViewExporter}
 * instance.
 *
 * @param path of the node to be exported
 * @param handler handler for the SAX events of the export
 * @param skipBinary whether binary values should be skipped
 * @param noRecurse whether to export just the identified node
 * @throws PathNotFoundException if a node at the given path does not exist
 * @throws SAXException if the SAX event handler failed
 * @throws RepositoryException if another error occurs
 */
public void exportDocumentView(
    String path, ContentHandler handler,
    boolean skipBinary, boolean noRecurse)
    throws PathNotFoundException, SAXException, RepositoryException {
  export(path, new DocumentViewExporter(
      this, handler, !noRecurse, !skipBinary));
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void exportDocumentView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new DocumentViewExporter(this,
        handler, !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing document view XML", e);
    }
  }
}
origin: apache/jackrabbit-oak

@Override
public void exportDocumentView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new DocumentViewExporter(this,
        handler, !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing document view XML", e);
    }
  }
}
origin: org.apache.jackrabbit/oak-jcr

@Override
public void exportDocumentView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new DocumentViewExporter(this,
        handler, !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing document view XML", e);
    }
  }
}
org.apache.jackrabbit.commons.xmlDocumentViewExporter

Javadoc

Document view exporter.

Most used methods

  • <init>
    Creates a document view exporter.
  • addAttribute
  • exportNodes
  • characters
  • endElement
  • exportProperties
  • startElement
  • exportNode
    Exports the given node either as XML characters (if it's anxml:text node) or as an XML element with

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • Menu (java.awt)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now