Examples of HQLDataFactory


Examples of org.pentaho.reporting.engine.classic.extensions.datasources.hibernate.HQLDataFactory

    {
      throw new SAXException(
              "Unable to create SQL Factory: No connection provider.");
    }

    final HQLDataFactory srdf = new HQLDataFactory(provider);
    for (int i = 0; i < queries.size(); i++)
    {
      final PropertyReadHandler handler = (PropertyReadHandler) queries.get(i);
      srdf.setQuery(handler.getName(), handler.getResult());
    }

    dataFactory = srdf;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.extensions.datasources.hibernate.HQLDataFactory

  public String writeDataFactory(final WriteableDocumentBundle bundle,
                                 final DataFactory dataFactory,
                                 final BundleWriterState state)
      throws IOException, BundleWriterException
  {
    final HQLDataFactory hqlDataFactory = (HQLDataFactory) dataFactory;

    final String fileName = BundleUtilities.getUniqueName(bundle, state.getFileName(), "datasources/hibernate-ds{0}.xml");
    if (fileName == null)
    {
      throw new IOException("Unable to generate unique name for Inline-Data-Source");
    }

    final OutputStream outputStream = bundle.createEntry(fileName, "text/xml");
    final DefaultTagDescription tagDescription = new DefaultTagDescription(ClassicEngineBoot.getInstance().getGlobalConfig(), HibernateDataFactoryModule.TAG_DEF_PREFIX);
    final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, "  ", "\n");
    final AttributeList rootAttrs = new AttributeList();
    if (xmlWriter.isNamespaceDefined(HibernateDataFactoryModule.NAMESPACE) == false)
    {
      rootAttrs.addNamespaceDeclaration("data", HibernateDataFactoryModule.NAMESPACE);
    }
    xmlWriter.writeTag(HibernateDataFactoryModule.NAMESPACE, "hibernate-datasource", rootAttrs, XmlWriter.OPEN);

    try
    {
      writeConnectionInfo(xmlWriter, hqlDataFactory.getSessionProvider());
    }
    catch (ReportWriterException e)
    {
      throw new BundleWriterException("Failed to write connection info", e);
    }

    final String[] queryNames = hqlDataFactory.getQueryNames();
    for (int i = 0; i < queryNames.length; i++)
    {
      final String queryName = queryNames[i];
      final String query = hqlDataFactory.getQuery(queryName);
      xmlWriter.writeTag(HibernateDataFactoryModule.NAMESPACE, "query", "name", queryName, XmlWriter.OPEN);
      xmlWriter.writeTextNormalized(query, false);
      xmlWriter.writeCloseTag();
    }
    xmlWriter.writeCloseTag();
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.extensions.datasources.hibernate.HQLDataFactory

  public void write(final ReportWriterContext reportWriter,
                    final XmlWriter xmlWriter,
                    final DataFactory dataFactory)
      throws IOException, ReportWriterException
  {
    final HQLDataFactory hqlDataFactory = (HQLDataFactory) dataFactory;

    final AttributeList rootAttrs = new AttributeList();
    rootAttrs.addNamespaceDeclaration("data", HibernateDataFactoryModule.NAMESPACE);
    xmlWriter.writeTag(HibernateDataFactoryModule.NAMESPACE, "hibernate-datasource", rootAttrs, XmlWriter.OPEN);

    writeConnectionInfo(reportWriter, xmlWriter, hqlDataFactory.getSessionProvider());

    final String[] queryNames = hqlDataFactory.getQueryNames();
    for (int i = 0; i < queryNames.length; i++)
    {
      final String queryName = queryNames[i];
      final String query = hqlDataFactory.getQuery(queryName);
      xmlWriter.writeTag(HibernateDataFactoryModule.NAMESPACE, "query", "name", queryName, XmlWriter.OPEN);
      xmlWriter.writeTextNormalized(query, false);
      xmlWriter.writeCloseTag();
    }
    xmlWriter.writeCloseTag();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.