Class CommentService

java.lang.Object
com.onec.ui.comments.CommentService

public class CommentService extends Object
Persistence for onec_comments: the framework-owned thread store behind the /api/comments endpoint. It is infrastructure (like onec_schema_history), not a modelled catalog — so it is created with a plain CREATE TABLE IF NOT EXISTS at startup rather than through the metadata diff engine, and never appears in the navigation or REST model.

A thread is keyed by (entity_type, entity_name, entity_id). Deletes are soft (the row stays for audit with _deleted = true); reads filter them out.

  • Constructor Details

    • CommentService

      public CommentService(org.jdbi.v3.core.Jdbi jdbi)
  • Method Details

    • list

      public List<Comment> list(String entityType, String entityName, UUID entityId)
      The live thread for one entity, oldest comment first.
    • add

      public Comment add(String entityType, String entityName, UUID entityId, String authorId, String authorName, String body)
      Append a comment and return it as stored.
    • find

      public Optional<Comment> find(UUID id)
      A single comment by id (including soft-deleted ones), for authorization checks.
    • softDelete

      public boolean softDelete(UUID id)
      Soft-delete a comment; returns false when it doesn't exist or was already deleted.