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

Examples of org.pentaho.reporting.engine.classic.core.metadata.ElementMetaData


        new DefaultAttributeMetaData("test-run", "test-value", bundleLocation, keyPrefix, Object.class, false, 0);

    final ElementMetaData[] types = ElementTypeRegistry.getInstance().getAllElementTypes();
    for (int i = 0; i < types.length; i++)
    {
      final ElementMetaData type = types[i];
      final AttributeRegistry attributeRegistry = ElementTypeRegistry.getInstance().getAttributeRegistry(type.getName());
      attributeRegistry.putAttributeDescription(metaData);
    }

    try
    {
View Full Code Here


  {
    final ElementMetaData[] datas = ElementTypeRegistry.getInstance().getAllElementTypes();
    final String[] tags = new String[datas.length];
    for (int i = 0; i < datas.length; i++)
    {
      final ElementMetaData data = datas[i];
      tags[i] = data.getName();
    }
    return tags;
  }
View Full Code Here

      e.datasource = datasource.clone();
      e.parent = null;
      e.style.updateElementReference(e);
      e.attributes = attributes.clone();
      e.copyOnWrite = false;
      final ElementMetaData metaData = e.getMetaData();
      final String[] namespaces = e.attributes.getNameSpaces();
      for (int i = 0; i < namespaces.length; i++)
      {
        final String namespace = namespaces[i];
        final Map attrsNs = attributes.getAttributes(namespace);
        final Iterator it = attrsNs.entrySet().iterator();
        while (it.hasNext())
        {
          final Map.Entry entry = (Map.Entry) it.next();
          final Object value = entry.getValue();

          final String name = (String) entry.getKey();
          final AttributeMetaData data = metaData.getAttributeDescription(namespace, name);
          if (data == null)
          {
            if (logger.isDebugEnabled())
            {
              logger.debug(getElementTypeName() + ": Attribute " + namespace + "|" + name + " is not listed in the metadata.");
View Full Code Here

    return ReportStructureMatcher.findElementsByName(this, name);
  }

  public void copyInto(final Element target)
  {
    final ElementMetaData metaData = getMetaData();
    final String[] attributeNamespaces = getAttributeNamespaces();
    for (int i = 0; i < attributeNamespaces.length; i++)
    {
      final String namespace = attributeNamespaces[i];
      final String[] attributeNames = getAttributeNames(namespace);
      for (int j = 0; j < attributeNames.length; j++)
      {
        final String name = attributeNames[j];
        final AttributeMetaData attributeDescription = metaData.getAttributeDescription(namespace, name);
        if (attributeDescription == null)
        {
          continue;
        }
        if (attributeDescription.isTransient())
        {
          continue;
        }
        if (attributeDescription.isComputed())
        {
          continue;
        }
        if (AttributeNames.Core.ELEMENT_TYPE.equals(name) &&
            AttributeNames.Core.NAMESPACE.equals(namespace))
        {
          continue;
        }
        target.setAttribute(namespace, name, getAttribute(namespace, name), false);
      }
    }

    final String[] attrExprNamespaces = getAttributeExpressionNamespaces();
    for (int i = 0; i < attrExprNamespaces.length; i++)
    {
      final String namespace = attrExprNamespaces[i];
      final String[] attributeNames = getAttributeExpressionNames(namespace);
      for (int j = 0; j < attributeNames.length; j++)
      {
        final String name = attributeNames[j];

        final AttributeMetaData attributeDescription = metaData.getAttributeDescription(namespace, name);
        if (attributeDescription == null)
        {
          continue;
        }
        if (attributeDescription.isTransient())
View Full Code Here

    final ElementTypeRegistry registry = ElementTypeRegistry.getInstance();
    final ElementMetaData[] elementMetaDatas = registry.getAllElementTypes();
    for (int i = 0; i < elementMetaDatas.length; i++)
    {
      final ElementMetaData metaData = elementMetaDatas[i];
      if (metaData == null)
      {
        logger.warn("Null Expression encountered");
        continue;
      }

      missingProperties.clear();

      try
      {
        final Object type = metaData.create();
      }
      catch (InstantiationException e)
      {
        fail("metadata creation failed");

      }

      final String typeName = metaData.getName();
      logger.debug("Processing " + typeName);

      final Locale locale = Locale.getDefault();
      final String displayName = metaData.getDisplayName(locale);
      if (isValid(displayName) == false)
      {
        logger.warn("ElementType '" + typeName + ": No valid display name");
      }
      if (metaData.isDeprecated())
      {
        final String deprecateMessage = metaData.getDeprecationMessage(locale);
        if (isValid(deprecateMessage) == false)
        {
          logger.warn("ElementType '" + typeName + ": No valid deprecate message");
        }
      }
      final String grouping = metaData.getGrouping(locale);
      if (isValid(grouping) == false)
      {
        logger.warn("ElementType '" + typeName + ": No valid grouping message");
      }

      expressionsByGroup.add(grouping, metaData);

      final StyleMetaData[] styleMetaDatas = metaData.getStyleDescriptions();
      for (int j = 0; j < styleMetaDatas.length; j++)
      {
        final StyleMetaData propertyMetaData = styleMetaDatas[j];
        final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
        if (isValid(propertyDisplayName) == false)
        {
          logger.warn("ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": No DisplayName");
        }

        final String propertyGrouping = propertyMetaData.getGrouping(locale);
        if (isValid(propertyGrouping) == false)
        {
          logger.warn("ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": Grouping is not valid");
        }
        if (propertyMetaData.isDeprecated())
        {
          final String deprecateMessage = propertyMetaData.getDeprecationMessage(locale);
          if (isValid(deprecateMessage) == false)
          {
            logger.warn(
                "ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": No valid deprecate message");
          }
        }
      }


      final AttributeMetaData[] attributeMetaDatas = metaData.getAttributeDescriptions();
      for (int j = 0; j < attributeMetaDatas.length; j++)
      {
        final AttributeMetaData propertyMetaData = attributeMetaDatas[j];
        final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
        if (isValid(propertyDisplayName) == false)
View Full Code Here

    ElementTypeRegistry registry = ElementTypeRegistry.getInstance();
    final ElementMetaData[] elementMetaDatas = registry.getAllElementTypes();
    for (int i = 0; i < elementMetaDatas.length; i++)
    {
      final ElementMetaData metaData = elementMetaDatas[i];
      final String grouping = metaData.getGrouping(locale);
      expressionsByGroup.add(grouping, metaData);
    }

    final Object[] keys = expressionsByGroup.keySet().toArray();
    Arrays.sort(keys);
    for (int i = 0; i < keys.length; i++)
    {
      final Object key = keys[i];
      System.out.println("Group: '" + key + "' Size: " + expressionsByGroup.getValueCount(key));
      final Object[] objects = expressionsByGroup.toArray(key);
      for (int j = 0; j < objects.length; j++)
      {
        ElementMetaData metaData = (ElementMetaData) objects[j];
        System.out.println("   " + metaData.getName());
        final StyleMetaData[] styleDescriptions = metaData.getStyleDescriptions();
        Arrays.sort(styleDescriptions, new GroupedMetaDataComparator());
        System.out.println("     Styles:");
        for (int k = 0; k < styleDescriptions.length; k++)
        {
          final StyleMetaData styleMetaData = styleDescriptions[k];
View Full Code Here

    ClassicEngineBoot.getInstance().start();
    final TreeMap allStyles = new TreeMap();
    final ElementMetaData[] allTypes = ElementTypeRegistry.getInstance().getAllElementTypes();
    for (int i = 0; i < allTypes.length; i++)
    {
      final ElementMetaData type = allTypes[i];
      final String prefix = "element." + type.getName();
      System.out.println(prefix + ".display-name=" + type.getName());
      System.out.println(prefix + ".description="+ type.getName());
      System.out.println(prefix + ".grouping=Group");

      final AttributeMetaData[] attributes = type.getAttributeDescriptions();
      for (int j = 0; j < attributes.length; j++)
      {
        final AttributeMetaData attribute = attributes[j];
        final String attrNsPrefix = ElementTypeRegistry.getInstance().getNamespacePrefix(attribute.getNameSpace());
        final String attrPrefix = "element." + type.getName() + ".attribute." +
            attrNsPrefix + "." + attribute.getName();
        System.out.println(attrPrefix + ".display-name=" + attribute.getName());
        System.out.println(attrPrefix + ".description=" + attribute.getName());
        System.out.println(attrPrefix + ".grouping=" + attrNsPrefix);
      }

      final StyleMetaData[] styles = type.getStyleDescriptions();
      for (int j = 0; j < styles.length; j++)
      {
        final StyleMetaData style = styles[j];
        allStyles.put(style.getName(), style);
      }
View Full Code Here

    ClassicEngineBoot.getInstance().start();
    final TreeMap globalAttributes = new TreeMap();
    final ElementMetaData[] datas = ElementTypeRegistry.getInstance().getAllElementTypes();
    for (int i = 0; i < datas.length; i++)
    {
      final ElementMetaData data = datas[i];
      if (data instanceof AbstractMetaData == false)
      {
        continue;
      }
      printMetaBundle(data, globalAttributes);
View Full Code Here

    ClassicEngineBoot.getInstance().start();
    final ElementMetaData[] elementMetaDatas = ElementTypeRegistry.getInstance().getAllElementTypes();
    for (int i = 0; i < elementMetaDatas.length; i++)
    {
      final ElementMetaData elementMetaData = elementMetaDatas[i];
      final StyleMetaData[] styleMetaDatas = elementMetaData.getStyleDescriptions();
      for (int j = 0; j < styleMetaDatas.length; j++)
      {
        final StyleMetaData styleMetaData = styleMetaDatas[j];
        styles.put(styleMetaData.getName(), styleMetaData);
      }
View Full Code Here

    ElementTypeRegistry registry = ElementTypeRegistry.getInstance();
    final ElementMetaData[] elementMetaDatas = registry.getAllElementTypes();
    for (int i = 0; i < elementMetaDatas.length; i++)
    {
      final ElementMetaData metaData = elementMetaDatas[i];
      if (metaData == null)
      {
        logger.warn("Null Expression encountered");
        continue;
      }

      missingProperties.clear();

      try
      {
        final Object type = metaData.create();
      }
      catch (InstantiationException e)
      {
        logger.warn("Expression class is null");

      }

      final String typeName = metaData.getName();
      logger.debug("Processing " + typeName);

      final Locale locale = Locale.getDefault();
      final String displayName = metaData.getDisplayName(locale);
      if (isValid(displayName, metaData.getName()) == false)
      {
        logger.warn("ElementType '" + typeName + ": No valid display name");
      }
      if (metaData.isDeprecated())
      {
        deprecatedExpressionsCounter += 1;
        final String deprecateMessage = metaData.getDeprecationMessage(locale);
        if (isValid(deprecateMessage, "Use a Formula instead") == false)
        {
          logger.warn("ElementType '" + typeName + ": No valid deprecate message");
        }
      }
      final String grouping = metaData.getGrouping(locale);
      if (isValid(grouping, "Group") == false)
      {
        logger.warn("ElementType '" + typeName + ": No valid grouping message");
      }

      expressionsByGroup.add(grouping, metaData);

      final StyleMetaData[] styleMetaDatas = metaData.getStyleDescriptions();
      for (int j = 0; j < styleMetaDatas.length; j++)
      {
        final StyleMetaData propertyMetaData = styleMetaDatas[j];
        final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
        if (isValid(propertyDisplayName, propertyMetaData.getName()) == false)
        {
          logger.warn("ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": No DisplayName");
        }

        final String propertyGrouping = propertyMetaData.getGrouping(locale);
        if (isValid(propertyGrouping, "Group") == false)
        {
          logger.warn("ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": Grouping is not valid");
        }
        if (propertyMetaData.isDeprecated())
        {
          final String deprecateMessage = propertyMetaData.getDeprecationMessage(locale);
          if (isValid(deprecateMessage, "Deprecated") == false)
          {
            logger.warn(
                "ElementType '" + typeName + ": Style " + propertyMetaData.getName() + ": No valid deprecate message");
          }
        }
      }


      final AttributeMetaData[] attributeMetaDatas = metaData.getAttributeDescriptions();
      for (int j = 0; j < attributeMetaDatas.length; j++)
      {
        final AttributeMetaData propertyMetaData = attributeMetaDatas[j];
        final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
        if (isValid(propertyDisplayName, propertyMetaData.getName()) == false)
        {
          logger.warn("ElementType '" + typeName + ": Attr " + propertyMetaData.getName() + ": No DisplayName");
        }

        final String propertyGrouping = propertyMetaData.getGrouping(locale);
        if (isValid(propertyGrouping, "Group") == false)
        {
          logger.warn("ElementType '" + typeName + ": Attr " + propertyMetaData.getName() + ": Grouping is not valid");
        }
        if (propertyMetaData.isDeprecated())
        {
          final String deprecateMessage = propertyMetaData.getDeprecationMessage(locale);
          if (isValid(deprecateMessage, "Deprecated") == false)
          {
            logger.warn(
                "ElementType '" + typeName + ": Attr " + propertyMetaData.getName() + ": No valid deprecate message");
          }
        }
      }

      System.err.flush();
      try
      {
        Thread.sleep(25);
      }
      catch (InterruptedException e)
      {
      }

      for (int x = 0; x < missingProperties.size(); x++)
      {
        final String property = (String) missingProperties.get(x);
        System.out.println(property);
      }

      if (missingProperties.isEmpty() == false)
      {
        invalidExpressionsCounter += 1;
        missingProperties.clear();
      }
      System.out.flush();
      try
      {
        Thread.sleep(25);
      }
      catch (InterruptedException e)
      {
      }
    }

    logger.info("Validated " + elementMetaDatas.length + " expressions. Invalid: " +
        invalidExpressionsCounter + " Deprecated: " + deprecatedExpressionsCounter);

    final Object[] keys = expressionsByGroup.keySet().toArray();
    Arrays.sort(keys);
    for (int i = 0; i < keys.length; i++)
    {
      final Object key = keys[i];
      logger.info("Group: '" + key + "' Size: " + expressionsByGroup.getValueCount(key));
      final Object[] objects = expressionsByGroup.toArray(key);
      for (int j = 0; j < objects.length; j++)
      {
        ElementMetaData metaData = (ElementMetaData) objects[j];
        logger.info("   " + metaData.getName());

      }
    }
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.metadata.ElementMetaData

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.