public boolean validate() { if (element.getDimCount() > 2) { chartMessages.add( "The query has " + element.getDimColNames() + " dimensions. Minimum one and maximum two dimensions are supported."); return false; } if (element.getMetricCount() > 4) { chartMessages.add( "The query has " + element.getMetricColNames() + " metrics. At max only 4 metrics can be graphed."); return false; } if (this.element.getChartType().equalsIgnoreCase(DashboardConstants.PIE_CHART_TYPE)) if (element.getDimCount() != 1) { chartMessages.add( "The query has " + element.getDimColNames() + " dimension. Pie chart is supported with only one dimension."); return false; } else if (element.getMetricCount() != 1) { chartMessages.add( "The query has " + element.getMetricColNames() + " metrics. Pie chart is supported with only one metric."); return false; } return true; }