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

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


    {
      final ReportElement element = elements[elementCount];
      final AttributeMetaData[] datas = element.getMetaData().getAttributeDescriptions();
      for (int j = 0; j < datas.length; j++)
      {
        final AttributeMetaData data = datas[j];

        final String name = data.getName();
        final String namespace = data.getNameSpace();

        if (data.isHidden())
        {
          attributes.setAttribute(namespace, name, Boolean.FALSE);
          continue;
        }
View Full Code Here


  }

  private AttributeMetaData selectMetaData(final ReportElement element)
  {
    final ElementMetaData elementMetaData = element.getMetaData();
    final AttributeMetaData fieldData =
            elementMetaData.getAttributeDescription(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD);
    if (fieldData != null)
    {
      return fieldData;
    }
View Full Code Here

  private static AttributeMetaData find(final AttributeMetaData[] data, final String namespace, final String name)
  {
    for (int i = 0; i < data.length; i++)
    {
      final AttributeMetaData attributeMetaData = data[i];
      if (attributeMetaData.getName().equals(name) && attributeMetaData.getNameSpace().equals(namespace))
      {
        return attributeMetaData;
      }
    }
    return null;
View Full Code Here

      final ElementMetaData data = visualElement.getMetaData();
      final AttributeMetaData[] datas = data.getAttributeDescriptions();
      for (int j = 0; j < datas.length; j++)
      {
        final AttributeMetaData metaData = datas[j];
        final AttributeMetaData attributeMetaData =
            targetMetaData.getAttributeDescription(metaData.getNameSpace(), metaData.getName());
        if (attributeMetaData == null)
        {
          visualElement.setAttribute(metaData.getNameSpace(), metaData.getName(), null);
          visualElement.setAttributeExpression(metaData.getNameSpace(), metaData.getName(), null);
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

    {
      setEnabled(false);
      return;
    }
    final Element e = (Element) o;
    final AttributeMetaData data = e.getElementType().getMetaData().getAttributeDescription
            (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);
    if (data == null)
    {
      setEnabled(false);
      return;
    }
    setEnabled("Resource".equals(data.getValueRole())); // NON-NLS
  }
View Full Code Here

    if (o instanceof Element == false)
    {
      return;
    }
    final Element element = (Element) o;
    final AttributeMetaData data = element.getElementType().getMetaData().getAttributeDescription
            (AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);
    if (data == null)
    {
      return;
    }
    if("Resource".equals(data.getValueRole()) == false) // NON-NLS
    {
      return;
    }

    final CustomPropertyEditorDialog editorDialog;
View Full Code Here

  {
    final ElementMetaData metaData = element.getMetaData();
    final AttributeMetaData[] attributeDescriptions = metaData.getAttributeDescriptions();
    for (int i = 0; i < attributeDescriptions.length; i++)
    {
      final AttributeMetaData attributeMetaData = attributeDescriptions[i];
      final Object value = element.getAttribute(attributeMetaData.getNameSpace(), attributeMetaData.getName());
      if (value != null)
      {
        if (attributeMetaData.getTargetType().isInstance(value) == false)
        {
          // notify of invalid type
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("MandatoryAttributeMissingInspection.AttributeValueHasInvalidType",
                  element.getName(), attributeMetaData.getDisplayName(Locale.getDefault()),
                  attributeMetaData.getTargetType().getName(), value.getClass().getName()),
              new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));
        }

        if (attributeMetaData.isDesignTimeValue())
        {
          if (element.getAttributeExpression(attributeMetaData.getNameSpace(), attributeMetaData.getName()) != null)
          {
            // warn that design-time values have no need for a expression
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("MandatoryAttributeMissingInspection.DesignTimeAttributeWithExpression",
                    element.getName(), attributeMetaData.getDisplayName(Locale.getDefault())),
                new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));
          }
        }
        continue;
      }

      if (attributeMetaData.isMandatory() == false)
      {
        continue;
      }
      if (attributeMetaData.isDesignTimeValue() == false)
      {
        if (element.getAttributeExpression(attributeMetaData.getNameSpace(), attributeMetaData.getName()) != null)
        {
          continue;
        }

        // warn that either value or expression must be set
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("MandatoryAttributeMissingInspection.MandatoryAttributeWithoutValueOrExpression",
                element.getName(), attributeMetaData.getDisplayName(Locale.getDefault())),
            new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));

      }
      else
      {
        // warn that a value must be set
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("MandatoryAttributeMissingInspection.MandatoryAttributeWithoutValue",
                element.getName(), attributeMetaData.getDisplayName(Locale.getDefault())),
            new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));
      }
    }

//    traverseAttributeExpressions(designerContext, reportRenderContext, resultHandler, columnNames, element);
//    traverseStyleExpressions(designerContext, reportRenderContext, resultHandler, columnNames, element);
View Full Code Here

                                final ReportElement element)
  {
    final AttributeMetaData[] datas = element.getMetaData().getAttributeDescriptions();
    for (int i = 0; i < datas.length; i++)
    {
      final AttributeMetaData metaData = datas[i];

      if (!"Group".equals(metaData.getValueRole()))//NON-NLS
      {
        continue;
      }

      final Object value = element.getAttribute(metaData.getNameSpace(), metaData.getName());
      final String[] groups = metaData.getReferencedGroups(element, value);
      for (int j = 0; j < groups.length; j++)
      {
        final String group = groups[j];
        final AbstractReportDefinition reportDefinition = reportRenderContext.getReportDefinition();
        final ReportElement e = reportDefinition.getGroupByName(group);
        if (e == null)
        {
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("InvalidGroupReferenceInspection.AttributeInvalidGroup",
                  element.getName(), group, metaData.getDisplayName(Locale.getDefault())),
              new AttributeLocationInfo(element, metaData.getNameSpace(), metaData.getName(), false)));
        }
      }
    }

  }
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.