Class FederationBatchInfoService
- java.lang.Object
-
- app.coronawarn.server.common.persistence.service.FederationBatchInfoService
-
@Component public class FederationBatchInfoService extends Object
-
-
Constructor Summary
Constructors Constructor Description FederationBatchInfoService(FederationBatchInfoRepository federationBatchInfoRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyRetentionPolicy(int daysToRetain)
Deletes all federation batch information entries which have a date that is older than the specified number of days.void
deleteForDate(LocalDate date)
Deletes all federation batch information entries which have a specific date.List<FederationBatchInfo>
findByStatus(FederationBatchStatus federationBatchStatus)
Returns all batch information entries with a given status.boolean
save(FederationBatchInfo federationBatchInfo)
Persists theFederationBatchInfo
instance.void
updateStatus(FederationBatchInfo federationBatchInfo, FederationBatchStatus status)
Sets the status of the provided federation batch.
-
-
-
Constructor Detail
-
FederationBatchInfoService
public FederationBatchInfoService(FederationBatchInfoRepository federationBatchInfoRepository)
-
-
Method Detail
-
save
@Transactional public boolean save(FederationBatchInfo federationBatchInfo)
Persists theFederationBatchInfo
instance. If the data of a particular federation batch already exists in the database, this federation batch is not persisted.- Parameters:
federationBatchInfo
- must not contain null.- Returns:
- boolean to determine whether the batch was already existing.
-
updateStatus
public void updateStatus(FederationBatchInfo federationBatchInfo, FederationBatchStatus status)
Sets the status of the provided federation batch.
-
findByStatus
public List<FederationBatchInfo> findByStatus(FederationBatchStatus federationBatchStatus)
Returns all batch information entries with a given status.- Parameters:
federationBatchStatus
- the status the batch information entries should have.- Returns:
- the list of batch information entries with the given status.
-
applyRetentionPolicy
@Transactional public void applyRetentionPolicy(int daysToRetain)
Deletes all federation batch information entries which have a date that is older than the specified number of days.- Parameters:
daysToRetain
- the number of days until which batch information will be retained.- Throws:
IllegalArgumentException
- ifdaysToRetain
is negative.
-
deleteForDate
@Transactional public void deleteForDate(LocalDate date)
Deletes all federation batch information entries which have a specific date.- Parameters:
date
- The date for which the batch information entries should be deleted.
-
-