Class AnnotationSetPayloadCounts

java.lang.Object
ubic.gemma.model.common.auditAndSecurity.curation.AnnotationSetPayloadCounts

public final class AnnotationSetPayloadCounts extends Object

How many factors and tags an annotation-set payload proposes.

What an inbox card prints. The cross-corpus list serves a thin projection with no payloadJson, so before these were stored, drawing that list cost one whole-set fetch per row — 94 KB on the set uib sampled, scaling with the corpus rather than with the screen.

⚠️ A hint, not a contract

AnnotationSet.getPayloadJson() belongs to its producer — the curation-agents client for an AGENT row, the curation UI for a CURATOR one — and Gemma persists it verbatim and serves it unread. Counting inside it is the one place that rule is bent, and it is bent as far as it has to go and no further: the counts are derived once when the row is written, they are advisory, and anything unrecognized yields null rather than a guess.

🛑 null means UNKNOWN, never zero. A payload that carries no factors reports 0; a payload this cannot read reports null. Collapsing the two would let a shape change downstream read as "this proposal changes nothing", which is the one wrong answer that looks plausible.

The shape read is the CurationDocument both sides already speak — Gemma's own snapshot writer emits it and CAB's curation_commit.py mirrors it. If a producer moves, this returns null and the card loses two numbers; nothing else breaks, and no stored payload is altered.

  • Method Details

    • unknown

      public static AnnotationSetPayloadCounts unknown()
      Both counts unknown — what an unparseable, absent or unrecognized payload yields.
    • of

      public static AnnotationSetPayloadCounts of(@Nullable String payloadJson)
      Read the counts off a payload, best-effort.
      Parameters:
      payloadJson - the stored payload, or null
      Returns:
      the counts; either or both null when that part of the shape was not found. Never throws — a payload Gemma cannot read is not an error, because Gemma never promised to be able to read it.
    • getFactorCount

      @Nullable public Integer getFactorCount()
    • getTagCount

      @Nullable public Integer getTagCount()