Interface ExportService<P extends Export>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
All Known Implementing Classes:
DefaultExportService

public interface ExportService<P extends Export> extends com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService<P>
Service API for Exports. Supported by ExportRepository.
Author:
Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.data.domain.Page<P>
    readByTargetAndApplicationIdAndTenantId(String target, String applicationId, @NonNull String tenantId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
    Reads the exports with the given Export.target and Export.applicationId.
    org.springframework.data.domain.Page<P>
    readByTargetAndAuthorAndApplicationIdAndTenantId(String target, String author, String applicationId, @NonNull String tenantId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
    Reads the exports with the given Export.target, Export.author, and Export.applicationId.
    org.springframework.data.domain.Page<P>
    readByTargetAndAuthorAndApplicationIdAndTenantIdAndParentId(String target, String author, String applicationId, @NonNull String tenantId, @NonNull String parentId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
    Reads the exports with the given Export.target, Export.author, and Export.applicationId.
    Reads the exports which are incomplete (those with status ExportStatus.REQUESTED or ExportStatus.PROCESSING) whose Export.lastUpdated is before the given cutoff.
    Reads the exports which are incomplete (those with status ExportStatus.REQUESTED or ExportStatus.PROCESSING) whose Export.lastUpdated is before the given cutoff, within the specified tenant.
    boolean
    setError(String exportId, String errorMessage)
    Atomically finds and updates the given export: finds the export with the ID matching the given export, sets the export's Export.errorMessage to the given value, sets Export.status to ExportStatus.ERROR, and renews Export.lastUpdated.
    boolean
    Atomically finds and updates the export with the given exportId: sets the Export.status to ExportStatus.FINISHED, sets the Export.fileLocation to fileLocation, and renews Export.lastUpdated.
    boolean
    setNumberOfRecordsProcessed(String exportId, long numberOfRecordsProcessed)
    Atomically finds and updates the export with the given exportId: sets Export.numberOfRecordsProcessed to the given value and renews Export.lastUpdated.
    Atomically finds and updates the export with the given exportId, setting the Export.status to ExportStatus.PROCESSING and renewing Export.lastUpdated.

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlMappableCrudEntityService

    readAll, readAll, readAll, readAll
  • Method Details

    • setProcessingStatus

      @Nullable P setProcessingStatus(String exportId)
      Atomically finds and updates the export with the given exportId, setting the Export.status to ExportStatus.PROCESSING and renewing Export.lastUpdated.

      The update is applied only if the export is found to have a Export.status of ExportStatus.REQUESTED.

      Parameters:
      exportId - the ID of the export to find and update
      Returns:
      the updated Export if successfully found and updated, null otherwise
    • setError

      boolean setError(String exportId, String errorMessage)
      Atomically finds and updates the given export: finds the export with the ID matching the given export, sets the export's Export.errorMessage to the given value, sets Export.status to ExportStatus.ERROR, and renews Export.lastUpdated.

      The update is applied only if the export is found to have a Export.status of ExportStatus.REQUESTED or ExportStatus.PROCESSING.

      Parameters:
      exportId - the ID of the export to find and update
      errorMessage - the error message to set on the export
      Returns:
      true if the export update was successfully performed, false otherwise
    • setNumberOfRecordsProcessed

      boolean setNumberOfRecordsProcessed(String exportId, long numberOfRecordsProcessed)
      Atomically finds and updates the export with the given exportId: sets Export.numberOfRecordsProcessed to the given value and renews Export.lastUpdated.

      The update is applied only if the export is found to have a Export.status of ExportStatus.PROCESSING

      Parameters:
      exportId - the ID of the export to find and update
      numberOfRecordsProcessed - the new value to set for Export.numberOfRecordsProcessed
      Returns:
      true if the update was successfully performed, false otherwise
    • setFileLocationAndFinishedStatus

      boolean setFileLocationAndFinishedStatus(String exportId, String fileLocation)
      Atomically finds and updates the export with the given exportId: sets the Export.status to ExportStatus.FINISHED, sets the Export.fileLocation to fileLocation, and renews Export.lastUpdated.

      The update is applied only if the export is found to have a Export.status of ExportStatus.PROCESSING

      Parameters:
      exportId - the ID of the export to modify
      fileLocation - the file location to set on the export
      Returns:
      true if the update was successfully performed, false otherwise
    • readByTargetAndApplicationIdAndTenantId

      org.springframework.data.domain.Page<P> readByTargetAndApplicationIdAndTenantId(String target, @Nullable String applicationId, @NonNull @NonNull String tenantId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
      Reads the exports with the given Export.target and Export.applicationId.
      Parameters:
      target - the Export.target to filter by
      applicationId - the Export.applicationId to filter by. Note that if this is null, only exports with null application IDs will be returned.
      tenantId - the Export.tenantId to filter by
      pageable - information about which page of results to return from the database
      Returns:
      the exports with the given Export.target and Export.applicationId
    • readByTargetAndAuthorAndApplicationIdAndTenantId

      org.springframework.data.domain.Page<P> readByTargetAndAuthorAndApplicationIdAndTenantId(String target, String author, @Nullable String applicationId, @NonNull @NonNull String tenantId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
      Reads the exports with the given Export.target, Export.author, and Export.applicationId.
      Parameters:
      target - the target to filter results by
      author - the author to filter results by
      applicationId - the Export.applicationId to filter by. Note that if this is null, only exports with null application IDs will be returned.
      tenantId - the Export.tenantId to filter by
      filters - additional filters to apply, must not be null
      pageable - information about which page of results to return from the database
      Returns:
      the exports matching the given criteria
    • readIncompleteLastUpdatedBefore

      List<P> readIncompleteLastUpdatedBefore(Instant cutoff)
      Reads the exports which are incomplete (those with status ExportStatus.REQUESTED or ExportStatus.PROCESSING) whose Export.lastUpdated is before the given cutoff.
      Parameters:
      cutoff - the results will be filtered to only include those exports whose Export.lastUpdated is before this value
      Returns:
      the exports which are incomplete and have a Export.lastUpdated before the given cutoff
    • readIncompleteLastUpdatedBeforeAndTenantId

      List<P> readIncompleteLastUpdatedBeforeAndTenantId(Instant cutoff, String tenantId)
      Reads the exports which are incomplete (those with status ExportStatus.REQUESTED or ExportStatus.PROCESSING) whose Export.lastUpdated is before the given cutoff, within the specified tenant.
      Parameters:
      cutoff - the results will be filtered to only include those exports whose Export.lastUpdated is before this value
      tenantId - the tenant id that this export operation was initiated from
      Returns:
      the exports which are incomplete and have a Export.lastUpdated before the given cutoff
    • readByTargetAndAuthorAndApplicationIdAndTenantIdAndParentId

      org.springframework.data.domain.Page<P> readByTargetAndAuthorAndApplicationIdAndTenantIdAndParentId(String target, String author, @Nullable String applicationId, @NonNull @NonNull String tenantId, @NonNull @NonNull String parentId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable)
      Reads the exports with the given Export.target, Export.author, and Export.applicationId.
      Parameters:
      target - the target to filter results by
      author - the author to filter results by
      applicationId - the Export.applicationId to filter by. Note that if this is null, only exports with null application IDs will be returned.
      tenantId - the Export.tenantId to filter by
      parentId - the Export.parentId to filter by
      filters - additional filters to apply, must not be null
      pageable - information about which page of results to return from the database
      Returns:
      the exports matching the given criteria