@Override public void verify(Component component, JRVerifier verifier) { XYChartComponent chart = (XYChartComponent) component; verifyEvaluation(verifier, chart); XYDataset dataset = chart.getDataset(); if (dataset == null) { verifier.addBrokenRule("No dataset for axis chart", chart); } else { verify(verifier, dataset); } }
protected void verifyEvaluation(JRVerifier verifier, XYChartComponent chart) { EvaluationTimeEnum evaluationTime = chart.getEvaluationTime(); if (evaluationTime == EvaluationTimeEnum.AUTO) { verifier.addBrokenRule("Axis chart evaluation time cannot be Auto", chart); } else if (evaluationTime == EvaluationTimeEnum.GROUP) { String groupName = chart.getEvaluationGroup(); if (groupName == null) { verifier.addBrokenRule("Evaluation group not set for axis chart", chart); } else { JasperDesign report = verifier.getReportDesign(); if (!report.getGroupsMap().containsKey(groupName)) { verifier.addBrokenRule("Axis chart evaluation group " + groupName + " not found in report", chart); } } } }
public void verify(Component component, JRVerifier verifier) { PieChartComponent chart = (PieChartComponent) component; verifyEvaluation(verifier, chart); verifyTitleExpression(verifier, chart); PieDataset dataset = chart.getDataset(); if (dataset == null) { verifier.addBrokenRule("No dataset for pie chart", chart); } else { verify(verifier, dataset); } }
protected void verifyEvaluation(JRVerifier verifier, PieChartComponent chart) { EvaluationTimeEnum evaluationTime = chart.getEvaluationTime(); if (evaluationTime == EvaluationTimeEnum.AUTO) { verifier.addBrokenRule("Pie chart evaluation time cannot be Auto", chart); } else if (evaluationTime == EvaluationTimeEnum.GROUP) { String groupName = chart.getEvaluationGroup(); if (groupName == null) { verifier.addBrokenRule("Evaluation group not set for pie chart", chart); } else { JasperDesign report = verifier.getReportDesign(); if (!report.getGroupsMap().containsKey(groupName)) { verifier.addBrokenRule("Pie chart evaluation group " + groupName + " not found in report", chart); } } } }
protected void verify(JRVerifier verifier, PieDataset dataset) { verifier.verifyElementDataset(dataset); JRExpression keyExpression = dataset.getKeyExpression(); if (keyExpression == null) { verifier.addBrokenRule("No key expression for pie chart dataset", dataset); } JRExpression valueExpression = dataset.getValueExpression(); if (valueExpression == null) { verifier.addBrokenRule("No value expression for key chart dataset", dataset); } }
protected void verifyEvaluation(JRVerifier verifier, SpiderChartComponent chart) { EvaluationTimeEnum evaluationTime = chart.getEvaluationTime(); if (evaluationTime == EvaluationTimeEnum.AUTO) { verifier.addBrokenRule("Spider chart evaluation time cannot be Auto", chart); } else if (evaluationTime == EvaluationTimeEnum.GROUP) { String groupName = chart.getEvaluationGroup(); if (groupName == null) { verifier.addBrokenRule("Evaluation group not set for spider chart", chart); } else { JasperDesign report = verifier.getReportDesign(); if (!report.getGroupsMap().containsKey(groupName)) { verifier.addBrokenRule("Spider chart evaluation group " + groupName + " not found in report", chart); } } } }
protected void verifyBaseColumn(TableComponent table, BaseColumn column, JRVerifier verifier) { Integer width = column.getWidth(); if (width == null) { verifier.addBrokenRule("Column width not set", column); } else if (width < 0) { verifier.addBrokenRule("Negative column width", column); } else { verifyCell(column.getTableHeader(), width, "table header", verifier); verifyCell(column.getTableFooter(), width, "table footer", verifier); verifyGroupCells(table, column.getGroupHeaders(), width, "group header", verifier); verifyGroupCells(table, column.getGroupFooters(), width, "group footer", verifier); verifyCell(column.getColumnHeader(), width, "column header", verifier); verifyCell(column.getColumnFooter(), width, "column footer", verifier); } }
public static void verifyItemData(JRVerifier verifier, ItemData itemData, String itemName, String[] requiredNames, Map<String, String> alternativeNamesMap) { if (itemData.getDataset() != null) { verifier.verifyElementDataset(itemData.getDataset()); } List<Item> items = itemData.getItems(); if (items != null) { for (Item item : items) { verifyItem(verifier, item, itemName, requiredNames, alternativeNamesMap); } } }
/** * Verifies if required properties or their alternatives are present in the item properties list. Alternative * property names are read from the <code>alternativeNamesMap</code> parameter. * <br/> * For instance, a required latitude property can be provided either directly, using the <code>latitude</code> item * property, or by processing the alternative <code>address</code> property. If at least one of the <code>latitude</code> * or <code>address</code> properties are present in the item properties list, the latitude requirement is fulfilled. * * @param verifier * @param item * @param itemName * @param requiredNames * @param alternativeNamesMap */ public static void verifyItem(JRVerifier verifier, Item item, String itemName, String[] requiredNames, Map<String, String> alternativeNamesMap) { if(requiredNames != null && requiredNames.length > 0){ List<ItemProperty> itemProperties = item.getProperties(); if (itemProperties != null && !itemProperties.isEmpty()) { for (String reqName :requiredNames) { boolean hasProperty = false; for(ItemProperty itemProperty : itemProperties) { if (itemProperty.getName().equals(reqName) || (alternativeNamesMap != null && itemProperty.getName().equals(alternativeNamesMap.get(reqName)))) { hasProperty = true; break; } } if(!hasProperty) { verifier.addBrokenRule("No '" + reqName + "' property set for the " + itemName + " item.", itemProperties); } } } } }
@Override public void verify(Component component, JRVerifier verifier) { GeoMapComponent geoMap = (GeoMapComponent) component; EvaluationTimeEnum evaluationTime = geoMap.getEvaluationTime(); if (evaluationTime == EvaluationTimeEnum.AUTO) { verifier.addBrokenRule("Auto evaluation time is not supported for geo maps", geoMap); } else if (evaluationTime == EvaluationTimeEnum.GROUP) { String evaluationGroup = geoMap.getEvaluationGroup(); if (evaluationGroup == null || evaluationGroup.length() == 0) { verifier.addBrokenRule("No evaluation group set for geo map", geoMap); } else if (!verifier.getReportDesign().getGroupsMap().containsKey(evaluationGroup)) { verifier.addBrokenRule("Map evalution group \"" + evaluationGroup + " not found", geoMap); } } GeoMapDataset dataset = geoMap.getDataset(); if (dataset == null) { verifier.addBrokenRule("No dataset for geo map", geoMap); } else { verifier.verifyElementDataset(dataset); } }
protected void verify(JRVerifier verifier, XYDataset dataset) { verifier.verifyElementDataset(dataset); XYSeries[] xySeries = dataset.getSeries(); if(xySeries != null && xySeries.length > 0) { for(XYSeries series : xySeries) { JRExpression seriesExpression = series.getSeriesExpression(); if(seriesExpression == null) { verifier.addBrokenRule("No series expression for XY series", dataset); } JRExpression xValueExpression = series.getXValueExpression(); if(xValueExpression == null) { verifier.addBrokenRule("No X value expression for XY series", dataset); } JRExpression yValueExpression = series.getYValueExpression(); if(yValueExpression == null) { verifier.addBrokenRule("No Y value expression for XY series", dataset); } } } }
protected void verifyTitleExpression(JRVerifier verifier, PieChartComponent chart) { JRExpression titleExpression = chart.getTitleExpression(); if (titleExpression == null) { verifier.addBrokenRule("No title expression for pie chart", chart); } }
@Override public void verify(Component component, JRVerifier verifier) { BarcodeComponent barcode = (BarcodeComponent) component; BarcodeVerifier barcodeVerifier = new BarcodeVerifier(verifier); barcode.receive(barcodeVerifier); }
@Override public void verify(Component component, JRVerifier verifier) { SpiderChartComponent chartComponent = (SpiderChartComponent) component; verifyEvaluation(verifier, chartComponent); ChartSettings chartSettings = chartComponent.getChartSettings(); if (chartSettings == null) { verifier.addBrokenRule("No chart settings for spider chart", chartComponent); } SpiderDataset dataset = (SpiderDataset)chartComponent.getDataset(); if (dataset == null) { verifier.addBrokenRule("No dataset for spider chart", chartComponent); } else { verify(verifier, dataset); } SpiderPlot spiderPlot = (SpiderPlot)chartComponent.getPlot(); if (dataset == null) { verifier.addBrokenRule("No plot set for spider chart", chartComponent); } else { verify(verifier, spiderPlot); } }
protected void verify(JRVerifier verifier, SpiderDataset dataset) { verifier.verifyElementDataset(dataset); JRCategorySeries[] series = dataset.getSeries(); if (series != null) { for (int i = 0; i < series.length; i++) { verifier.verifyHyperlink(series[i].getItemHyperlink()); } } }
@Override public void verify(Component component, JRVerifier verifier) { BarbecueComponent barcode = (BarbecueComponent) component; String type = barcode.getType(); if (type == null) { verifier.addBrokenRule("No barcode type set", barcode); } JRExpression codeExpression = barcode.getCodeExpression(); if (codeExpression == null) { verifier.addBrokenRule("Barcode expression is null", barcode); } EvaluationTimeEnum evaluationTime = barcode.getEvaluationTimeValue(); if (evaluationTime == EvaluationTimeEnum.AUTO) { verifier.addBrokenRule("Auto evaluation time is not supported for barcodes", barcode); } else if (evaluationTime == EvaluationTimeEnum.GROUP) { String evaluationGroup = barcode.getEvaluationGroup(); if (evaluationGroup == null || evaluationGroup.length() == 0) { verifier.addBrokenRule("No evaluation group set for barcode", barcode); } else if (!verifier.getReportDesign().getGroupsMap().containsKey(evaluationGroup)) { verifier.addBrokenRule("Barcode evaluation group \"" + evaluationGroup + " not found", barcode); } } }
@Override public void verify(Component component, JRVerifier verifier) { TableComponent table = (TableComponent) component; JRDatasetRun datasetRun = table.getDatasetRun(); if (datasetRun == null) { verifier.addBrokenRule("No list subdataset run set", table); } else { verifier.verifyDatasetRun(datasetRun); } List<BaseColumn> columns = table.getColumns(); if (columns == null || columns.isEmpty()) { verifier.addBrokenRule("No columns defined in the table", table); } else { if (!detectLoops(verifier, columns)) { verifyColumns(table, verifier); verifyColumnHeights(table, verifier); } } }
protected void verifyGroupCells(TableComponent table, List<GroupCell> cells, int width, String cellName, JRVerifier verifier) { if (cells != null) { Set<String> groupNames = new HashSet<String>(); for (GroupCell groupCell : cells) { String groupName = groupCell.getGroupName(); if (groupName == null) { verifier.addBrokenRule("No group name set for table column group cell", groupCell); } else { if (!groupNames.add(groupName)) { verifier.addBrokenRule("Duplicate " + cellName + " for group \"" + groupName + "\"", groupCell); } JRDatasetRun datasetRun = table.getDatasetRun(); if (datasetRun != null) { JRDesignDataset dataset = (JRDesignDataset) verifier.getReportDesign().getDatasetMap().get( datasetRun.getDatasetName()); if (dataset != null && dataset.getGroupsMap().get(groupName) == null) { verifier.addBrokenRule("No group named \"" + groupName + "\" found in subdataset " + datasetRun.getDatasetName(), groupCell); } } } verifyCell(groupCell.getCell(), width, cellName, verifier); } } }
protected void verifyColumn(TableComponent table, Column column, JRVerifier verifier) { verifyBaseColumn(table, column, verifier); if (column.getWidth() != null) { Cell detailCell = column.getDetailCell(); verifyCell(detailCell, column.getWidth(), "detail", verifier); } }
@Override public void verify(Component component, JRVerifier verifier) { WmsMapComponent map = (WmsMapComponent) component; EvaluationTimeEnum evaluationTime = map.getEvaluationTime(); if (evaluationTime == EvaluationTimeEnum.AUTO) { verifier.addBrokenRule( "Auto evaluation time is not supported for WMS maps", map); } else if (evaluationTime == EvaluationTimeEnum.GROUP) { String evaluationGroup = map.getEvaluationGroup(); if (evaluationGroup == null || evaluationGroup.length() == 0) { verifier.addBrokenRule("No evaluation group set for map", map); } else if (!verifier.getReportDesign().getGroupsMap() .containsKey(evaluationGroup)) { verifier.addBrokenRule("Map evalution group \"" + evaluationGroup + " not found", map); } } String wmsServiceUrl = map.getWmsServiceUrl(); if (wmsServiceUrl == null || wmsServiceUrl.trim().isEmpty()) { verifier.addBrokenRule("WMS Service URL not set for map", map); } String srs = map.getSrs(); if (srs == null || srs.trim().isEmpty()) { verifier.addBrokenRule("SRS/CRS not set for map", map); } verifyExpression(verifier, map, map.getBBoxExpression(), "BBox"); verifyExpression(verifier, map, map.getLayersExpression(), "Layers"); }
private void verifyExpression(JRVerifier verifier, WmsMapComponent map, JRExpression jrExpression, String expressionName) { if (jrExpression == null || jrExpression.getText() == null || jrExpression.getText().trim().isEmpty()) { verifier.addBrokenRule(expressionName + " expression is empty", map); } }
@Override public void verify(Component component, JRVerifier verifier) { // TODO }
public void verify(Component component, JRVerifier verifier) { //TODO }
@Override public void validate(JRVerifier verifier) { verifier.verify(this); }