Package su.onno.ui
Class DocumentQueryService
java.lang.Object
su.onno.ui.DocumentQueryService
Read-side queries for documents (list with optional date range; detail with
tabular sections), shared by the REST API and the DivKit emitters. Pure data
access — access control stays with the callers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaggregate(DocumentDescriptor desc, String metric, String field, String filter) A single aggregate value for a count/metric card —countof rows, orsum|avg|min|maxof one numeric column — restricted to live records and narrowed by an optional safefilterpredicate (seeWidgetFilter).aggregateBuckets(DocumentDescriptor desc, WidgetBuckets.Request request) Grouped aggregate buckets for a chart/stat widget — a server-sideGROUP BYreturning O(buckets) rows instead of the whole table (#199).longcount(DocumentDescriptor desc) longcount(DocumentDescriptor desc, String search, String from, String to, List<String> eq, List<String> in, List<String> like, List<String> prefix, List<String> ge, List<String> le, String widgetFilter) Total live rows matching the search (+ optional date range, declarative filters, widget filter).estimateCount(DocumentDescriptor desc, boolean filtered) A cheap live-row estimate for the scroll-height hint, ornullwhen none is available (H2, or any active search/date-range/filter).The document descriptor for a domain class, ornullif it isn't a registered document.get(DocumentDescriptor desc, UUID id) groups(DocumentDescriptor desc, String groupColumn, String granularity, String search, String from, String to, List<String> eq, List<String> in, List<String> like, List<String> prefix, List<String> ge, List<String> le, String widgetFilter, List<ListGroups.Agg> aggregates) Group a document list bygroupColumn(a validated sortable column): one header per distinct value, or — for a date/time column (e.g.keysetPage(DocumentDescriptor desc, String cursorToken, int limit, String sortColumn, boolean descending, String search, String from, String to, List<String> eq, List<String> in, List<String> like, List<String> prefix, List<String> ge, List<String> le, String widgetFilter) One keyset-paginated window of a document list — the constant-time default for the list grid.newDraft(DocumentDescriptor desc) The seed row for a new document form: a fresh instance's field-initializer defaults in the same column-keyed, ref-resolved shapeget(su.onno.metadata.DocumentDescriptor, java.util.UUID)returns for an existing record, so the New form pre-fills declared defaults instead of opening blank (issue #181).newDraft(DocumentDescriptor desc, Map<String, String> prefill) AsnewDraft(DocumentDescriptor), but overlays caller-supplied initial values (from the New-form navigation query, keyed by attribute field name) onto the seed row before ref/enum resolution — so a deep link like…/new?startsAt=…&room=<id>pre-fills those fields.rowsByIds(DocumentDescriptor desc, List<UUID> ids) Fetch specific live documents by id, decorated like keyset rows (refs resolved, secrets redacted) so the list island can refresh just the rows that changed instead of re-paging the whole window.search(DocumentDescriptor desc, String query, int limit) Capped, case-insensitive typeahead for the document ref picker.search(DocumentDescriptor desc, String query, int limit, String filter) Assearch(DocumentDescriptor, String, int), additionally narrowed by aWidgetFilterpredicate — the cascading ref picker sends its resolvedrefFilterhere, so only compatible documents are offered.Columns that may be sorted on: the system columns + every attribute column.
-
Constructor Details
-
DocumentQueryService
-
-
Method Details
-
require
-
forClass
The document descriptor for a domain class, ornullif it isn't a registered document. -
search
Capped, case-insensitive typeahead for the document ref picker. Matches across the same text columns the paged list search covers — number plus every (non-secret) String attribute — so a document is findable by a secondary attribute, not just its number (issue #184). Live records only, newest first. -
search
public List<Map<String,Object>> search(DocumentDescriptor desc, String query, int limit, String filter) Assearch(DocumentDescriptor, String, int), additionally narrowed by aWidgetFilterpredicate — the cascading ref picker sends its resolvedrefFilterhere, so only compatible documents are offered. Ref/enum columns bind as typed uuids (PG-strict); a null/blank/invalid predicate is simply no filter. -
newDraft
The seed row for a new document form: a fresh instance's field-initializer defaults in the same column-keyed, ref-resolved shapeget(su.onno.metadata.DocumentDescriptor, java.util.UUID)returns for an existing record, so the New form pre-fills declared defaults instead of opening blank (issue #181). -
newDraft
AsnewDraft(DocumentDescriptor), but overlays caller-supplied initial values (from the New-form navigation query, keyed by attribute field name) onto the seed row before ref/enum resolution — so a deep link like…/new?startsAt=…&room=<id>pre-fills those fields. -
count
-
keysetPage
public KeysetPage keysetPage(DocumentDescriptor desc, String cursorToken, int limit, String sortColumn, boolean descending, String search, String from, String to, List<String> eq, List<String> in, List<String> like, List<String> prefix, List<String> ge, List<String> le, String widgetFilter) One keyset-paginated window of a document list — the constant-time default for the list grid. Seeks pastcursorToken(null/blank for the first window) instead of counting past an offset, so deep paging stays O(window). Honors sort/search/date-range/filters, fetches one extra row forhasMore(no COUNT), and mints the next cursor from the last row. The default newest-first order seeks on(_date, _id). -
estimateCount
A cheap live-row estimate for the scroll-height hint, ornullwhen none is available (H2, or any active search/date-range/filter). Uses PostgreSQL planner statistics (pg_class.reltuples) so it never scans the table; callers wanting an exact figure usecount(su.onno.metadata.DocumentDescriptor)instead. -
rowsByIds
Fetch specific live documents by id, decorated like keyset rows (refs resolved, secrets redacted) so the list island can refresh just the rows that changed instead of re-paging the whole window. Returns only the rows that still exist and aren't deletion-marked. -
count
public long count(DocumentDescriptor desc, String search, String from, String to, List<String> eq, List<String> in, List<String> like, List<String> prefix, List<String> ge, List<String> le, String widgetFilter) Total live rows matching the search (+ optional date range, declarative filters, widget filter). -
groups
public ListGroups.GroupResult groups(DocumentDescriptor desc, String groupColumn, String granularity, String search, String from, String to, List<String> eq, List<String> in, List<String> like, List<String> prefix, List<String> ge, List<String> le, String widgetFilter, List<ListGroups.Agg> aggregates) Group a document list bygroupColumn(a validated sortable column): one header per distinct value, or — for a date/time column (e.g._date) — pergranularitybucket, over the same WHERE (search + date range + declarative + widget filters) as the flat list. Each header carries its row count, the requestedaggregates, and theexpandfilter the client replays on the normal feed. Headers capped atListGroups.MAX_GROUPS. -
sortableColumns
Columns that may be sorted on: the system columns + every attribute column. -
aggregate
A single aggregate value for a count/metric card —countof rows, orsum|avg|min|maxof one numeric column — restricted to live records and narrowed by an optional safefilterpredicate (seeWidgetFilter). -
aggregateBuckets
Grouped aggregate buckets for a chart/stat widget — a server-sideGROUP BYreturning O(buckets) rows instead of the whole table (#199). SeeWidgetBuckets. -
get
-