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

Examples of org.pentaho.reporting.engine.classic.core.function.AggregationFunction


        continue;
      }

      try
      {
        final AggregationFunction o = (AggregationFunction) aggType.newInstance();
        final String group = (String) element.getAttribute
            (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP);
        if (group != null)
        {
          o.setGroup(group);
        }
        else
        {
          final Group g = findGroup(element);
          if (g != null)
          {
            if (g.getName() == null)
            {
              g.setName("::wizard:group:" + g.getClass().getName() + ':' + System.identityHashCode(g));
            }

            o.setGroup(g.getName());
          }
        }

        final String fieldName = (String) element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD);
        if (o instanceof FieldAggregationFunction)
        {
          final FieldAggregationFunction fo = (FieldAggregationFunction) o;
          fo.setField(fieldName);
        }

        final Object labelFor =
            element.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR);
        if (labelFor == null)
        {
          element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, fieldName);
        }

        final String name = AutoGeneratorUtility.generateUniqueExpressionName
            (schema, "::wizard:aggregation:{0}",
                (String[]) generatedExpressionNames.toArray(new String[generatedExpressionNames.size()]));
        o.setName(name);
        generatedExpressionNames.add(name);

        element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, name);
        // finally clean up
        element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, null);
View Full Code Here


    if (dummy instanceof AggregationFunction == false)
    {
      return null;
    }

    AggregationFunction function = (AggregationFunction) dummy;

    final MasterReport report = new MasterReport();
    report.setPageDefinition(new SimplePageDefinition(PageSize.A3, PageFormat.LANDSCAPE, new Insets(0, 0, 0, 0)));
    report.setDataFactory(new TableDataFactory("query", tableModel));
    report.setQuery("query");
    final ContextAwareDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel(report);

    final CrosstabBuilder builder = new CrosstabBuilder(dataSchemaModel);
    builder.addRowDimension(ROW_DIMENSION_A);
    builder.addRowDimension(ROW_DIMENSION_B);
    builder.addColumnDimension(COLUMN_DIMENSION_A);
    builder.addColumnDimension(COLUMN_DIMENSION_B);
    builder.addDetails(VALUE, function.getClass());
    report.setRootGroup(builder.create());
    return report;
  }
View Full Code Here

  protected void processAggregateElement(final ReportElement element,
                                         final Class<AggregationFunction> aggType)
      throws InstantiationException, IllegalAccessException, ReportProcessingException
  {
    final AggregationFunction o = aggType.newInstance();

    if (configureCrosstabAggregation(element, o) == false)
    {
      configureRelationalAggreation(element, o);
    }

    final String fieldName = (String) element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD);
    if (o instanceof FieldAggregationFunction)
    {
      final FieldAggregationFunction fo = (FieldAggregationFunction) o;
      fo.setField(fieldName);
    }

    final Object labelFor =
        element.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR);
    if (labelFor == null)
    {
      element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, fieldName);
    }

    final String name = AutoGeneratorUtility.generateUniqueExpressionName
        (schema, "::wizard:aggregation:{0}",
            generatedExpressionNames.toArray(new String[generatedExpressionNames.size()]));
    o.setName(name);
    generatedExpressionNames.add(name);

    element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, name);
    // finally clean up
    element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, null);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.function.AggregationFunction

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.