Package su.onno.ui.comments
Class MentionResolver
java.lang.Object
su.onno.ui.comments.MentionResolver
Resolves the entity mentions in a comment thread to
{display, avatarUrl, readable}, live
and per-viewer — the mention counterpart of RefResolver, batched the way
CommentAuthorAvatars batches author avatars. For each viewer:
- a mention to an entity the viewer can read resolves to its current display (catalog description/code, document number) and avatar, so renames track automatically;
- a mention to an entity the viewer can't read (per the same per-entity read gate as
everything else,
UiAccessService.canRead(java.security.Principal, su.onno.metadata.CatalogDescriptor)) resolves as not readable with no display leaked — the client degrades it to plain text rather than a clickable 403.
Resolution groups by (kind, name) so a thread mentioning ten customers costs one query,
not ten. A mention to a deleted record (or one whose entity no longer exists) stays readable at the
entity level but carries no display, so the client falls back to the token's snapshot label.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA mention resolved for one viewer: identity + (when readable) its live display and avatar. -
Constructor Summary
ConstructorsConstructorDescriptionMentionResolver(MetadataRegistry registry, UiAccessService access, org.jdbi.v3.core.Jdbi jdbi) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead(Principal viewer, MentionRef ref) True whenviewermay read the entity a mention points at (deny-by-default, ADMIN bypasses).resolve(Collection<MentionRef> refs, Principal viewer) Resolve every distinct mention inrefsforviewer.
-
Constructor Details
-
MentionResolver
public MentionResolver(MetadataRegistry registry, UiAccessService access, org.jdbi.v3.core.Jdbi jdbi)
-
-
Method Details
-
canRead
True whenviewermay read the entity a mention points at (deny-by-default, ADMIN bypasses). -
resolve
Resolve every distinct mention inrefsforviewer. Order followsrefs; unreadable or unknown mentions are returned withreadable=falseand no display.
-