Package org.pentaho.reporting.engine.classic.core.util

Examples of org.pentaho.reporting.engine.classic.core.util.CloseableTableModel


        final DataSchema dataSchema = dataSchemaCompiler.compile
            (reportData, expressions, parameterRow, parameterDefinitions, masterReport.getReportEnvironment());
        this.columnNames = collectColumnNames(reportData, parameterRow, expressions);
        if (reportData instanceof CloseableTableModel)
        {
          final CloseableTableModel ctm = (CloseableTableModel) reportData;
          ctm.close();
        }
        return dataSchema;
      }
      finally
      {
View Full Code Here


      }
      finally
      {
        if (reportData instanceof CloseableTableModel)
        {
          final CloseableTableModel ctm = (CloseableTableModel) reportData;
          ctm.close();
        }
      }
    }
    if (offlineTableModel == null)
    {
View Full Code Here

        if (key != null)
        {
          final TableModel newData = dataCache.put(key, data);
          if (newData != data && data instanceof CloseableTableModel)
          {
            final CloseableTableModel closeableTableModel = (CloseableTableModel) data;
            closeableTableModel.close();
          }
          data = newData;
        }
       
        if (data instanceof MetaTableModel)
View Full Code Here

        while (dataSets.hasNext())
        {
          final TableModel data = (TableModel) dataSets.next();
          if (data instanceof CloseableTableModel)
          {
            final CloseableTableModel ct = (CloseableTableModel) data;
            ct.close();
          }
        }
      }
      queryCache.clear();
      if (noClose == false)
View Full Code Here

   */
  public void close()
  {
    if (parentTableModel instanceof CloseableTableModel)
    {
      final CloseableTableModel closeableTableModel = (CloseableTableModel) parentTableModel;
      closeableTableModel.close();
    }
  }
View Full Code Here

    pmdDataFactory.initialize(new DesignTimeDataFactoryContext());

    try
    {
      pmdDataFactory.setQuery("default", QUERY, null, null);
      final CloseableTableModel tableModel = (CloseableTableModel) pmdDataFactory.queryData("default", new ParameterDataRow());
      try
      {
        final DefaultDataSchemaDefinition def = new DefaultDataSchemaDefinition();
        final DataSchemaCompiler compiler = new DataSchemaCompiler(def, new DefaultDataAttributeContext());
        final DataSchema dataSchema = compiler.compile(tableModel);
        final String[] names = dataSchema.getNames();
        assertEquals(4, names.length);
        assertEquals("BC_EMPLOYEES_FIRSTNAME", names[0]);
        assertEquals("BC_EMPLOYEES_LASTNAME", names[1]);
        assertEquals("BC_EMPLOYEES_EMPLOYEENUMBER", names[2]);
        assertEquals("BC_EMPLOYEES_EMAIL", names[3]);

        final DataAttributes attributes = dataSchema.getAttributes(names[2]);
        // assert that formatting-label is not a default mapper
        final ConceptQueryMapper mapper = attributes.getMetaAttributeMapper(MetaAttributeNames.Formatting.NAMESPACE,
            MetaAttributeNames.Formatting.LABEL);
        if (mapper instanceof DefaultConceptQueryMapper)
        {
          fail("Formatting::label should be a LocalizedString instead of a default-mapper");
        }

        final Object value = attributes.getMetaAttribute(MetaAttributeNames.Formatting.NAMESPACE,
            MetaAttributeNames.Formatting.LABEL, null, new DefaultDataAttributeContext());
        if (value instanceof LocalizedString == false)
        {
          fail("Formatting::label should be a LocalizedString");
        }

        final Object label = attributes.getMetaAttribute(MetaAttributeNames.Formatting.NAMESPACE,
            MetaAttributeNames.Formatting.LABEL, String.class, new DefaultDataAttributeContext(Locale.US));
        if (label instanceof String == false)
        {
          fail("Formatting::label should be a String");
        }

        final Object elementAlignment = attributes.getMetaAttribute(MetaAttributeNames.Style.NAMESPACE,
            MetaAttributeNames.Style.HORIZONTAL_ALIGNMENT, null, new DefaultDataAttributeContext(Locale.US));
        if ("right".equals(elementAlignment) == false)
        {
          fail("Style::horizontal-alignment should be a String of value 'right'");
        }

        final DataAttributes attributes2 = dataSchema.getAttributes(names[0]);
        final Object elementAlignment2 = attributes2.getMetaAttribute(MetaAttributeNames.Style.NAMESPACE,
            MetaAttributeNames.Style.HORIZONTAL_ALIGNMENT, null, new DefaultDataAttributeContext(Locale.US));
        if ("left".equals(elementAlignment2) == false)
        {
          fail("Style::horizontal-alignment should be a String of value 'right'");
        }

      }
      finally
      {
        tableModel.close();
      }
    }
    finally
    {
View Full Code Here

    pmdDataFactory.initialize(new DesignTimeDataFactoryContext());
    try
    {
      pmdDataFactory.setQuery("default", MULTIPLE_AGG_QUERY, null, null);

      final CloseableTableModel tableModel = (CloseableTableModel) pmdDataFactory.queryData("default", new ParameterDataRow());
      try
      {
        final DefaultDataSchemaDefinition def = new DefaultDataSchemaDefinition();
        final DataSchemaCompiler compiler = new DataSchemaCompiler(def, new DefaultDataAttributeContext());
        final DataSchema dataSchema = compiler.compile(tableModel);
        final String[] names = dataSchema.getNames();
        assertEquals(3, names.length);
        assertEquals("BC_CUSTOMER_W_TER_TERRITORY", names[0]);
        assertEquals("BC_ORDERDETAILS_QUANTITYORDERED", names[1]);
        assertEquals("BC_ORDERDETAILS_QUANTITYORDERED:AVERAGE", names[2]);
        final ByteArrayOutputStream sw = new ByteArrayOutputStream();
        final PrintStream out = new PrintStream(sw);
        generateCompareText(out, tableModel);
        compareLineByLine("agg-query-results.txt", sw.toString());
      }
      finally
      {
        tableModel.close();
      }
    }
    finally
    {
      pmdDataFactory.close();
View Full Code Here

    if (key != null)
    {
      final TableModel newData = dataCache.put(key, data);
      if (newData != data && data instanceof CloseableTableModel)
      {
        final CloseableTableModel closeableTableModel = (CloseableTableModel) data;
        closeableTableModel.close();
      }
      sessionCache.put(key, newData);
      data = newData;
    }
    return data;
View Full Code Here

        if (map instanceof CloseableTableModel == false)
        {
          continue;
        }

        final CloseableTableModel ct = (CloseableTableModel) map;
        ct.close();
      }
      sessionCache.clear();
      if (noClose == false)
      {
        backend.close();
View Full Code Here

      final PrintStream ps = new PrintStream(sw, true, "UTF-8");
      final TableModel tableModel = dataFactory.queryData(getLogicalQueryForNextTest(), getParameterForNextTest());
      generateCompareText(ps, tableModel);
      if (tableModel instanceof CloseableTableModel)
      {
        final CloseableTableModel ctm = (CloseableTableModel) tableModel;
        ctm.close();
      }
      return sw.toString("UTF-8");
    }
    catch (UnsupportedEncodingException e)
    {
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.util.CloseableTableModel

Copyright © 2018 www.massapicom. 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.