String tableId = (String) target.getValue(elContext); Exporter exporter = ExporterFactory.getExporterForType(exportAs); UIComponent component = event.getComponent().findComponent(tableId); if(component == null) { throw new FacesException("Cannot find component \"" + tableId + "\" in view."); } if(!(component instanceof DataTable)) { throw new FacesException("Unsupported datasource target:\"" + component.getClass().getName() + "\", exporter must target a PrimeFaces DataTable."); } DataTable table = (DataTable) component; exporter.export(context, table, outputFileName, isPageOnly, isSelectionOnly, encodingType, preProcessor, postProcessor);
private void export(String path, Exporter exporter) throws PathNotFoundException, SAXException, RepositoryException { Item item = getItem(path); if (item.isNode()) { exporter.export((Node) item); } else { throw new PathNotFoundException("XML export is not defined for properties: " + path); } }
/** * Exports content at the given path using the given exporter. * * @param path of the node to be exported * @param exporter document or system view exporter * @throws SAXException if the SAX event handler failed * @throws RepositoryException if another error occurs */ private synchronized void export(String path, Exporter exporter) throws SAXException, RepositoryException { Item item = getItem(path); if (item.isNode()) { exporter.export((Node) item); } else { throw new PathNotFoundException("XML export is not defined for properties: " + path); } }
/** * Exports content at the given path using the given exporter. * * @param path of the node to be exported * @param exporter document or system view exporter * @throws SAXException if the SAX event handler failed * @throws RepositoryException if another error occurs */ private synchronized void export(String path, Exporter exporter) throws SAXException, RepositoryException { Item item = getItem(path); if (item.isNode()) { exporter.export((Node) item); } else { throw new PathNotFoundException("XML export is not defined for properties: " + path); } }
/** * Exports content at the given path using the given exporter. * * @param path of the node to be exported * @param exporter document or system view exporter * @throws SAXException if the SAX event handler failed * @throws RepositoryException if another error occurs */ private synchronized void export(String path, Exporter exporter) throws PathNotFoundException, SAXException, RepositoryException { Item item = getItem(path); if (item.isNode()) { exporter.export((Node) item); } else { throw new PathNotFoundException( "XML export is not defined for properties: " + path); } }
/** * Exports content at the given path using the given exporter. * * @param path of the node to be exported * @param exporter document or system view exporter * @throws SAXException if the SAX event handler failed * @throws RepositoryException if another error occurs */ private synchronized void export(String path, Exporter exporter) throws SAXException, RepositoryException { Item item = getItem(path); if (item.isNode()) { exporter.export((Node) item); } else { throw new PathNotFoundException("XML export is not defined for properties: " + path); } }
/** * Exports content at the given path using the given exporter. * * @param path of the node to be exported * @param exporter document or system view exporter * @throws SAXException if the SAX event handler failed * @throws RepositoryException if another error occurs */ private synchronized void export(String path, Exporter exporter) throws PathNotFoundException, SAXException, RepositoryException { Item item = getItem(path); if (item.isNode()) { exporter.export((Node) item); } else { throw new PathNotFoundException( "XML export is not defined for properties: " + path); } }
/** * Exports content at the given path using the given exporter. * * @param path of the node to be exported * @param exporter document or system view exporter * @throws SAXException if the SAX event handler failed * @throws RepositoryException if another error occurs */ private synchronized void export(String path, Exporter exporter) throws PathNotFoundException, SAXException, RepositoryException { Item item = getItem(path); if (item.isNode()) { exporter.export((Node) item); } else { throw new PathNotFoundException( "XML export is not defined for properties: " + path); } }
exporter.export((Node) item); } else { throw new PathNotFoundException("XML export is not defined for properties: " + absPath);
exporter.export((Node) item); } else { throw new PathNotFoundException("XML export is not defined for properties: " + absPath);
@Test public void onlyGivenNamespacesAreWhitelisted() throws Exception { // GIVEN an arbitrary ContentHandler … JDOMResult jdomResult = new JDOMResult(); ContentHandler contentHandler = jdomResult.getHandler(); // … wrapped with the NamespaceFilter NamespaceFilter filter = new NamespaceFilter("yes"); filter.setContentHandler(contentHandler); Exporter exporter = new SystemViewExporter(session, filter, true, false); XMLOutputter outputter = new XMLOutputter(); StringWriter writer = new StringWriter(); // WHEN exporter.export(session.getNode("/foo")); outputter.output(jdomResult.getDocument(), writer); // THEN String export = writer.toString(); assertThat(export, containsString("xmlns:yes=\"urn:yes:1.0\"")); assertThat(export, not(containsString("xmlns:no=\"urn:no:1.0\""))); } }
final Node node = contentDecorator.wrapNode(getJCRNode(context)); exporter.export(node); try { xmlOutputter.output(jdomResult.getDocument(), compressionOutputStream);