Performance Repository

@Repository
interface PerformanceRepository : JpaRepository<T, ID>

The PerformanceRepository interface is useful to manage the queries for the performance data operations

Author

N7ghtm4r3 - Tecknobit

See also

JpaRepository

Functions

Link copied to clipboard
@Query(value = ""SELECT * FROM " + PERFORMANCE_ANALYTICS_KEY + " WHERE " + APPLICATION_IDENTIFIER_KEY + "=:" + APPLICATION_IDENTIFIER_KEY + " AND " + PLATFORM_KEY + "=:" + PLATFORM_KEY + " AND " + PERFORMANCE_ANALYTIC_TYPE_KEY + "=:#{#" + PERFORMANCE_ANALYTIC_TYPE_KEY + ".name()}" + " AND " + CREATION_DATE_KEY + " BETWEEN :" + INITIAL_DATE_KEY + " AND :" + FINAL_DATE_KEY + " AND (" + "COALESCE(:" + VERSION_FILTERS_KEY + ") IS NULL OR " + APP_VERSION_KEY + " IN (:" + VERSION_FILTERS_KEY + ")" + ")" + " ORDER BY " + APP_VERSION_KEY", nativeQuery = true )
abstract fun collectPerformanceData(@Param(value = "application_id") applicationId: String, @Param(value = "platform") platform: String, @Param(value = "performance_analytic_type") type: PerformanceAnalytic.PerformanceAnalyticType, @Param(value = "initial_date") initialDate: Long, @Param(value = "final_date") finalDate: Long, @Param(value = "versions") versions: List<String>): List<PerformanceAnalytic>
Method to retrieve the collected performance data from the database
Link copied to clipboard
abstract fun <S : T?> count(example: Example<S>): Long
Link copied to clipboard
abstract fun delete(entity: T)
Link copied to clipboard
abstract fun deleteAll(entities: Iterable<out T>)
Link copied to clipboard
abstract fun deleteAllById(ids: Iterable<out ID>)
Link copied to clipboard
abstract fun deleteAllByIdInBatch(ids: Iterable<ID>)
Link copied to clipboard
abstract fun deleteAllInBatch(entities: Iterable<T>)
Link copied to clipboard
abstract fun deleteById(id: ID)
Link copied to clipboard
open fun deleteInBatch(entities: Iterable<T>)
Link copied to clipboard
abstract fun <S : T?> exists(example: Example<S>): Boolean
Link copied to clipboard
abstract fun existsById(id: ID): Boolean
Link copied to clipboard
abstract fun <S : T?> findAll(example: Example<S>): List<S>
abstract fun findAll(): Iterable<T>
abstract fun findAll(): List<T>
abstract fun findAll(pageable: Pageable): Page<T>
abstract fun <S : T?> findAll(example: Example<S>): Iterable<S>
abstract fun <S : T?> findAll(example: Example<S>, pageable: Pageable): Page<S>
Link copied to clipboard
abstract fun findAllById(ids: Iterable<ID>): Iterable<T>
abstract fun findAllById(ids: Iterable<ID>): List<T>
Link copied to clipboard
abstract fun <S : T?, R> findBy(example: Example<S>, queryFunction: (FluentQuery.FetchableFluentQuery<S>) -> R): R
Link copied to clipboard
abstract fun findById(id: ID): Optional<T>
Link copied to clipboard
abstract fun <S : T?> findOne(example: Example<S>): Optional<S>
Link copied to clipboard
abstract fun flush()
Link copied to clipboard
@Query(value = "SELECT DISTINCT " + APP_VERSION_KEY + " FROM " + PERFORMANCE_ANALYTICS_KEY + " WHERE " + APPLICATION_IDENTIFIER_KEY + "=:" + APPLICATION_IDENTIFIER_KEY + " AND " + PLATFORM_KEY + "=:" + PLATFORM_KEY + " AND " + PERFORMANCE_ANALYTIC_TYPE_KEY + "=:#{#" + PERFORMANCE_ANALYTIC_TYPE_KEY + ".name()}", nativeQuery = true )
abstract fun getAllVersionsTarget(@Param(value = "application_id") applicationId: String, @Param(value = "platform") platform: String, @Param(value = "performance_analytic_type") type: PerformanceAnalytic.PerformanceAnalyticType): List<String>
Method to get all the available versions target for a specific analytic
Link copied to clipboard
abstract fun getById(id: ID): T
Link copied to clipboard
@Query(value = ""SELECT DISTINCT " + APP_VERSION_KEY + " FROM " + PERFORMANCE_ANALYTICS_KEY + " WHERE " + APPLICATION_IDENTIFIER_KEY + "=:" + APPLICATION_IDENTIFIER_KEY + " AND " + PLATFORM_KEY + "=:" + PLATFORM_KEY + " AND " + PERFORMANCE_ANALYTIC_TYPE_KEY + "=:#{#" + PERFORMANCE_ANALYTIC_TYPE_KEY + ".name()}" + " LIMIT " + MAX_VERSION_SAMPLES", nativeQuery = true )
abstract fun getLimitedVersionsTarget(@Param(value = "application_id") applicationId: String, @Param(value = "platform") platform: String, @Param(value = "performance_analytic_type") type: PerformanceAnalytic.PerformanceAnalyticType): List<String>
Method to get all the available versions target for a specific analytic limited for the chart data presentation
Link copied to clipboard
abstract fun getOne(id: ID): T
Link copied to clipboard
@Query(value = ""SELECT * FROM " + PERFORMANCE_ANALYTICS_KEY + " WHERE " + APPLICATION_IDENTIFIER_KEY + "=:" + APPLICATION_IDENTIFIER_KEY + " AND " + APP_VERSION_KEY + "=:" + APP_VERSION_KEY + " AND " + PLATFORM_KEY + "=:#{#" + PLATFORM_KEY + ".name()}" + " AND " + PERFORMANCE_ANALYTIC_TYPE_KEY + "=:#{#" + PERFORMANCE_ANALYTIC_TYPE_KEY + ".name()}" + " AND " + CREATION_DATE_KEY + "=:" + CREATION_DATE_KEY", nativeQuery = true )
abstract fun getPerformanceAnalyticByDate(@Param(value = "application_id") applicationId: String, @Param(value = "app_version") appVersion: String, @Param(value = "platform") platform: Platform, @Param(value = "performance_analytic_type") type: PerformanceAnalytic.PerformanceAnalyticType, @Param(value = "creation_date") creationDate: Long): PerformanceAnalytic
Method to retrieve an analytic by date
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
Link copied to clipboard
abstract fun <S : T?> save(entity: S): S
Link copied to clipboard
abstract fun <S : T?> saveAll(entities: Iterable<S>): Iterable<S>
abstract fun <S : T?> saveAll(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAllAndFlush(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAndFlush(entity: S): S
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = "INSERT INTO " + PERFORMANCE_ANALYTICS_KEY + " (" + IDENTIFIER_KEY + "," + CREATION_DATE_KEY + "," + APP_VERSION_KEY + "," + PLATFORM_KEY + "," + DATA_UPDATES_KEY + "," + PERFORMANCE_ANALYTIC_TYPE_KEY + "," + PERFORMANCE_VALUE_KEY + "," + APPLICATION_IDENTIFIER_KEY + ") VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + CREATION_DATE_KEY + "," + ":" + APP_VERSION_KEY + "," + ":#{#" + PLATFORM_KEY + ".name()}" + "," + ":" + DATA_UPDATES_KEY + "," + ":#{#" + PERFORMANCE_ANALYTIC_TYPE_KEY + ".name()}" + "," + ":" + PERFORMANCE_VALUE_KEY + "," + ":" + APPLICATION_IDENTIFIER_KEY + ")", nativeQuery = true )
abstract fun storeAnalytic(@Param(value = "id") id: String, @Param(value = "creation_date") creationDate: Long, @Param(value = "app_version") appVersion: String, @Param(value = "platform") platform: Platform, @Param(value = "data_updates") updates: Int, @Param(value = "performance_analytic_type") type: PerformanceAnalytic.PerformanceAnalyticType, @Param(value = "value") value: Double, @Param(value = "application_id") applicationId: String)
Method to store a new analytic in the system
Link copied to clipboard
@Modifying(clearAutomatically = true )
@Query(value = ""UPDATE " + PERFORMANCE_ANALYTICS_KEY + " SET " + DATA_UPDATES_KEY + "=:" + DATA_UPDATES_KEY + "," + PERFORMANCE_VALUE_KEY + "=:" + PERFORMANCE_VALUE_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " AND " + CREATION_DATE_KEY + "=:" + CREATION_DATE_KEY + " AND " + APP_VERSION_KEY + "=:" + APP_VERSION_KEY + " AND " + PLATFORM_KEY + "=:#{#" + PLATFORM_KEY + ".name()}" + " AND " + PERFORMANCE_ANALYTIC_TYPE_KEY + "=:#{#" + PERFORMANCE_ANALYTIC_TYPE_KEY + ".name()}" + " AND " + APPLICATION_IDENTIFIER_KEY + "=:" + APPLICATION_IDENTIFIER_KEY", nativeQuery = true )
abstract fun updateAnalytic(@Param(value = "data_updates") updates: Int, @Param(value = "value") value: Double, @Param(value = "id") id: String, @Param(value = "creation_date") creationDate: Long, @Param(value = "app_version") appVersion: String, @Param(value = "platform") platform: Platform, @Param(value = "performance_analytic_type") type: PerformanceAnalytic.PerformanceAnalyticType, @Param(value = "application_id") applicationId: String)
Method to update an existing analytic in the system