Package su.onno.ui

Class WidgetBuckets

java.lang.Object
su.onno.ui.WidgetBuckets

public final class WidgetBuckets extends Object
Builds the grouped-aggregate SQL behind the chart/stat/sparkline/gauge widgets (#199): a GROUP BY groupBy[, seriesBy] computing one (or, for a dual-axis combo, two) aggregate values per bucket, so a chart ships O(buckets) rows instead of the whole table. Date bucketing maps to DATE_TRUNC (supported by both H2 and PostgreSQL).

Injection safety follows WidgetFilter/WidgetAggregate: every referenced column must be one of the entity's known columns (or the small system allowlist) and match a strict identifier pattern; values are always bound parameters. Unlike a filter typo (which degrades to "no filter"), an unknown group/series/date column is an error — silently grouping by nothing would draw a wrong chart, not an unfiltered one.

  • Field Details

    • CATALOG_SYSTEM_COLUMNS

      public static final Set<String> CATALOG_SYSTEM_COLUMNS
      System columns a widget may group/window on even though they aren't business attributes — per entity kind, because allowlisting a column the kind's table doesn't have (a catalog has no _date) would pass validation and then blow up in SQL.
    • DOCUMENT_SYSTEM_COLUMNS

      public static final Set<String> DOCUMENT_SYSTEM_COLUMNS
    • MAX_BUCKETS

      public static final int MAX_BUCKETS
      More x buckets than this is unreadable anyway; the query is capped and the rest dropped.
      See Also:
  • Method Details