Examples of InspectionResult


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

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

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

        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

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

          final String element = elements[j];
          final AbstractReportDefinition reportDefinition = reportRenderContext.getReportDefinition();
          final ReportElement e = reportDefinition.getGroupByName(element);
          if (e == null)
          {
            resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                Messages.getString("InvalidGroupReferenceInspection.ExpressionInvalidGroup",
                    expression.getName(), element, 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

          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)
    {
      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

    if (query == null)
    {
      final AttributeLocationInfo queryLocation = new AttributeLocationInfo
          (definition, AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY, false);
      resultHandler.notifyInspectionResult
          (new InspectionResult(this, InspectionResult.Severity.HINT,
              Messages.getString("InvalidQueryNameReferenceInspection.QueryUndefined"),
              queryLocation));

    }
    else
    {
      if (isQueryExecutable(definition, query) == false)
      {
        final AttributeLocationInfo queryLocation = new AttributeLocationInfo
            (definition, AttributeNames.Internal.NAMESPACE, AttributeNames.Internal.QUERY, false);
        resultHandler.notifyInspectionResult
            (new InspectionResult(this, InspectionResult.Severity.ERROR,
                Messages.getString("InvalidQueryNameReferenceInspection.QueryNotRecognized", query),
                queryLocation));
      }
    }

    final ReportDataSchemaModel dataSchemaModel = reportRenderContext.getReportDataSchemaModel();
    if (dataSchemaModel.isValid())
    {
      final Throwable throwable = dataSchemaModel.getDataFactoryException();
      if (throwable != null)
      {
        final DataFactory dataFactory = reportRenderContext.getMasterReportElement().getDataFactory();
        LocationInfo queryLocation;
        if (dataFactory instanceof CompoundDataFactory)
        {
          final CompoundDataFactory cdf = (CompoundDataFactory) dataFactory;
          final DataFactory element = cdf.getDataFactoryForQuery(query);
          if (element == null)
          {
            queryLocation = new LocationInfo(dataFactory);
          }
          else
          {
            queryLocation = new LocationInfo(element);
          }
        }
        else
        {
          queryLocation = new LocationInfo(dataFactory);
        }
        resultHandler.notifyInspectionResult
            (new InspectionResult(this, InspectionResult.Severity.ERROR,
                Messages.getString("InvalidQueryNameReferenceInspection.QueryDidNotExecute", query, throwable.toString()),
                queryLocation));
      }
    }
  }
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 (isValidField(mapping.getName(), columnNames) == false)
        {
          resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
              Messages.getString("InvalidFieldReferenceInspection.SubReportInvalidField",
                  report.getName(), mapping.getName()),
              new LocationInfo(report)));

        }
View Full Code Here

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

          {
            final AttributeMetaData attrMetaData =
                element.getMetaData().getAttributeDescription(attributeNamespace, attributeName);
            if (attrMetaData == null)
            {
              resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                  Messages.getString("InvalidFieldReferenceInspection.AttributeExpressionInvalidFieldNoMetaData",
                      element.getName(), attributeNamespace, attributeName, field, metaData.getDisplayName(Locale.getDefault())),
                  new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
            }
            else
            {
              resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
                  Messages.getString("InvalidFieldReferenceInspection.AttributeExpressionInvalidField",
                      element.getName(), attrMetaData.getDisplayName(Locale.getDefault()), field, metaData.getDisplayName(Locale.getDefault())),
                  new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
            }
          }
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.