@Override public boolean hasAnnotatedRows(final String value) { if (_annotations == null) { return false; } final RowAnnotationFactory annotationFactory = _annotationFactoryRef.get(); if (annotationFactory == null) { return false; } if (value == null) { if (_nullValueAnnotation != null) { return annotationFactory.hasSampleRows(_nullValueAnnotation); } else { return false; } } final RowAnnotation annotation = _annotations.get(value); if (annotation == null) { return false; } return annotationFactory.hasSampleRows(annotation); }
public AnnotatedRowsResult getCategoryRowSample(final String category) { final RowAnnotationFactory rowAnnotationFactory = _annotationFactoryRef.get(); if (rowAnnotationFactory == null) { return null; } final RowAnnotation annotation = _categories.get(category); if (annotation == null) { return null; } if (!rowAnnotationFactory.hasSampleRows(annotation)) { return null; } return new AnnotatedRowsResult(annotation, rowAnnotationFactory); }
/** * Factory method for {@link AnnotatedRowsResult} that will return non-null * ONLY if the {@link RowAnnotation} passed in has any sample rows according * to the {@link RowAnnotationFactory}. * * Otherwise returning null has the benefit that usually it makes it easy to * filter out unnecesary drill-to-detail result objects. * * @param annotation * @param annotationFactory * @param column * @return */ public static AnnotatedRowsResult createIfSampleRowsAvailable(final RowAnnotation annotation, final RowAnnotationFactory annotationFactory, final InputColumn<?>... columns) { if (annotationFactory.hasSampleRows(annotation)) { return new AnnotatedRowsResult(annotation, annotationFactory, columns); } return null; }