Class CrawlDocumentRepository

java.lang.Object
ai.pipeline.connector.intake.repository.CrawlDocumentRepository
All Implemented Interfaces:
io.quarkus.hibernate.orm.panache.PanacheRepository<CrawlDocument>, io.quarkus.hibernate.orm.panache.PanacheRepositoryBase<CrawlDocument,Long>

@ApplicationScoped public class CrawlDocumentRepository extends Object implements io.quarkus.hibernate.orm.panache.PanacheRepository<CrawlDocument>
Repository for crawl document tracking operations.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for CDI.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Delete all tracked document entries for the given session.
    Find all tracked entries referencing the given repository document ID across sessions.
    findBySessionAndSource(String sessionId, String sourceId)
    Find a tracked document by session and source ID.
    Find all tracked documents for a given session.
    void
    trackDocument(String sessionId, String sourceId, String documentId)
    Track a document in a session.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.quarkus.hibernate.orm.panache.PanacheRepositoryBase

    count, count, count, count, delete, delete, delete, delete, deleteAll, deleteById, find, find, find, find, find, find, findAll, findAll, findById, findById, findByIdOptional, findByIdOptional, findByIds, flush, getEntityManager, getSession, isPersistent, list, list, list, list, list, list, listAll, listAll, persist, persist, persist, persist, persistAndFlush, stream, stream, stream, stream, stream, stream, streamAll, streamAll, update, update, update
  • Constructor Details

    • CrawlDocumentRepository

      public CrawlDocumentRepository()
      Default constructor for CDI.
  • Method Details

    • findBySessionAndSource

      public Optional<CrawlDocument> findBySessionAndSource(String sessionId, String sourceId)
      Find a tracked document by session and source ID.
      Parameters:
      sessionId - crawl session identifier
      sourceId - source-system document identifier
      Returns:
      an Optional containing the tracked document if present; otherwise empty
    • findBySessionId

      public List<CrawlDocument> findBySessionId(String sessionId)
      Find all tracked documents for a given session.
      Parameters:
      sessionId - crawl session identifier
      Returns:
      list of CrawlDocument entries for the session (possibly empty)
    • findByDocumentId

      public List<CrawlDocument> findByDocumentId(String documentId)
      Find all tracked entries referencing the given repository document ID across sessions.
      Parameters:
      documentId - repository-assigned document identifier
      Returns:
      list of tracking entries that reference the given documentId (possibly empty)
    • trackDocument

      public void trackDocument(String sessionId, String sourceId, String documentId)
      Track a document in a session.

      Persists a mapping from the connector's sourceId to the repository documentId within the given sessionId. Used later for orphan detection and reporting.

      If a document with the same session and source ID already exists, this method will update the existing record with the new document ID (handles re-uploads gracefully).

      Parameters:
      sessionId - crawl session identifier
      sourceId - source-system document identifier
      documentId - repository-assigned document identifier
    • deleteBySessionId

      public void deleteBySessionId(String sessionId)
      Delete all tracked document entries for the given session.
      Parameters:
      sessionId - crawl session identifier