Interface AnnotationSetDao

All Superinterfaces:
BaseDao<AnnotationSet>
All Known Implementing Classes:
AnnotationSetDaoImpl

public interface AnnotationSetDao extends BaseDao<AnnotationSet>
DAO for AnnotationSet rows.

Addressed by id or by the (investigation, role, runId) idempotency triple. The polymorphic semantic of runId (agent run id / "draft-{curator}" / generated UUID per role) is enforced at the service layer; the DAO treats it as an opaque key.

  • Method Details

    • findByInvestigationAndRoleAndRunId

      @Nullable AnnotationSet findByInvestigationAndRoleAndRunId(Investigation investigation, AnnotationSetRole role, String runId)
      Find an existing row for the (investigation, role, runId) triple, or null. Used by the service to make POST /datasets/{id}/annotation-sets idempotent on retry.
    • findByInvestigation

      List<AnnotationSet> findByInvestigation(Investigation investigation, @Nullable AnnotationSetRole roleFilter)
      All sets attached to the given investigation, newest first.
      Parameters:
      investigation - target. Required.
      roleFilter - optional role filter; null = all roles.
    • findSummariesByInvestigation

      List<AnnotationSetSummaryValueObject> findSummariesByInvestigation(Investigation investigation, @Nullable AnnotationSetRole roleFilter)
      Thin metadata projection of sets attached to the given investigation, newest first. payloadJson is NOT loaded; the projection emits length(payloadJson) as payloadSize so the UI can decide whether to fetch the full row.
    • findLatestByInvestigation

      @Nullable AnnotationSet findLatestByInvestigation(Investigation investigation, @Nullable AnnotationSetRole roleFilter)
      The most recent set attached to the given investigation matching the role filter (or all roles if null), or null. "Most recent" by createdAt, falling back to id when createdAt ties.
    • countByInvestigation

      long countByInvestigation(Investigation investigation, @Nullable AnnotationSetRole roleFilter)
      Count rows attached to the given investigation matching the role filter (or all roles if null).
    • rebindInvestigation

      int rebindInvestigation(Investigation from, Investigation to)
      Rebind every row currently attached to from so it points at to. Returns the number of rows rebound. Used by the preboarded-promotion flow so the agent's historical proposals follow the EE after the preboarded row is replaced.
    • listSummaries

      List<AnnotationSetSummaryValueObject> listSummaries(@Nullable AnnotationSetRole roleFilter, @Nullable AnnotationSetSource sourceFilter, @Nullable String createdByFilter, @Nullable AgentCurationKind kindFilter, @Nullable String statusFilter, @Nullable List<Long> investigationIds, int offset, int limit, @Nullable AnnotationSetDao.SummarySort sort, boolean descending)
      Cross-experiment thin metadata projection: every AnnotationSet matching the supplied filter, sliced by offset / limit.
      Parameters:
      roleFilter - optional role filter; null = all roles.
      sourceFilter - optional source filter; null = all sources.
      createdByFilter - optional createdBy filter; null = no filter.
      investigationIds - optional restriction to a set of investigation ids; null or empty = no additional filter (ACL enforced upstream).
      sort - field to order by; null = AnnotationSetDao.SummarySort.CREATED_AT.
      descending - newest / highest first.
    • countSummaries

      long countSummaries(@Nullable AnnotationSetRole roleFilter, @Nullable AnnotationSetSource sourceFilter, @Nullable String createdByFilter, @Nullable AgentCurationKind kindFilter, @Nullable String statusFilter, @Nullable List<Long> investigationIds)
    • countSince

      long countSince(@Nullable Date since, @Nullable AnnotationSetRole roleFilter)
      Count rows with createdAt on or after since (or all rows if since is null). Optionally restricted by role.
    • countByRoleSince

      Map<AnnotationSetRole, Long> countByRoleSince(@Nullable Date since)
      Group rows by role, counting per bucket. Rows with createdAt >= since only when since is non-null.
    • countDistinctRunIdsSince

      long countDistinctRunIdsSince(@Nullable Date since, @Nullable AnnotationSetRole roleFilter)
      Number of distinct runIds seen on rows with createdAt >= since (or all-time if null). Approximates "how many agent runs have we ingested in the window" when filtered to role=PROPOSAL.
    • findLatestCreatedAt

      @Nullable Date findLatestCreatedAt(@Nullable AnnotationSetRole roleFilter)
      Returns:
      the most-recent createdAt across every row matching the role filter, or null if no rows.