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 forExports
. Supported byExportRepository
.- Author:
- Samarth Dhruva (samarthd)
-
-
Method Summary
All Methods Instance Methods Abstract Methods 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 givenExport.target
andExport.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)
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)
List<P>
readIncompleteLastUpdatedBefore(Instant cutoff)
Reads the exports which are incomplete (those with statusExportStatus.REQUESTED
orExportStatus.PROCESSING
) whoseExport.lastUpdated
is before the givencutoff
.List<P>
readIncompleteLastUpdatedBeforeAndTenantId(Instant cutoff, String tenantId)
Reads the exports which are incomplete (those with statusExportStatus.REQUESTED
orExportStatus.PROCESSING
) whoseExport.lastUpdated
is before the givencutoff
, 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 givenexport
, sets the export'sExport.errorMessage
to the given value, setsExport.status
toExportStatus.ERROR
, and renewsExport.lastUpdated
.boolean
setFileLocationAndFinishedStatus(String exportId, String fileLocation)
Atomically finds and updates the export with the givenexportId
: sets theExport.status
toExportStatus.FINISHED
, sets theExport.fileLocation
tofileLocation
, and renewsExport.lastUpdated
.boolean
setNumberOfRecordsProcessed(String exportId, long numberOfRecordsProcessed)
Atomically finds and updates the export with the givenexportId
: setsExport.numberOfRecordsProcessed
to the given value and renewsExport.lastUpdated
.P
setProcessingStatus(String exportId)
Atomically finds and updates the export with the givenexportId
, setting theExport.status
toExportStatus.PROCESSING
and renewingExport.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
-
-
-
-
Method Detail
-
setProcessingStatus
@Nullable P setProcessingStatus(String exportId)
Atomically finds and updates the export with the givenexportId
, setting theExport.status
toExportStatus.PROCESSING
and renewingExport.lastUpdated
.The update is applied only if the export is found to have a
Export.status
ofExportStatus.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 givenexport
, sets the export'sExport.errorMessage
to the given value, setsExport.status
toExportStatus.ERROR
, and renewsExport.lastUpdated
.The update is applied only if the export is found to have a
Export.status
ofExportStatus.REQUESTED
orExportStatus.PROCESSING
.- Parameters:
exportId
- the ID of the export to find and updateerrorMessage
- 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 givenexportId
: setsExport.numberOfRecordsProcessed
to the given value and renewsExport.lastUpdated
.The update is applied only if the export is found to have a
Export.status
ofExportStatus.PROCESSING
- Parameters:
exportId
- the ID of the export to find and updatenumberOfRecordsProcessed
- the new value to set forExport.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 givenexportId
: sets theExport.status
toExportStatus.FINISHED
, sets theExport.fileLocation
tofileLocation
, and renewsExport.lastUpdated
.The update is applied only if the export is found to have a
Export.status
ofExportStatus.PROCESSING
- Parameters:
exportId
- the ID of the export to modifyfileLocation
- 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 givenExport.target
andExport.applicationId
.- Parameters:
target
- theExport.target
to filter byapplicationId
- theExport.applicationId
to filter by. Note that if this isnull
, only exports with null application IDs will be returned.tenantId
- theExport.tenantId
to filter bypageable
- information about which page of results to return from the database- Returns:
- the exports with the given
Export.target
andExport.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)
- Parameters:
target
- the target to filter results byauthor
- the author to filter results byapplicationId
- theExport.applicationId
to filter by. Note that if this isnull
, only exports with null application IDs will be returned.tenantId
- theExport.tenantId
to filter byfilters
- additional filters to apply, must not be nullpageable
- 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 statusExportStatus.REQUESTED
orExportStatus.PROCESSING
) whoseExport.lastUpdated
is before the givencutoff
.- Parameters:
cutoff
- the results will be filtered to only include those exports whoseExport.lastUpdated
is before this value- Returns:
- the exports which are incomplete and have a
Export.lastUpdated
before the givencutoff
-
readIncompleteLastUpdatedBeforeAndTenantId
List<P> readIncompleteLastUpdatedBeforeAndTenantId(Instant cutoff, String tenantId)
Reads the exports which are incomplete (those with statusExportStatus.REQUESTED
orExportStatus.PROCESSING
) whoseExport.lastUpdated
is before the givencutoff
, within the specified tenant.- Parameters:
cutoff
- the results will be filtered to only include those exports whoseExport.lastUpdated
is before this valuetenantId
- the tenant id that this export operation was initiated from- Returns:
- the exports which are incomplete and have a
Export.lastUpdated
before the givencutoff
-
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)
- Parameters:
target
- the target to filter results byauthor
- the author to filter results byapplicationId
- theExport.applicationId
to filter by. Note that if this isnull
, only exports with null application IDs will be returned.tenantId
- theExport.tenantId
to filter byparentId
- theExport.parentId
to filter byfilters
- additional filters to apply, must not be nullpageable
- information about which page of results to return from the database- Returns:
- the exports matching the given criteria
-
-