Class DiagnosisKeyService
- java.lang.Object
-
- app.coronawarn.server.common.persistence.service.DiagnosisKeyService
-
@Component public class DiagnosisKeyService extends Object
-
-
Constructor Summary
Constructors Constructor Description DiagnosisKeyService(DiagnosisKeyRepository keyRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyRetentionPolicy(int daysToRetain)
Deletes all diagnosis key entries which have a submission timestamp that is older than the specified number of days.List<DiagnosisKey>
getDiagnosisKeys()
Returns all valid persisted diagnosis keys, sorted by their submission timestamp.void
saveDiagnosisKeys(Collection<DiagnosisKey> diagnosisKeys)
Persists the specified collection ofDiagnosisKey
instances.
-
-
-
Constructor Detail
-
DiagnosisKeyService
public DiagnosisKeyService(DiagnosisKeyRepository keyRepository)
-
-
Method Detail
-
saveDiagnosisKeys
@Transactional public void saveDiagnosisKeys(Collection<DiagnosisKey> diagnosisKeys)
Persists the specified collection ofDiagnosisKey
instances. If the key data of a particular diagnosis key already exists in the database, this diagnosis key is not persisted.- Parameters:
diagnosisKeys
- must not contain null.- Throws:
IllegalArgumentException
- in case the given collection contains null.
-
getDiagnosisKeys
public List<DiagnosisKey> getDiagnosisKeys()
Returns all valid persisted diagnosis keys, sorted by their submission timestamp.
-
applyRetentionPolicy
@Transactional public void applyRetentionPolicy(int daysToRetain)
Deletes all diagnosis key entries which have a submission timestamp that is older than the specified number of days.- Parameters:
daysToRetain
- the number of days until which diagnosis keys will be retained.- Throws:
IllegalArgumentException
- ifdaysToRetain
is negative.
-
-