Class CrawlingInfoService

java.lang.Object
org.codelibs.fess.app.service.CrawlingInfoService

public class CrawlingInfoService extends Object
Service class that manages crawling information and parameters. This service provides CRUD operations for crawling sessions and their associated parameters, including session management, cleanup operations, and CSV import/export functionality.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.codelibs.fess.opensearch.config.exbhv.CrawlingInfoBhv
    Behavior handler for CrawlingInfo entities.
    protected org.codelibs.fess.opensearch.config.exbhv.CrawlingInfoParamBhv
    Behavior handler for CrawlingInfoParam entities.
    protected org.codelibs.fess.mylasta.direction.FessConfig
    Fess configuration object containing application settings.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of CrawlingInfoService.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
    Deletes a crawling information record and all its associated parameters.
    void
    deleteBefore(long date)
    Deletes all crawling information records and their parameters that expired before the specified date.
    void
    deleteOldSessions(Set<String> activeSessionId)
    Deletes all crawling sessions and their parameters except for the specified active sessions.
    void
    deleteSessionIdsBefore(String activeSessionId, String name, long date)
    Deletes crawling sessions that expired before the specified date.
    void
    exportCsv(Writer writer)
    Exports all crawling information parameters to CSV format.
    org.dbflute.optional.OptionalEntity<org.codelibs.fess.opensearch.config.exentity.CrawlingInfo>
    Retrieves a single crawling information record by its unique identifier.
    List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfo>
    Retrieves a paginated list of crawling information records based on the provided pager criteria.
    List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfoParam>
    Retrieves all parameters associated with a specific crawling information record.
    org.codelibs.fess.opensearch.config.exentity.CrawlingInfo
    getLast(String sessionId)
    Retrieves the most recent crawling information record for a given session ID.
    List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfoParam>
    Retrieves the parameters from the most recent crawling session for a given session ID.
    void
    importCsv(Reader reader)
    Imports crawling information and parameters from a CSV file.
    protected void
    setupDeleteCondition(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
    Sets up the conditions for deleting a crawling information record.
    protected void
    setupListCondition(org.codelibs.fess.opensearch.config.cbean.CrawlingInfoCB cb, CrawlingInfoPager crawlingInfoPager)
    Sets up the database query conditions for listing crawling information records.
    protected void
    setupStoreCondition(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
    Sets up the conditions for storing a crawling information record.
    void
    store(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
    Stores (inserts or updates) a crawling information record.
    void
    storeInfo(List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfoParam> crawlingInfoParamList)
    Stores a list of crawling information parameters in batch.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • crawlingInfoParamBhv

      protected org.codelibs.fess.opensearch.config.exbhv.CrawlingInfoParamBhv crawlingInfoParamBhv
      Behavior handler for CrawlingInfoParam entities. Used to perform database operations on crawling session parameters.
    • crawlingInfoBhv

      protected org.codelibs.fess.opensearch.config.exbhv.CrawlingInfoBhv crawlingInfoBhv
      Behavior handler for CrawlingInfo entities. Used to perform database operations on crawling session information.
    • fessConfig

      protected org.codelibs.fess.mylasta.direction.FessConfig fessConfig
      Fess configuration object containing application settings. Used to access configuration values for pagination, limits, and other settings.
  • Constructor Details

    • CrawlingInfoService

      public CrawlingInfoService()
      Creates a new instance of CrawlingInfoService.
  • Method Details

    • getCrawlingInfoList

      public List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfo> getCrawlingInfoList(CrawlingInfoPager crawlingInfoPager)
      Retrieves a paginated list of crawling information records based on the provided pager criteria. The results are ordered by creation time in descending order and the pager is updated with pagination metadata including total count and page number list.
      Parameters:
      crawlingInfoPager - the pager object containing search criteria and pagination settings
      Returns:
      a list of CrawlingInfo entities matching the criteria
    • getCrawlingInfo

      public org.dbflute.optional.OptionalEntity<org.codelibs.fess.opensearch.config.exentity.CrawlingInfo> getCrawlingInfo(String id)
      Retrieves a single crawling information record by its unique identifier.
      Parameters:
      id - the unique identifier of the crawling information record
      Returns:
      an OptionalEntity containing the CrawlingInfo if found, empty otherwise
    • store

      public void store(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
      Stores (inserts or updates) a crawling information record. Sets up the store conditions including creation time if not already set, then performs an insert or update operation with immediate refresh.
      Parameters:
      crawlingInfo - the crawling information entity to store
      Throws:
      FessSystemException - if the crawling information is null
    • delete

      public void delete(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
      Deletes a crawling information record and all its associated parameters. First deletes all related CrawlingInfoParam records, then deletes the main record with immediate refresh to ensure consistency.
      Parameters:
      crawlingInfo - the crawling information entity to delete
    • setupListCondition

      protected void setupListCondition(org.codelibs.fess.opensearch.config.cbean.CrawlingInfoCB cb, CrawlingInfoPager crawlingInfoPager)
      Sets up the database query conditions for listing crawling information records. Applies filters based on the pager criteria such as ID and session ID, and orders results by creation time in descending order.
      Parameters:
      cb - the condition bean for building the database query
      crawlingInfoPager - the pager containing filter criteria
    • setupStoreCondition

      protected void setupStoreCondition(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
      Sets up the conditions for storing a crawling information record. Validates that the entity is not null and sets the creation time if not already present.
      Parameters:
      crawlingInfo - the crawling information entity to prepare for storage
      Throws:
      FessSystemException - if the crawling information is null
    • setupDeleteCondition

      protected void setupDeleteCondition(org.codelibs.fess.opensearch.config.exentity.CrawlingInfo crawlingInfo)
      Sets up the conditions for deleting a crawling information record. Ensures all associated CrawlingInfoParam records are deleted first to maintain referential integrity.
      Parameters:
      crawlingInfo - the crawling information entity to prepare for deletion
    • deleteSessionIdsBefore

      public void deleteSessionIdsBefore(String activeSessionId, String name, long date)
      Deletes crawling sessions that expired before the specified date. Excludes the active session and optionally filters by name. This method performs batch deletion of both parameters and session records.
      Parameters:
      activeSessionId - the session ID to exclude from deletion (can be null)
      name - optional name filter for sessions to delete (can be null or blank)
      date - the expiration time threshold - sessions expired before this time will be deleted
    • storeInfo

      public void storeInfo(List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfoParam> crawlingInfoParamList)
      Stores a list of crawling information parameters in batch. Sets the creation time for any parameters that don't have it set, then performs a batch insert operation with immediate refresh.
      Parameters:
      crawlingInfoParamList - the list of crawling information parameters to store
      Throws:
      FessSystemException - if the parameter list is null
    • getCrawlingInfoParamList

      public List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfoParam> getCrawlingInfoParamList(String id)
      Retrieves all parameters associated with a specific crawling information record. Results are ordered by creation time in ascending order and limited by configuration.
      Parameters:
      id - the unique identifier of the crawling information record
      Returns:
      a list of CrawlingInfoParam entities associated with the specified crawling info
    • getLastCrawlingInfoParamList

      public List<org.codelibs.fess.opensearch.config.exentity.CrawlingInfoParam> getLastCrawlingInfoParamList(String sessionId)
      Retrieves the parameters from the most recent crawling session for a given session ID. Returns an empty list if no crawling information is found for the session.
      Parameters:
      sessionId - the session identifier to find the latest crawling parameters for
      Returns:
      a list of CrawlingInfoParam entities from the latest session, or empty list if none found
    • deleteOldSessions

      public void deleteOldSessions(Set<String> activeSessionId)
      Deletes all crawling sessions and their parameters except for the specified active sessions. This is a cleanup operation that removes inactive session data while preserving active ones.
      Parameters:
      activeSessionId - a set of session IDs to preserve during the cleanup operation
    • importCsv

      public void importCsv(Reader reader)
      Imports crawling information and parameters from a CSV file. The CSV format expected is: SessionId, SessionCreatedTime, Key, Value, CreatedTime. Creates new crawling sessions if they don't exist and adds parameters to them.
      Parameters:
      reader - the Reader containing CSV data to import
    • exportCsv

      public void exportCsv(Writer writer)
      Exports all crawling information parameters to CSV format. The CSV output includes: SessionId, SessionCreatedTime, Key, Value, CreatedTime. Uses cursor-based selection to handle large datasets efficiently.
      Parameters:
      writer - the Writer to output CSV data to
    • deleteBefore

      public void deleteBefore(long date)
      Deletes all crawling information records and their parameters that expired before the specified date. This is a bulk cleanup operation for removing old session data.
      Parameters:
      date - the expiration time threshold - records expired before this time will be deleted
    • getLast

      public org.codelibs.fess.opensearch.config.exentity.CrawlingInfo getLast(String sessionId)
      Retrieves the most recent crawling information record for a given session ID. Orders by creation time in descending order and returns only the first result.
      Parameters:
      sessionId - the session identifier to find the latest crawling information for
      Returns:
      the most recent CrawlingInfo entity for the session, or null if none found