Examples of ReportElement


Examples of com.cfinkel.reports.generatedbeans.ReportElement

            outputStream.write(message.getBytes());
            return;
        }

        try {
            ReportElement reportElement = (ReportElement) reportUnmarshaller.unmarshal
                    (new File(AppData.getReportsDirectory() + reportPath + ".xml"));
            Report report = new Report(reportElement, reportPath);
            reports.put(reportPath, report);
            String message = "Successfully loaded report at path " + reportPath + "\n\r";
            outputStream.write(message.getBytes());
View Full Code Here

Examples of com.sun.star.report.pentaho.model.ReportElement

        for (int i = 0; i < nodes.length; i++)
        {
            final Node child = nodes[i];
            if (child instanceof ReportElement && child.isEnabled())
            {
                final ReportElement element = (ReportElement) child;
                if (element.getFormatConditionCount() > 0)
                {
                    final Expression displayCond = element.getDisplayCondition();
                    if (displayCond != null)
                    {
                        try
                        {
                            if (Boolean.FALSE.equals(LayoutControllerUtil.evaluateExpression(getFlowController(), element, displayCond)))
                            {
                                continue;
                            }
                        }
                        catch (DataSourceException e)
                        {
                        // ignore silently ..
                        }
                    }

                    final FormatCondition[] conditions = element.getFormatConditions();
                    for (int j = 0; j < conditions.length; j++)
                    {
                        final FormatCondition formCond = conditions[j];
                        if (formCond.isEnabled())
                        {
View Full Code Here

Examples of com.volantis.synergetics.reporting.config.ReportElement

     */
    public MetricGroupProxyFactory(ReportingConfig config) {
        if (config != null) {
            Map datasourceConfigs = config.getDatasourceConfigMap();
            for (Iterator it = config.getReportElementsIterator(); it.hasNext();) {
                ReportElement report = (ReportElement) it.next();

                if (report.getEnabled()) {
                    ExclusionManager.getDefaultInstance().initializeExclusions(
                            report.getBinding(),
                            report.getReportExclusion());
                   

                    if (report.getGenericHandler() != null) {
                        GenericHandler genericHandler = report.getGenericHandler();
                        String className = genericHandler.getClassName();
                        Class handlerClass = null;
                        try {
                            handlerClass = Class.forName(className);
                        } catch (ClassNotFoundException e) {
                            LOGGER.error("failed-to-find-class", className, e);
                        }
                        try {

                            Constructor con = null;
                            try {
                                con = handlerClass.getConstructor(REPORT_HANDLER_ARGS);
                            } catch (NoSuchMethodException e) {
                                LOGGER.error("failed-to-create-class",
                                        handlerClass,
                                        e);
                            }
                            ReportHandler reportHandler = null;
                            try {
                                Object[] args = new Object[2];
                                args[0] = buildGenericMap(genericHandler);
                                args[1] = report.getBinding();
                                reportHandler = (ReportHandler) con.newInstance(args);
                            } catch (InstantiationException e) {
                                LOGGER.error("failed-to-load-class",
                                        handlerClass,
                                        e);
                            } catch (IllegalAccessException e) {
                                LOGGER.error("failed-to-load-class",
                                        handlerClass,
                                        e);
                            } catch (InvocationTargetException e) {
                                LOGGER.error("failed-to-load-class",
                                        handlerClass,
                                        e);
                            }
                            handlers.put(report.getBinding(), reportHandler);

                        } catch (Exception e) {
                            LOGGER.error("failed-to-load-class", className);
                        }

                    } else if (report.getSqlHandler() != null) {
                        if (existsDatasourceDefinition(
                                datasourceConfigs, report.getSqlHandler())) {
                            ConnectionStrategy connStrategy =
                                DatasourceManager.getInstance().createConnectionStrategy(
                                        (DatasourceConfiguration) datasourceConfigs.get(
                                                report.getSqlHandler().getDatasourceName()));
                            ReportHandler handler =
                                new JDBCReportHandler(connStrategy, report);
                            handlers.put(report.getBinding(), handler);
                        } else {
                            LOGGER.error("sql-handler-datasource-not-found",
                                    new Object[] {report.getSqlHandler().getDatasourceName(),
                                            report.getBinding()});
                        }

                    } else {
                        LOGGER.error("handler-not-found", report.getBinding());
                    }
                }
            }
        }
    }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportElement

                              final Section section) throws ReportProcessingException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof SubReport == false)
      {
        if (element instanceof Section)
        {
          processSection(schema, definition, (Section) element);
          continue;
        }
        continue;
      }

      if ("toc".equals(element.getMetaData().getName()))
      {
        activateTableOfContents(schema, definition, element);
      }
      else if ("index".equals(element.getMetaData().getName()))
      {
        activateIndex(schema, definition, element);
      }

    }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportElement

    }

    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement re = section.getElement(i);
      if (re instanceof Element == false)
      {
        throw new IllegalStateException("Cannot write custom implementations of report-element.");
      }
      final Element e = (Element) re;
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportElement

                              final AbstractReportDefinition reportDefinition) throws ReportProcessingException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof SubReport)
      {
        continue;
      }

      if (element instanceof Section)
      {
        processSection((Section) element, dataSchema, reportDefinition);
        continue;
      }

      final Object attribute =
          element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.ELEMENT_TYPE);
      if (attribute instanceof LegacyChartType == false)
      {
        continue;
      }

      final Object maybeChartExpression =
          element.getAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);
      if (maybeChartExpression instanceof ChartExpression == false)
      {
        continue;
      }

      final ChartExpression chartExpression = (ChartExpression) maybeChartExpression;
      final Object primaryChartExpression = element.getAttribute
          (LegacyChartElementModule.NAMESPACE, LegacyChartElementModule.PRIMARY_DATA_COLLECTOR_FUNCTION_ATTRIBUTE);
      if (primaryChartExpression instanceof Expression)
      {
        final Expression datasetExpression = (Expression) primaryChartExpression;
        final Expression datasetExpressionInstance = datasetExpression.getInstance();
        final String name = AutoGeneratorUtility.generateUniqueExpressionName
            (dataSchema, "::legacy-charts::primary-dataset::{0}", reportDefinition);
        datasetExpressionInstance.setName(name);
        chartExpression.setDataSource(name);
        reportDefinition.addExpression(datasetExpressionInstance);
      }

      if (chartExpression instanceof MultiPlotChartExpression == false)
      {
        continue;
      }
      final MultiPlotChartExpression multiPlotChartExpression = (MultiPlotChartExpression) chartExpression;

      final Object secondaryDataSourceExpression = element.getAttribute
          (LegacyChartElementModule.NAMESPACE, LegacyChartElementModule.SECONDARY_DATA_COLLECTOR_FUNCTION_ATTRIBUTE);
      if (secondaryDataSourceExpression instanceof Expression)
      {
        final Expression datasetExpression = (Expression) secondaryDataSourceExpression;
        final Expression datasetExpressionInstance = datasetExpression.getInstance();
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportElement

                              final Section section) throws BundleWriterException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof Section)
      {
        processSection(documentBundle, report, (Section) element);
      }

      if (element instanceof RootLevelBand)
      {
        final RootLevelBand rl = (RootLevelBand) element;
        final SubReport[] reports = rl.getSubReports();
        for (int j = 0; j < reports.length; j++)
        {
          final SubReport subReport = reports[j];
          processSection(documentBundle, report, subReport);
        }
      }

      // Process the attributes if they are a resource key
      final ElementMetaData metaData = element.getMetaData();
      final AttributeMetaData[] attributeDescriptions = metaData.getAttributeDescriptions();
      for (int j = 0; j < attributeDescriptions.length; j++)
      {
        final AttributeMetaData attributeDescription = attributeDescriptions[j];
        if ("Resource".equals(attributeDescription.getValueRole()) == false)
        {
          continue;
        }

        final Object attribute = element.getAttribute(attributeDescription.getNameSpace(), attributeDescription.getName());
        if (attribute instanceof ResourceKey == false)
        {
          continue;
        }

        final ResourceKey resourceKey = (ResourceKey) attribute;
        final ResourceKey replacementKey = processResourceKeyAttribute(documentBundle, report, resourceKey);
        if (replacementKey != null)
        {
          element.setAttribute(attributeDescription.getNameSpace(), attributeDescription.getName(), replacementKey);
        }
      }
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportElement

                              final Section section) throws ReportProcessingException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof SubReport)
      {
        continue;
      }

      if (element instanceof Section)
      {
        processSection(schema, definition, (Section) element);
        continue;
      }

      final Object attribute =
          element.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE);
      if (attribute instanceof Class == false)
      {
        continue;
      }

      final Class aggType = (Class) attribute;
      if (AggregationFunction.class.isAssignableFrom(aggType) == false)
      {
        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);
        definition.addExpression(o);
      }
      catch (Exception e)
      {
        throw new ReportProcessingException("Failed to pre-process the report", e);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportElement

    final Object o = element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE);
    if (o instanceof ResourceKey)
    {
      return (ResourceKey) o;
    }
    final ReportElement parent = element.getParentSection();
    if (parent != null)
    {
      return getDefinitionSource(parent);
    }
    return null;
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.ReportElement

    final Object o = element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.CONTENT_BASE);
    if (o instanceof ResourceKey)
    {
      return (ResourceKey) o;
    }
    final ReportElement parent = element.getParentSection();
    if (parent != null)
    {
      return getContentBase(parent);
    }
    return null;
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.