Interface DiagnosisKeyRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<DiagnosisKey,Long>,org.springframework.data.repository.PagingAndSortingRepository<DiagnosisKey,Long>,org.springframework.data.repository.Repository<DiagnosisKey,Long>
@Repository public interface DiagnosisKeyRepository extends org.springframework.data.repository.PagingAndSortingRepository<DiagnosisKey,Long>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcountOlderThan(long submissionTimestamp)Counts all entries that have a submission timestamp older than the specified one.voiddeleteOlderThan(long submissionTimestamp)Deletes all entries that have a submission timestamp older than the specified one.booleansaveDoNothingOnConflict(byte[] keyData, int rollingStartIntervalNumber, int rollingPeriod, long submissionTimestamp, int transmissionRisk, String originCountry, String[] visitedCountries, String reportType, int daysSinceOnsetOfSymptoms, boolean consentToFederation)Attempts to write the specified diagnosis key information into the database.
-
-
-
Method Detail
-
countOlderThan
@Query("SELECT COUNT(*) FROM diagnosis_key WHERE submission_timestamp<:threshold") int countOlderThan(@Param("threshold") long submissionTimestamp)Counts all entries that have a submission timestamp older than the specified one.- Parameters:
submissionTimestamp- The submission timestamp up to which entries will be expired.- Returns:
- The number of expired keys.
-
deleteOlderThan
@Modifying @Query("DELETE FROM diagnosis_key WHERE submission_timestamp<:threshold") void deleteOlderThan(@Param("threshold") long submissionTimestamp)Deletes all entries that have a submission timestamp older than the specified one.- Parameters:
submissionTimestamp- The submission timestamp up to which entries will be deleted.
-
saveDoNothingOnConflict
@Modifying @Query("INSERT INTO diagnosis_key (key_data, rolling_start_interval_number, rolling_period, submission_timestamp, transmission_risk_level, origin_country, visited_countries, report_type, days_since_onset_of_symptoms, consent_to_federation) VALUES (:keyData, :rollingStartIntervalNumber, :rollingPeriod, :submissionTimestamp, :transmissionRisk, :origin_country, :visited_countries, :report_type, :days_since_onset_of_symptoms, :consent_to_federation) ON CONFLICT DO NOTHING") boolean saveDoNothingOnConflict(@Param("keyData") byte[] keyData, @Param("rollingStartIntervalNumber") int rollingStartIntervalNumber, @Param("rollingPeriod") int rollingPeriod, @Param("submissionTimestamp") long submissionTimestamp, @Param("transmissionRisk") int transmissionRisk, @Param("origin_country") String originCountry, @Param("visited_countries") String[] visitedCountries, @Param("report_type") String reportType, @Param("days_since_onset_of_symptoms") int daysSinceOnsetOfSymptoms, @Param("consent_to_federation") boolean consentToFederation)Attempts to write the specified diagnosis key information into the database. If a row with the specified key data already exists, no data is inserted.- Parameters:
keyData- The key data of the diagnosis key.rollingStartIntervalNumber- The rolling start interval number of the diagnosis key.rollingPeriod- The rolling period of the diagnosis key.submissionTimestamp- The submission timestamp of the diagnosis key.transmissionRisk- The transmission risk level of the diagnosis key.originCountry- The origin country from the app.visitedCountries- The list of countries this transmissions is relevant for.reportType- The report type of the diagnosis key.- Returns:
- true if the diagnosis key was inserted successfully, false otherwise.
-
-