Examples of InspectionResult


Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

    for (int i = 0; i < parameterDefinitionEntries.length; i++)
    {
      final ParameterDefinitionEntry definitionEntry = parameterDefinitionEntries[i];
      if (reservedParameterNames.contains(definitionEntry.getName()))
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getInstance().formatMessage
                ("ReservedParameterNamesInspection.ReservedParameterNameUsed", definitionEntry.getName()),
            new ParameterLocationInfo(definitionEntry)));
      }
    }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

    {
      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,
            Messages.getString("FormulaErrorInspection.AttributeInvalidFormulaNoMetaData",
                element.getName(), attributeNamespace, attributeName),
            new AttributeLocationInfo(element, attributeNamespace, attributeName, true)));
      }
    }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

    if (StringUtils.isEmpty(s, true))
    {
      final StyleMetaData description = element.getMetaData().getStyleDescription(styleKey);
      if (description == null)
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("FormulaErrorInspection.StyleNoFormulaNoMetaData",
                element.getName(), styleKey.getName()),
            new StyleLocationInfo(element, styleKey, true)));
      }
      else
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("FormulaErrorInspection.StyleNoFormula",
                element.getName(), description.getDisplayName(Locale.getDefault())),
            new StyleLocationInfo(element, styleKey, true)));
      }
      return;
    }

    try
    {
      compileFormula(s);
    }
    catch (ParseException pe)
    {
      // pe is ignored
      final StyleMetaData description = element.getMetaData().getStyleDescription(styleKey);
      if (description != null)
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("FormulaErrorInspection.StyleInvalidFormula",
                element.getName(), description.getDisplayName(Locale.getDefault())),
            new StyleLocationInfo(element, styleKey, true)));
      }
      else
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("FormulaErrorInspection.StyleInvalidFormulaNoMetaData",
                element.getName(), styleKey.getName()),
            new StyleLocationInfo(element, styleKey, true)));
      }
    }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

        {
          compileFormula((String) o);
        }
        catch (ParseException fpe)
        {
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("FormulaErrorInspection.ExpressionInvalidFormula", expression.getName(),
                  metaData.getDisplayName(Locale.getDefault())),
              new PropertyLocationInfo(expression, metaData.getName())));
        }
      }
    }
    catch (Exception e)
    {
      resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
          e.getMessage(),
          new LocationInfo(expression)));
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

          message = Messages.getString("OverlappingElementsInspection.ElementConflictsInTableModeMultiples",
              element.getName(), elementName, instanceIDs.size());
        }
      }

      resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
          message, new LocationInfo(element)));
    }

  }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

          continue;
        }
        final Object o = utility.getProperty(metaData.getName());
        if (metaData.isMandatory() && o == null)
        {
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("ExpressionsParameterInspection.MandatoryPropertyMissing",
                  expression.getName(), metaData.getDisplayName(Locale.getDefault())),
              new PropertyLocationInfo(expression, 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();
          if (property == null)
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("ExpressionsParameterInspection.ExpressionValidationError",
                    expression.getName(), warning),
                new LocationInfo(expression)));
          }
          else
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("ExpressionsParameterInspection.ExpressionValidationPropertyError",
                    expression.getName(), property, warning),
                new PropertyLocationInfo(expression, property)));
          }
        }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

        {
          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

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

          else
          {
            displayName = description.getDisplayName(Locale.getDefault());
          }

          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("ExpressionsParameterInspection.StyleExpressionMandatoryPropertyMissing",
                  element.getName(), displayName, metaData.getDisplayName(Locale.getDefault())),
              new StyleExpressionPropertyLocationInfo(element, styleKey, 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();
          if (property == null)
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                warning, new LocationInfo(expression)));
          }
          else
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                warning, new PropertyLocationInfo(expression, property)));
          }
        }
      }
    }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

    {
      final Expression expression = expressions[i];
      final String columnName = expression.getName();
      if (exprNames.add(columnName) == false)
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("DuplicateFieldInspection.ExpressionDuplicate", columnName),
            new LocationInfo(reportDefinition)));
        warnedNames.add(columnName);
      }
    }

    final HashSet<String> cols = new HashSet<String>();
    for (int i = 0; i < columnNames.length; i++)
    {
      final String columnName = columnNames[i];
      if (warnedNames.contains(columnName) == false && cols.add(columnName) == false)
      {
        resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
            Messages.getString("DuplicateFieldInspection.OtherDuplicate", columnName),
            new LocationInfo(reportDefinition)));

      }
    }
View Full Code Here

Examples of org.pentaho.reporting.designer.core.inspections.InspectionResult

      for (int j = 0; j < referencedFields.length; j++)
      {
        final String field = referencedFields[j];
        if (isValidField(field, columnNames) == false)
        {
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("InvalidFieldReferenceInspection.AttributeInvalidField", element.getName(),
                  field, data.getDisplayName(Locale.getDefault())),
              new AttributeLocationInfo(element, data.getNameSpace(), data.getName(), false)
          ));
        }
      }
    }

    traverseAttributeExpressions(designerContext, reportRenderContext, resultHandler, columnNames, element);
    traverseStyleExpressions(designerContext, reportRenderContext, resultHandler, columnNames, element);

    if (element instanceof SubReport && element != reportRenderContext.getReportDefinition())
    {
      final SubReport report = (SubReport) element;
      final ParameterMapping[] parameterMappings = report.getInputMappings();
      for (int i = 0; i < parameterMappings.length; i++)
      {
        final ParameterMapping mapping = parameterMappings[i];
        if ("*".equals(mapping.getName()))
        {
          continue;
        }

        if (isValidField(mapping.getName(), columnNames) == false)
        {
          String message = Messages.getString("InvalidFieldReferenceInspection.SubReportInvalidField",
              report.getName(), mapping.getName());
          InspectionResult ir = new InspectionResult(this, Severity.WARNING, message, new LocationInfo(report));
          resultHandler.notifyInspectionResult(ir);
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.