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

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


    final ExpressionPropertyMetaData[] attributes = data.getPropertyDescriptions();

    for (int j = 0; j < attributes.length; j++)
    {
      final ExpressionPropertyMetaData attribute = attributes[j];
      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


      expressionsByGroup.add(grouping, expression);

      final ExpressionPropertyMetaData[] properties = expression.getPropertyDescriptions();
      for (int j = 0; j < properties.length; j++)
      {
        final ExpressionPropertyMetaData propertyMetaData = properties[j];
        final String name = propertyMetaData.getName();
        if (StringUtils.isEmpty(name))
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property without a name");
        }
        final String propertyDisplayName = propertyMetaData.getDisplayName(locale);
        if (isValid(propertyDisplayName, name) == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": No DisplayName");
        }

        final String propertyGrouping = propertyMetaData.getGrouping(locale);
        if (isValid(propertyGrouping, "Group") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Grouping is not valid");
        }
        final int groupingOrdinal = propertyMetaData.getGroupingOrdinal(locale);
        if (groupingOrdinal == Integer.MAX_VALUE)
        {
          if (propertyMetaData instanceof DefaultExpressionMetaData)
          {
            final DefaultExpressionPropertyMetaData demd = (DefaultExpressionPropertyMetaData) propertyMetaData;
            missingProperties.add(demd.getKeyPrefix() + "grouping.ordinal=1000");
          }
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Grouping ordinal is not valid");
        }
        final int ordinal = propertyMetaData.getItemOrdinal(locale);
        if (groupingOrdinal == Integer.MAX_VALUE)
        {
          if (propertyMetaData instanceof DefaultExpressionMetaData)
          {
            final DefaultExpressionPropertyMetaData demd = (DefaultExpressionPropertyMetaData) propertyMetaData;
            missingProperties.add(demd.getKeyPrefix() + "ordinal=1000");
          }
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Ordinal is not valid");
        }
        final String propertyDescription = propertyMetaData.getDescription(locale);
        if (isValid(propertyDescription, "") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Description is not valid");
        }
        final String propertyDeprecated = propertyMetaData.getDeprecationMessage(locale);
        if (isValid(propertyDeprecated, "") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Deprecation is not valid");
        }

        final String role = propertyMetaData.getPropertyRole();
        if (isValid(role, "Value") == false)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Role is not valid");
        }
        final Class propertyType = propertyMetaData.getPropertyType();
        if (propertyType == null)
        {
          logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": Property Type is not valid");
        }

        // should not crash!
        final PropertyDescriptor propertyDescriptor = propertyMetaData.getBeanDescriptor();

        if (propertyMetaData.isDeprecated())
        {
          final String deprecateMessage = propertyMetaData.getDeprecationMessage(locale);
          if (isValid(deprecateMessage, "Deprecated") == false)
          {
            logger.warn("Expression '" + expression.getExpressionType() + ": Property " + propertyMetaData.getName() + ": No valid deprecate message");
          }
        }

      }
