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

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


    readHandlers.setAttribute(namespace, tagName, readHandler);
  }

  public void register(final ElementType elementType, final Class<? extends BundleElementWriteHandler> writeHandler)
  {
    ElementMetaData metaData = elementType.getMetaData();
    register(metaData.getName(), writeHandler);
  }
View Full Code Here


    writeHandlers.put(elementType, writeHandler);
  }

  public void registerGenericReader(final ElementType elementType)
  {
    ElementMetaData metaData = elementType.getMetaData();
    register(metaData.getNamespace(), metaData.getName(), GenericElementReadHandler.class);
  }
View Full Code Here

    {
      // A legacy element. Cannot handle that this way.
      return null;
    }

    final ElementMetaData metaData = type.getMetaData();
    final String configKey = ELEMENT_PREFIX + metaData.getName();
    final Configuration globalConfig = ClassicEngineBoot.getInstance().getGlobalConfig();
    final String value = globalConfig.getConfigProperty(configKey);
    if (value != null)
    {
      return (BundleDataFactoryWriterHandler) ObjectUtilities.loadAndInstantiate
          (value, metaData.getClass(), BundleDataFactoryWriterHandler.class);
    }
    return null;
  }
View Full Code Here

          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)
        {
View Full Code Here

  {
  }

  public static boolean validateElementMetaData(ElementType elementType)
  {
    ElementMetaData metaData = elementType.getMetaData();
    if (metaData == null)
    {
      logger.warn("No Metadata defined");
      return false;
    }

    if (validateCanInstantiate(metaData))
    {
      return false;
    }

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

    ArrayList<String> missingProperties = new ArrayList<String>();
    validateCoreMetaData(metaData, missingProperties);
    validateStyleMetaData(metaData, missingProperties);
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

    ClassicEngineBoot.getInstance().start();
  }

  public void testRegisterAttribute ()
  {
    final ElementMetaData metaData =
        ElementTypeRegistry.getInstance().getElementType(LabelType.INSTANCE.getMetaData().getName());
    final AttributeMetaData attrMeta = metaData.getAttributeDescription("namespace", "Name");
    assertNull(attrMeta);

    final AttributeRegistry attributeRegistry =
        ElementTypeRegistry.getInstance().getAttributeRegistry(LabelType.INSTANCE);

    final DefaultAttributeMetaData m = new DefaultAttributeMetaData
        ("namespace", "Name", BUNDLE_LOCATION, "prefix",
            String.class, false, ClassicEngineBoot.computeCurrentVersionId());
    attributeRegistry.putAttributeDescription(m);

    final AttributeMetaData attributeDescription = metaData.getAttributeDescription("namespace", "Name");
    assertEquals("prefix", attributeDescription.getKeyPrefix());
    assertEquals(BUNDLE_LOCATION, attributeDescription.getBundleLocation());
  }
View Full Code Here

    final ElementMetaData[] allTypes = ElementTypeRegistry.getInstance().getAllElementTypes();
    Arrays.sort(allTypes, GroupedMetaDataComparator.ENGLISH);

    for (int i = 0; i < allTypes.length; i++)
    {
      final ElementMetaData type = allTypes[i];
      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

    Arrays.sort(allTypes, GroupedMetaDataComparator.ENGLISH);

    System.out.println ("# Element definitions");
    for (int i = 0; i < allTypes.length; i++)
    {
      final ElementMetaData type = allTypes[i];
      final String prefix;
      if (type instanceof AbstractMetaData)
      {
        final AbstractMetaData metaData = (AbstractMetaData) type;
        final String prefixMetadata = metaData.getKeyPrefix();
        if (StringUtils.isEmpty(prefixMetadata))
        {
          prefix = "";
        }
        else
        {
          prefix = prefixMetadata + type.getName() + ".";
        }
      }
      else
      {
        prefix = "element." + type.getName() + ".";
      }

      printMetadata(type, prefix, "display-name", type.getName());
      printMetadata(type, prefix, "grouping", "");
      printMetadata(type, prefix, "grouping.ordinal", "0");
      printMetadata(type, prefix, "ordinal", "0");
      printMetadata(type, prefix, "description", "");
      printMetadata(type, prefix, "deprecated", "");
      printMetadata(type, prefix, "icon", "");
      System.out.println();

      final AttributeMetaData[] attributeDescriptions = type.getAttributeDescriptions();
      for (int j = 0; j < attributeDescriptions.length; j++)
      {
        final AttributeMetaData attribute = attributeDescriptions[j];
        final String attrNs = ElementTypeRegistry.getInstance().getNamespacePrefix(attribute.getNameSpace());
        final String attrPrefix;
        if (attribute instanceof AbstractMetaData)
        {
          final AbstractMetaData metaData = (AbstractMetaData) attribute;
          final String prefixMetadata = metaData.getKeyPrefix();
          if (StringUtils.isEmpty(prefixMetadata))
          {
            attrPrefix = "";
          }
          else
          {
            attrPrefix = prefixMetadata + attribute.getName() + ".";
          }
        }
        else
        {
          attrPrefix = "element." + type.getName() + ".attribute." + attrNs + "." + attribute.getName();
        }
        attributes.put(attrPrefix, new AttributeCarrier(attrPrefix, attribute));
      }
    }
View Full Code Here

      currentFieldsAndValues.putAll(evalResult.seenFields);
      return false;
    }

    final HashMap<String, Object> values = new HashMap<String, Object>();
    final ElementMetaData metaData = e.getElementType().getMetaData();
    final AttributeMetaData[] attributeDescriptions = metaData.getAttributeDescriptions();
    for (int i = 0; i < attributeDescriptions.length; i++)
    {
      final AttributeMetaData attributeDescription = attributeDescriptions[i];
      final Object attribute = e.getAttribute(attributeDescription.getNameSpace(), attributeDescription.getName());
      if (attribute == null)
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.