Class MentionResolver

java.lang.Object
su.onno.ui.comments.MentionResolver

public class MentionResolver extends Object
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.

  • Constructor Details

  • Method Details

    • canRead

      public boolean canRead(Principal viewer, MentionRef ref)
      True when viewer may read the entity a mention points at (deny-by-default, ADMIN bypasses).
    • resolve

      Resolve every distinct mention in refs for viewer. Order follows refs; unreadable or unknown mentions are returned with readable=false and no display.