View Full Code Here

        final BeanUtility bu = new BeanUtility(expression);
        final ExpressionPropertyMetaData[] expressionProperties = emd.getPropertyDescriptions();
        boolean propertiesOpen = false;
        for (int i = 0; i < expressionProperties.length; i++)
        {
          final ExpressionPropertyMetaData metaData = expressionProperties[i];
          final String propertyName = metaData.getName();
          if (isFilteredProperty(propertyName))
          {
            continue;
          }
          if (metaData.isComputed())
          {
            continue;
          }
          if (propertiesOpen == false)
          {
View Full Code Here

    final String contentBasePath = String.valueOf(contentBasePathRaw);
    final ResourceManager resourceManager = state.getMasterReport().getResourceManager();

    for (int i = 0; i < datas.length; i++)
    {
      final ExpressionPropertyMetaData attributeMetaData = datas[i];
      final Object attValue = beanUtility.getProperty(attributeMetaData.getName());
      if (attValue == null)
      {
        continue;
      }
      final ResourceReference[] referencedResources = attributeMetaData.getReferencedResources
          (expression, attValue, report, resourceManager);
      for (int j = 0; j < referencedResources.length; j++)
      {
        final ResourceReference reference = referencedResources[j];
        if (reference.isLinked())
View Full Code Here

        {
          return expressionType;
        }
        if (beanUtility != null && expressionMetaData != null)
        {
          final ExpressionPropertyMetaData propertyMetaData =
              expressionMetaData.getPropertyDescription(name);
          if (propertyMetaData != null)
          {
            try
            {
View Full Code Here

    {
      final BeanUtility utility = new BeanUtility(expression);
      final ExpressionPropertyMetaData[] propertyDescriptions = expressionMetaData.getPropertyDescriptions();
      for (int x = 0; x < propertyDescriptions.length; x++)
      {
        final ExpressionPropertyMetaData metaData = propertyDescriptions[x];
        final Object o = utility.getProperty(metaData.getName());
        if (o instanceof String == false)
        {
          continue;
        }
        final String fmtString = (String) o;
        final String role = metaData.getPropertyRole();
        try
        {
          if ("NumberFormat".equals(role))//NON-NLS
          {
            final DecimalFormat fmt = new DecimalFormat(String.valueOf(o));
          }
          else if ("DateFormat".equals(role))//NON-NLS
          {
            //noinspection SimpleDateFormatWithoutLocale
            final DateFormat fmt = new SimpleDateFormat(String.valueOf(o));
          }
          else if ("Message".equals(role))//NON-NLS
          {
            final MessageFormatSupport support = new MessageFormatSupport();
            support.setFormatString(fmtString);
          }
        }
        catch (Exception e)
        {
          final AttributeMetaData attrMetaData =
              element.getMetaData().getAttributeDescription(attributeNamespace, attributeName);
          if (attrMetaData == null)
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("InvalidFormatInspection.AttributeExpressionInvalidFormatNoMetaData",
                    element.getName(), attributeNamespace, attributeName, fmtString, metaData.getDisplayName(Locale.getDefault())),
                new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
          }
          else
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("InvalidFormatInspection.AttributeExpressionInvalidFormat",
                    element.getName(), attrMetaData.getDisplayName(Locale.getDefault()), fmtString, metaData.getDisplayName(Locale.getDefault())),
                new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
          }

        }

      }
View Full Code Here

    {
      final BeanUtility utility = new BeanUtility(expression);
      final ExpressionPropertyMetaData[] propertyDescriptions = expressionMetaData.getPropertyDescriptions();
      for (int x = 0; x < propertyDescriptions.length; x++)
      {
        final ExpressionPropertyMetaData metaData = propertyDescriptions[x];
        final Object o = utility.getProperty(metaData.getName());
        if (o instanceof String == false)
        {
          continue;
        }
        final String fmtString = (String) o;
        final String role = metaData.getPropertyRole();
        try
        {
          if ("NumberFormat".equals(role))//NON-NLS
          {
            final DecimalFormat fmt = new DecimalFormat(String.valueOf(o));
          }
          else if ("DateFormat".equals(role))//NON-NLS
          {
            //noinspection SimpleDateFormatWithoutLocale
            final DateFormat fmt = new SimpleDateFormat(String.valueOf(o));
          }
          else if ("Message".equals(role))//NON-NLS
          {
            final MessageFormatSupport support = new MessageFormatSupport();
            support.setFormatString(fmtString);
          }
        }
        catch (Exception e)
        {
          final StyleMetaData attrMetaData = element.getMetaData().getStyleDescription(styleKey);
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("InvalidFormatInspection.StyleExpressionInvalidFormat",
                  element.getName(), attrMetaData.getDisplayName(Locale.getDefault()), fmtString, metaData.getDisplayName(Locale.getDefault())),
              new StyleExpressionPropertyLocationInfo(element, styleKey, metaData.getName())));
        }
      }
    }
    catch (Exception e)
    {
View Full Code Here

    {
      final BeanUtility utility = new BeanUtility(expression);
      final ExpressionPropertyMetaData[] datas = expressionMetaData.getPropertyDescriptions();
      for (int i = 0; i < datas.length; i++)
      {
        final ExpressionPropertyMetaData metaData = datas[i];
        final Object o = utility.getProperty(metaData.getName());
        if (o instanceof String == false)
        {
          continue;
        }
        final String fmtString = (String) o;
        final String role = metaData.getPropertyRole();
        try
        {
          if ("NumberFormat".equals(role))//NON-NLS
          {
            final DecimalFormat fmt = new DecimalFormat(String.valueOf(o));
          }
          else if ("DateFormat".equals(role))//NON-NLS
          {
            //noinspection SimpleDateFormatWithoutLocale
            final DateFormat fmt = new SimpleDateFormat(String.valueOf(o));
          }
          else if ("Message".equals(role))//NON-NLS
          {
            final MessageFormatSupport support = new MessageFormatSupport();
            support.setFormatString(fmtString);
          }
        }
        catch (Exception e)
        {
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("InvalidFormatInspection.ExpressionInvalidFormat",
                  expression.getName(), metaData.getDisplayName(Locale.getDefault()), fmtString, metaData.getDisplayName(Locale.getDefault())),
              new PropertyLocationInfo(expression, metaData.getName())));
        }
      }
    }
    catch (Exception e)
    {
View Full Code Here

    {
      final BeanUtility utility = new BeanUtility(expression);
      final ExpressionPropertyMetaData[] datas = expressionMetaData.getPropertyDescriptions();
      for (int i = 0; i < datas.length; i++)
      {
        final ExpressionPropertyMetaData metaData = datas[i];
        if (metaData.isHidden())
        {
          continue;
        }
        if (WorkspaceSettings.getInstance().isShowExpertItems() == false && metaData.isExpert())
        {
          continue;
        }
        if (WorkspaceSettings.getInstance().isShowDeprecatedItems() == false && metaData.isDeprecated())
        {
          continue;
        }

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

        final Object o = utility.getProperty(metaData.getName());
        final String[] elements = metaData.getReferencedElements(expression, o);
        for (int j = 0; j < elements.length; j++)
        {
          final String element = elements[j];
          final AbstractReportDefinition reportDefinition = reportRenderContext.getReportDefinition();
          final ReportElement e =
              FunctionUtilities.findElementByAttribute(reportDefinition, AttributeNames.Core.NAMESPACE,
                  AttributeNames.Core.NAME, element);
          if (e == null)
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("InvalidElementReferenceInspection.ExpressionReferencesInvalidName",
                    expression.getName(), metaData.getDisplayName(Locale.getDefault())),
                new PropertyLocationInfo(expression, metaData.getName())));
          }
        }
      }
    }
    catch (Exception e)
View Full Code Here

      final BeanUtility utility = new BeanUtility(expression);
      final ExpressionMetaData data = ExpressionRegistry.getInstance().getExpressionMetaData(expressionName);
      final ExpressionPropertyMetaData[] datas = data.getPropertyDescriptions();
      for (int i = 0; i < datas.length; i++)
      {
        final ExpressionPropertyMetaData metaData = datas[i];
        if (metaData.isHidden())
        {
          continue;
        }
        if (WorkspaceSettings.getInstance().isShowExpertItems() == false && metaData.isExpert())
        {
          continue;
        }
        if (WorkspaceSettings.getInstance().isShowDeprecatedItems() == false && metaData.isDeprecated())
        {
          continue;
        }
        if ("name".equals(metaData.getName()))
        {
          continue;
        }

        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())));
          }

        }
      }
View Full Code Here

TOP

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

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.