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

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


        {
          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.");
            }
          }
          if (value instanceof Cloneable)
          {
            e.attributes.setAttribute(namespace, name, ObjectUtilities.clone(value));
          }
          else if (data == null || data.isComputed() == false || data.isDesignTimeValue())
          {
            e.attributes.setAttribute(namespace, name, value);
          }
          else
          {
View Full Code Here


      for (int j = 0; j < names.length; j++)
      {
        final String name = names[j];
        final Object attribute = attributes.getAttribute(nameSpace, name);

        final AttributeMetaData data = getMetaData().getAttributeDescription(nameSpace, name);
        if (data != null)
        {
          if (data.isTransient())
          {
            stream.writeByte(1);
            continue;
          }

          if (attribute instanceof ResourceKey)
          {
            final ResourceKey key = (ResourceKey) attribute;
            final ResourceKey parent = key.getParent();
            if (AttributeNames.Core.NAMESPACE.equals(nameSpace) &&
                (AttributeNames.Core.CONTENT_BASE.equals(name) || AttributeNames.Core.SOURCE.equals(name)))
            {
              if (parent != null)
              {
                // unwrap the content base attribute. After deserialization, the report assumes the bundle-location
                // as content base, as the bundle will be gone.
                if (isKeySerializable(parent))
                {
                  stream.writeByte(0);
                  SerializerHelper.getInstance().writeObject(parent, stream);
                }
                else
                {
                  stream.writeByte(1);
                }
              }
              else
              {
                // great, the report was never part of a bundle. That makes life easier and the key should be
                // safely serializable too.

                if (isKeySerializable(key))
                {
                  stream.writeByte(0);
                  SerializerHelper.getInstance().writeObject(key, stream);
                }
                else
                {
                  stream.writeByte(1);
                }
              }
            }
            else
            {
              if ("Resource".equals(data.getValueRole()) || parent != null)
              {
                stream.writeByte(0);
                try
                {
                  final ResourceKey resourceKey =
View Full Code Here

      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())
        {
          continue;
        }
        target.setAttributeExpression(namespace, name, getAttributeExpression(namespace, name));
      }
View Full Code Here


      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)
        {
          logger.warn("ElementType '" + typeName + ": Attr " + propertyMetaData.getName() + ": No DisplayName");
        }

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

      System.err.flush();
View Full Code Here

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

    final Iterator iterator = globalAttributes.entrySet().iterator();
    while (iterator.hasNext())
    {
      final Map.Entry o = (Map.Entry) iterator.next();

      final AttributeMetaData attribute = (AttributeMetaData) o.getValue();
      final AbstractMetaData aamd = (AbstractMetaData) attribute;
      final String akeyPrefix = aamd.getKeyPrefix();
      final String abundle = aamd.getBundleLocation();
      final String aname = attribute.getName();

      System.out.println(akeyPrefix + aname + ".display-name=" + aname);
      System.out.println(akeyPrefix + aname + ".grouping=" + filter(aamd.getGrouping(Locale.ENGLISH), "Group"));
      System.out.println(akeyPrefix + aname + ".description=" + filter(aamd.getDescription(Locale.ENGLISH), ""));
      System.out.println(akeyPrefix + aname + ".deprecated=" + filter(aamd.getDeprecationMessage(Locale.ENGLISH), ""));
View Full Code Here

    final AttributeMetaData[] attributes = data.getAttributeDescriptions();

    for (int j = 0; j < attributes.length; j++)
    {
      final AttributeMetaData attribute = attributes[j];
      final AbstractMetaData aamd = (AbstractMetaData) attribute;
      final String akeyPrefix = aamd.getKeyPrefix();
      final String abundle = aamd.getBundleLocation();
      final String aname = attribute.getName();
      if (abundle.equals(GLOBAL_BUNDLE) && akeyPrefix.startsWith("attribute."))
      {
        globalAttributes.put (aname, attribute);
        continue;
      }
View Full Code Here


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

    final FormulaExpression fe = (FormulaExpression) expression;
    final String s = fe.getFormula();
    if (StringUtils.isEmpty(s, true))
    {
      final AttributeMetaData attrMeta =
          element.getMetaData().getAttributeDescription(attributeNamespace, attributeName);
      if (attrMeta != null)
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("FormulaErrorInspection.AttributeNoFormulaNoMetaData",
                element.getName(), attrMeta.getDisplayName(Locale.getDefault())),
            new AttributeLocationInfo(element, attributeNamespace, attributeName, true)));
      }
      else
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("FormulaErrorInspection.AttributeNoFormulaNoMetaData",
                element.getName(), attributeNamespace, attributeName),
            new AttributeLocationInfo(element, attributeNamespace, attributeName, true)));
      }
      return;
    }

    try
    {
      compileFormula(s);
    }
    catch (ParseException pe)
    {

      final AttributeMetaData attrMeta = element.getMetaData().getAttributeDescription
          (attributeNamespace, attributeName);
      if (attrMeta != null)
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("FormulaErrorInspection.AttributeInvalidFormula",
                element.getName(), attrMeta.getDisplayName(Locale.getDefault())),
            new AttributeLocationInfo(element, attributeNamespace, attributeName, true)));
      }
      else
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
View Full Code Here

        }

        final Object o = utility.getProperty(metaData.getName());
        if (metaData.isMandatory() && o == null)
        {
          final AttributeMetaData attributeMetaData =
              element.getMetaData().getAttributeDescription(attributeNamespace, attributeName);
          if (attributeMetaData == null)
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("ExpressionsParameterInspection.AttributeExpressionMandatoryPropertyMissingNoMetaData",
                    element.getName(), attributeNamespace, attributeName, metaData.getDisplayName(Locale.getDefault())),
                new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
          }
          else
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("ExpressionsParameterInspection.AttributeExpressionMandatoryPropertyMissing",
                    element.getName(), attributeMetaData.getDisplayName(Locale.getDefault()),
                    metaData.getDisplayName(Locale.getDefault())),
                new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
          }

        }
      }

      if (expression instanceof ValidateableExpression)
      {
        final ValidateableExpression vae = (ValidateableExpression) expression;
        final Map map = vae.validateParameter(new ReportDesignerDesignTimeContext(designerContext), Locale.getDefault());
        final Iterator iterator = map.entrySet().iterator();
        while (iterator.hasNext())
        {
          final Map.Entry entry = (Map.Entry) iterator.next();
          final String property = (String) entry.getKey();
          final String warning = (String) entry.getValue();

          final AttributeMetaData attributeMetaData =
              element.getMetaData().getAttributeDescription(attributeNamespace, attributeName);
          if (attributeMetaData == null)
          {
            if (property == null)
            {
              resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                  Messages.getString("ExpressionsParameterInspection.AttributeExpressionValidationErrorNoMetaData",
                      element.getName(), attributeNamespace, attributeName, warning),
                  new AttributeLocationInfo(element, attributeNamespace, attributeName, true)));
            }
            else
            {
              resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                  Messages.getString("ExpressionsParameterInspection.AttributeExpressionValidationPropertyErrorNoMetaData",
                      element.getName(), attributeNamespace, attributeName, property, warning),
                  new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, property)));
            }
          }
          else
          {
            if (property == null)
            {
              resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                  Messages.getString("ExpressionsParameterInspection.AttributeExpressionValidationError",
                      element.getName(), attributeMetaData.getDisplayName(Locale.getDefault()), warning),
                  new AttributeLocationInfo(element, attributeNamespace, attributeName, true)));
            }
            else
            {
              resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                  Messages.getString("ExpressionsParameterInspection.AttributeExpressionValidationPropertyError",
                      element.getName(), attributeMetaData.getDisplayName(Locale.getDefault()), property, warning),
                  new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, property)));
            }
          }
        }
      }
View Full Code Here

TOP

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

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.