diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index 96eb45ef..840ca544 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -2,12 +2,12 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - id("org.springframework.boot") version "3.5.5" + id("org.springframework.boot") version "4.0.0-RC2" id("io.spring.dependency-management") version "1.1.7" - id("org.owasp.dependencycheck") version "12.1.3" - kotlin("jvm") version "2.2.10" - kotlin("plugin.spring") version "2.2.10" - id("org.sonarqube") version "6.2.0.5505" + id("org.owasp.dependencycheck") version "12.1.9" + kotlin("jvm") version "2.2.21" + kotlin("plugin.spring") version "2.2.21" + id("org.sonarqube") version "7.0.1.6134" } group = "hu.bme.sch" @@ -42,52 +42,49 @@ repositories { } dependencies { - implementation("com.google.firebase:firebase-admin:9.5.0") - implementation("software.amazon.awssdk:s3:2.32.29") - implementation("jakarta.xml.bind:jakarta.xml.bind-api:4.0.2") - implementation("org.springframework.boot:spring-boot-configuration-processor") - implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.springframework.boot:spring-boot-starter-oauth2-client") - implementation("org.springframework.boot:spring-boot-starter-security") - implementation("org.springframework.boot:spring-boot-starter-web") - implementation("org.springframework.boot:spring-boot-starter-webflux") - implementation("org.springframework.boot:spring-boot-starter-thymeleaf") - implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("org.springframework.boot:spring-boot-starter-validation") - implementation("org.springframework.session:spring-session-jdbc") - implementation("org.springframework.retry:spring-retry") - implementation("org.springframework.boot:spring-boot-starter-aop") + annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") + developmentOnly("org.springframework.boot:spring-boot-devtools") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-csv") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - implementation("com.squareup.okhttp3:okhttp:5.1.0") - implementation("com.itextpdf:itext-core:9.2.0") + implementation("com.fasterxml.uuid:java-uuid-generator:5.1.1") implementation("com.github.spullara.mustache.java:compiler:0.9.14") + implementation("com.google.firebase:firebase-admin:9.7.0") + implementation("com.google.zxing:core:3.5.4") + implementation("com.google.zxing:javase:3.5.4") + implementation("com.itextpdf:itext-core:9.4.0") + implementation("com.squareup.okhttp3:okhttp:5.3.0") + implementation(platform("io.jsonwebtoken:jjwt-bom:0.13.0")) + runtimeOnly("io.jsonwebtoken:jjwt-impl") + runtimeOnly("io.jsonwebtoken:jjwt-jackson") + implementation("io.jsonwebtoken:jjwt-api") + implementation(platform("io.micrometer:micrometer-bom:1.16.0")) + implementation("io.micrometer:micrometer-core") + implementation("io.micrometer:micrometer-observation") + implementation("io.micrometer:micrometer-registry-prometheus") + implementation("org.commonmark:commonmark-ext-gfm-tables:0.27.0") + implementation("org.commonmark:commonmark:0.27.0") implementation("org.jetbrains.kotlin:kotlin-reflect") - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.11") - implementation("com.google.zxing:core:3.5.3") - implementation("com.google.zxing:javase:3.5.3") implementation("org.jetbrains.kotlin:kotlin-scripting-common") - implementation("org.jetbrains.kotlin:kotlin-scripting-jvm") - implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host") implementation("org.jetbrains.kotlin:kotlin-scripting-dependencies") implementation("org.jetbrains.kotlin:kotlin-scripting-dependencies-maven") + implementation("org.jetbrains.kotlin:kotlin-scripting-jvm") + implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2") - implementation(platform("io.jsonwebtoken:jjwt-bom:0.13.0")) - implementation("io.jsonwebtoken:jjwt-api") - runtimeOnly("io.jsonwebtoken:jjwt-impl") - runtimeOnly("io.jsonwebtoken:jjwt-jackson") - implementation("com.fasterxml.uuid:java-uuid-generator:5.1.0") - implementation("org.commonmark:commonmark:0.25.1") - implementation("org.commonmark:commonmark-ext-gfm-tables:0.25.1") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-csv") - developmentOnly("org.springframework.boot:spring-boot-devtools") - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") + implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:3.0.0-RC1") + implementation("org.springframework.boot:spring-boot-configuration-processor") + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("org.springframework.boot:spring-boot-starter-data-jpa") + implementation("org.springframework.boot:spring-boot-starter-oauth2-client") + implementation("org.springframework.boot:spring-boot-starter-security") + implementation("org.springframework.boot:spring-boot-starter-thymeleaf") + implementation("org.springframework.boot:spring-boot-starter-validation") + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.springframework.boot:spring-boot-starter-webclient") + implementation("org.springframework.session:spring-session-jdbc") + implementation("software.amazon.awssdk:s3:2.38.7") runtimeOnly("com.h2database:h2") - implementation("org.postgresql:postgresql") - implementation(platform("io.micrometer:micrometer-bom:1.15.3")) - implementation("io.micrometer:micrometer-core") - implementation("io.micrometer:micrometer-registry-prometheus") - implementation("io.micrometer:micrometer-observation") + runtimeOnly("org.postgresql:postgresql") testApi("org.springframework.boot:spring-boot-starter-test") testApi("org.springframework.security:spring-security-test") } diff --git a/backend/gradle/wrapper/gradle-wrapper.jar b/backend/gradle/wrapper/gradle-wrapper.jar index 1b33c55b..f8e1ee31 100644 Binary files a/backend/gradle/wrapper/gradle-wrapper.jar and b/backend/gradle/wrapper/gradle-wrapper.jar differ diff --git a/backend/gradle/wrapper/gradle-wrapper.properties b/backend/gradle/wrapper/gradle-wrapper.properties index ff23a68d..bad7c246 100644 --- a/backend/gradle/wrapper/gradle-wrapper.properties +++ b/backend/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/backend/gradlew b/backend/gradlew index 23d15a93..adff685a 100755 --- a/backend/gradlew +++ b/backend/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/backend/gradlew.bat b/backend/gradlew.bat index db3a6ac2..c4bdd3ab 100644 --- a/backend/gradlew.bat +++ b/backend/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/CMSchApplication.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/CMSchApplication.kt index 729e3704..5bbedda0 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/CMSchApplication.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/CMSchApplication.kt @@ -4,8 +4,8 @@ import hu.bme.sch.cmsch.component.app.ApplicationComponent import hu.bme.sch.cmsch.config.ComponentLoadConfig import hu.bme.sch.cmsch.config.StartupPropertyConfig import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.boot.autoconfigure.domain.EntityScan import org.springframework.boot.context.properties.EnableConfigurationProperties +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.boot.runApplication @SpringBootApplication diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/addon/nova/NovaIntegrationService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/addon/nova/NovaIntegrationService.kt index 744004c8..299e0484 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/addon/nova/NovaIntegrationService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/addon/nova/NovaIntegrationService.kt @@ -16,8 +16,7 @@ import hu.bme.sch.cmsch.repository.UserRepository import hu.bme.sch.cmsch.service.TimeService import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -46,7 +45,7 @@ class NovaIntegrationService( private val log = LoggerFactory.getLogger(javaClass) - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun updateSubmissions(emails: List): Int { val form = formRepository.findAll().firstOrNull { it.selected } @@ -74,7 +73,7 @@ class NovaIntegrationService( return successful } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = true, isolation = Isolation.READ_COMMITTED) fun fetchSubmissions(): List { val form = formRepository.findAll().firstOrNull { it.selected } @@ -151,7 +150,7 @@ class NovaIntegrationService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun setPaymentStatus(email: String, status: Boolean, rejectionMessage: String?) { val form = formRepository.findAll().firstOrNull { it.selected } @@ -173,7 +172,7 @@ class NovaIntegrationService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun setDetailsStatus(email: String, status: Boolean, rejectionMessage: String?) { val form = formRepository.findAll().firstOrNull { it.selected } @@ -195,7 +194,7 @@ class NovaIntegrationService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun setAvatarStatus(email: String, status: Boolean, rejectionMessage: String?) { val user = userRepository.findByEmail(email).orElse(null) ?: return @@ -218,7 +217,7 @@ class NovaIntegrationService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun setCvStatus(email: String, status: Boolean, rejectionMessage: String?) { val user = userRepository.findByEmail(email).orElse(null) ?: return diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/admin/CsvParserUtil.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/admin/CsvParserUtil.kt index 29193e57..016ff5cf 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/admin/CsvParserUtil.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/admin/CsvParserUtil.kt @@ -57,9 +57,9 @@ class CsvParserUtil(private val type: KClass) { return writer.writeValue(outputStream, data) } - fun importFromCsv(inputStream: InputStream): List { + fun importFromCsv(inputStream: InputStream): MutableList { val reader = mapper.readerFor(type.java).with(readerSchema) return reader.readValues(inputStream).readAll() } -} \ No newline at end of file +} diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/admission/AdmissionComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/admission/AdmissionComponentEntityConfiguration.kt index f9c405e9..879ca5e3 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/admission/AdmissionComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/admission/AdmissionComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.admission import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationApiController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationApiController.kt index 12d96328..339fc099 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationApiController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationApiController.kt @@ -64,7 +64,7 @@ class ApplicationApiController( return ApplicationConfigDto( role = role, menu = listOf(), - components = componentWriter.writeValueAsString(components) + components = components ) } } @@ -74,7 +74,7 @@ class ApplicationApiController( return ApplicationConfigDto( role = role, menu = menuService.getCachedMenuForRole(role), - components = componentWriter.writeValueAsString(components) + components = components ) } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationConfigDto.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationConfigDto.kt index 330fba7a..50ae9a5f 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationConfigDto.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/ApplicationConfigDto.kt @@ -1,9 +1,5 @@ package hu.bme.sch.cmsch.component.app -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.databind.JsonSerializer -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.annotation.JsonSerialize import hu.bme.sch.cmsch.model.RoleType data class ApplicationConfigDto( @@ -11,12 +7,5 @@ data class ApplicationConfigDto( var menu: List, // Components -> properties -> values: Map> - @field:JsonSerialize(using = ApplicationConfigFastSerializer::class) - var components: String + var components: Map ) - -class ApplicationConfigFastSerializer : JsonSerializer() { - override fun serialize(value: String?, gen: JsonGenerator?, serializers: SerializerProvider?) { - gen?.writeRawValue(value ?: "") - } -} \ No newline at end of file diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/MenuService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/MenuService.kt index d4e693b6..1614cddf 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/MenuService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/app/MenuService.kt @@ -14,8 +14,7 @@ import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean import org.springframework.context.event.ContextRefreshedEvent import org.springframework.context.event.EventListener -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.PlatformTransactionManager import org.springframework.transaction.annotation.Isolation @@ -131,7 +130,7 @@ class MenuService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun persistSettings(menus: List, role: RoleType) { menuRepository.deleteAllByRole(role) @@ -197,7 +196,7 @@ class MenuService( var external: Boolean = false, ) - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun importMenu(entries: List, rolesToInclude: List): Pair { var imported = 0 diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyComponentEntityConfiguration.kt index d9d109ff..4c29ec78 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.bmejegy import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyRecordRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyRecordRepository.kt index b8e2d289..9548b139 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyRecordRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/BmejegyRecordRepository.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository interface BmejegyRecordRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findAllByQrCode(qr: String): List diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/CheersBmejegyService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/CheersBmejegyService.kt index cabc386e..11426b9a 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/CheersBmejegyService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/CheersBmejegyService.kt @@ -13,13 +13,11 @@ import hu.bme.sch.cmsch.service.TimeService import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional import java.sql.SQLException -import java.util.Optional @Service @ConditionalOnBean(BmejegyComponent::class) @@ -70,7 +68,7 @@ class CheersBmejegyService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun updateUserStatuses() { val unmatched = bmejegyRecordRepository.findAllByMatchedUserId(0) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/LegacyBmejegyService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/LegacyBmejegyService.kt index c1df5ffc..22b05be5 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/LegacyBmejegyService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/bmejegy/LegacyBmejegyService.kt @@ -19,8 +19,7 @@ import org.springframework.http.HttpHeaders import org.springframework.http.MediaType import org.springframework.http.ResponseEntity import org.springframework.http.client.reactive.ReactorClientHttpConnector -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -65,7 +64,7 @@ class LegacyBmejegyService( return Optional.ofNullable(bmejegyRecordRepository.findAllByQrCode(qr).firstOrNull()) } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun updateTickets(tickets: BmeJegyResponse) { val registered = bmejegyRecordRepository.findAll().associateBy { it.itemId } @@ -101,7 +100,7 @@ class LegacyBmejegyService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun updateUserStatuses() { val unmatched = bmejegyRecordRepository.findAllByMatchedUserId(0) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/challenge/ChallengeComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/challenge/ChallengeComponentEntityConfiguration.kt index 71c53055..9fd62fd3 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/challenge/ChallengeComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/challenge/ChallengeComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.challenge import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunitiesComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunitiesComponentEntityConfiguration.kt index 060ec097..f3025003 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunitiesComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunitiesComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.communities import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunityRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunityRepository.kt index 25dd75b1..5ad7cb5f 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunityRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/CommunityRepository.kt @@ -14,6 +14,6 @@ interface CommunityRepository : CrudRepository, override fun findById(id: Int): Optional - override fun findAll(): List + override fun findAll(): MutableList } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/OrganizationRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/OrganizationRepository.kt index aa441a83..958bb95d 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/OrganizationRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/communities/OrganizationRepository.kt @@ -14,6 +14,6 @@ interface OrganizationRepository : CrudRepository, override fun findById(id: Int): Optional - override fun findAll(): List + override fun findAll(): MutableList } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceComponentEntityConfiguration.kt index f91833f1..8f3426f1 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.conference import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceRepositories.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceRepositories.kt index d3e8a251..8e534877 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceRepositories.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceRepositories.kt @@ -8,7 +8,7 @@ import org.springframework.stereotype.Repository @Repository @ConditionalOnBean(ConferenceComponent::class) interface ConferenceRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableList } @Repository @@ -35,4 +35,4 @@ interface ConferencePresentationRepository : CrudRepository, EntityPageDataSource { fun findAllByVisibleTrue(): List -} \ No newline at end of file +} diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceSeedConfig.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceSeedConfig.kt index f55de159..25482650 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceSeedConfig.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/conference/ConferenceSeedConfig.kt @@ -27,8 +27,7 @@ class ConferenceSeedConfig( private fun addConference() { if (conferenceRepository.count() != 0L) return - conferenceRepository.saveAll( - listOf( + conferenceRepository.saveAll(mutableListOf( ConferenceEntity( title = "Test Conference 2022", priority = 0, @@ -51,7 +50,7 @@ class ConferenceSeedConfig( private fun addCompanies() { if (conferenceCompanyRepository.count() != 0L) return conferenceCompanyRepository.saveAll( - listOf( + mutableListOf( ConferenceCompanyEntity( name = "Test Company 1", selector = "test-company-1", @@ -91,7 +90,7 @@ class ConferenceSeedConfig( private fun addPresenters() { if (conferencePresenterRepository.count() != 0L) return conferencePresenterRepository.saveAll( - listOf( + mutableListOf( ConferencePresenterEntity( name = "Test Presenter 1", selector = "test-presenter-1", @@ -123,7 +122,7 @@ class ConferenceSeedConfig( private fun addPresentations() { if (conferencePresentationRepository.count() != 0L) return conferencePresentationRepository.saveAll( - listOf( + mutableListOf( ConferencePresentationEntity( slug = "test-presentation-1", title = "Test Presentation 1", @@ -196,7 +195,7 @@ class ConferenceSeedConfig( private fun addOrganizers() { if (conferenceOrganizerRepository.count() != 0L) return conferenceOrganizerRepository.saveAll( - listOf( + mutableListOf( ConferenceOrganizerEntity( name = "Test Organizer 1", rank = "Test Rank 1", diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByGroupController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByGroupController.kt index 89746d31..59f4c6ef 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByGroupController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByGroupController.kt @@ -38,7 +38,7 @@ class DebtAdminDebtsByGroupController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { return soldProductRepository.findAll().groupBy { it.responsibleGroupId } .map { it.value } .filter { it.isNotEmpty() } @@ -51,7 +51,7 @@ class DebtAdminDebtsByGroupController( debts.filter { !it.payed }.sumOf { it.price }, debts.filter { !it.finsihed }.sumOf { it.price } ) - } + }.toMutableList() } }, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByUsersController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByUsersController.kt index b1e5a4ce..ca25abb3 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByUsersController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtAdminDebtsByUsersController.kt @@ -40,7 +40,7 @@ class DebtAdminDebtsByUsersController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { return soldProductRepository.findAll().groupBy { it.ownerId } .map { it.value } .filter { it.isNotEmpty() } @@ -54,7 +54,7 @@ class DebtAdminDebtsByUsersController( debts.filter { !it.payed }.sumOf { it.price }, debts.filter { !it.finsihed }.sumOf { it.price } ) - } + }.toMutableList() } }, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtComponentEntityConfiguration.kt index 7058b138..2feead93 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/DebtComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.debt import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/ProductRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/ProductRepository.kt index 77d7a696..a5d3326e 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/ProductRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/debt/ProductRepository.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository interface ProductRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findAllByType(type: ProductType): List fun findAllByTypeAndVisibleTrue(type: ProductType): List } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/email/EmailComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/email/EmailComponentEntityConfiguration.kt index a6337787..60cf45d6 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/email/EmailComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/email/EmailComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.email import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogComponentEntityConfiguration.kt index eb4a3956..c9654a6c 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.errorlog import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogRepository.kt index b2cda46a..4a199ab5 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/errorlog/ErrorLogRepository.kt @@ -13,7 +13,7 @@ import java.util.* interface ErrorLogRepository : CrudRepository, EntityPageDataSource { @Query("select e from ErrorLogEntity e order by e.lastReportedAt desc") - override fun findAll(): List + override fun findAll(): MutableIterable fun findByMessageAndStackAndUserAgentAndHrefAndRole( message: String, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventComponentEntityConfiguration.kt index efe42d77..d5b05334 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.event import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventRepository.kt index e10af5e4..4c30b24d 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/event/EventRepository.kt @@ -9,7 +9,7 @@ import java.util.* @Repository @ConditionalOnBean(EventComponent::class) interface EventRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findByUrl(url: String): Optional fun findAllByVisibleTrueOrderByTimestampStart(): List } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormComponentEntityConfiguration.kt index 4174c96a..668be43e 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.form import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormService.kt index 81a04394..e516d2aa 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/FormService.kt @@ -11,8 +11,7 @@ import hu.bme.sch.cmsch.repository.UserRepository import hu.bme.sch.cmsch.service.TimeService import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -32,7 +31,7 @@ class FormService( private val emailService: Optional ) { - internal final val log = LoggerFactory.getLogger(javaClass) + internal val log = LoggerFactory.getLogger(javaClass) private final val objectMapper = jacksonObjectMapper() private final val gridReader = objectMapper.readerFor(FormGridValue::class.java) @@ -148,7 +147,7 @@ class FormService( ) - @Retryable(value = [SQLException::class], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [SQLException::class], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun submitForm(user: CmschUser?, path: String, data: Map, update: Boolean): FormSubmissionResult { val form = formRepository.findAllByUrl(path).getOrNull(0) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponseRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponseRepository.kt index ee1fe986..1148f007 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponseRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponseRepository.kt @@ -33,6 +33,6 @@ interface ResponseRepository : CrudRepository, fun findTop1ByFormIdAndEntryTokenOrderByLineDesc(formId: Int, entryToken: String): List - override fun findAll(): List + override fun findAll(): MutableList } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponsesController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponsesController.kt index 245ccc81..d8f71a3a 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponsesController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/form/ResponsesController.kt @@ -46,7 +46,7 @@ class ResponsesController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { return formService.getAllResponses() .groupBy { it.formId } .map { it.value } @@ -64,7 +64,7 @@ class ResponsesController( responses.count { it.detailsValidated }, ) }.orElse(null) - } + }.toMutableList() } }, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryComponentEntityConfiguration.kt index 0f3e731a..92283c55 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.gallery import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryRepository.kt index c2ee7122..8de9b01c 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/gallery/GalleryRepository.kt @@ -8,7 +8,7 @@ import org.springframework.stereotype.Repository @Repository @ConditionalOnBean(GalleryComponent::class) interface GalleryRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableList fun findByShowOnHomePage(showOnHomePage: Boolean): List } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/groupselection/GroupSelectionService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/groupselection/GroupSelectionService.kt index 92e4a04b..f00011c3 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/groupselection/GroupSelectionService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/groupselection/GroupSelectionService.kt @@ -5,8 +5,7 @@ import hu.bme.sch.cmsch.repository.GroupRepository import hu.bme.sch.cmsch.repository.UserRepository import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -21,7 +20,7 @@ class GroupSelectionService( private val log = LoggerFactory.getLogger(javaClass) - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun selectGroup( user: UserEntity, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyComponentEntityConfiguration.kt index 0ded042e..8a02cf79 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.key import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyRepository.kt index 3bc27f9a..1db9db3e 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyRepository.kt @@ -9,10 +9,10 @@ import org.springframework.stereotype.Repository @ConditionalOnBean(AccessKeyComponent::class) interface AccessKeyRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findTop1ByUsedByUserId(userId: Int): List fun findTop1ByAccessKey(accessKey: String): List -} \ No newline at end of file +} diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyService.kt index 7061d9b5..c05c3805 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/key/AccessKeyService.kt @@ -7,8 +7,7 @@ import hu.bme.sch.cmsch.service.AuditLogService import hu.bme.sch.cmsch.service.TimeService import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -29,7 +28,7 @@ class AccessKeyService( private val log = LoggerFactory.getLogger(javaClass) - @Retryable(value = [SQLException::class], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [SQLException::class], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun validateKey(user: CmschUser, inputKey: String): AccessKeyResponse { val key = inputKey.trim() diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/leaderboard/LeaderBoardService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/leaderboard/LeaderBoardService.kt index b9dd7245..67a4f273 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/leaderboard/LeaderBoardService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/leaderboard/LeaderBoardService.kt @@ -18,8 +18,7 @@ import hu.bme.sch.cmsch.util.CombinedKey import jakarta.annotation.PostConstruct import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation @@ -135,7 +134,7 @@ open class LeaderBoardService( return null } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) @Scheduled(fixedRate = 1000L * 60 * 60 * 10) open fun recalculate() { @@ -147,7 +146,7 @@ open class LeaderBoardService( forceRecalculateForUsers() } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) open fun forceRecalculateForGroups() { val hintPercentage: Float = riddleComponent.map { it.hintScorePercent }.orElse(0) / 100f @@ -157,7 +156,7 @@ open class LeaderBoardService( val tasksPercent = leaderBoardComponent.tasksPercent / 100.0f val tasks = when (startupPropertyConfig.taskOwnershipMode) { OwnershipType.GROUP -> { - taskSubmissions.map { it.findAll() }.orElse(listOf()) + taskSubmissions.map { it.findAll() }.orElse(mutableListOf()) .groupBy { CombinedKey(it.groupId ?: 0, it.groupName) } .filter { groups.findByName(it.key.name).map { m -> m.races }.orElse(false) } .map { @@ -179,7 +178,7 @@ open class LeaderBoardService( val riddleCache = riddleRepository.map { repo -> repo.findAll().associateBy { it.id } }.orElse(mapOf()) val riddles = when (startupPropertyConfig.riddleOwnershipMode) { OwnershipType.GROUP -> { - riddleSubmissions.map { it.findAll() }.orElse(listOf()) + riddleSubmissions.map { it.findAll() }.orElse(mutableListOf()) .groupBy { groups.findById(it.ownerGroupId).orElseThrow() } .filter { it.key?.races ?: false } .map { riddleGroup -> @@ -204,7 +203,7 @@ open class LeaderBoardService( val challengesPercent = leaderBoardComponent.challengesPercent / 100.0f val challenges = when (startupPropertyConfig.challengeOwnershipMode) { OwnershipType.GROUP -> { - challengeSubmissions.map { it.findAll() }.orElse(listOf()) + challengeSubmissions.map { it.findAll() }.orElse(mutableListOf()) .groupBy { CombinedKey(it.groupId ?: 0, it.groupName) } .filter { groups.findByName(it.key.name).map { m -> m.races }.orElse(false) } .map { entity -> @@ -255,7 +254,7 @@ open class LeaderBoardService( tokenScore = tokenScore ) } - }.orElse(listOf()) + }.orElse(mutableListOf()) } } @@ -282,7 +281,7 @@ open class LeaderBoardService( log.info("Recalculating finished") } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) open fun forceRecalculateForUsers() { val hintPercentage: Float = riddleComponent.map { it.hintScorePercent }.orElse(0) / 100f @@ -293,7 +292,7 @@ open class LeaderBoardService( val tasks = when (startupPropertyConfig.taskOwnershipMode) { OwnershipType.GROUP -> listOf() OwnershipType.USER -> { - taskSubmissions.map { it.findAll() }.orElse(listOf()) + taskSubmissions.map { it.findAll() }.orElse(mutableListOf()) .groupBy { it.userId } .map { entity -> val user = users.findById(entity.key ?: 0) @@ -316,7 +315,7 @@ open class LeaderBoardService( val riddles = when (startupPropertyConfig.riddleOwnershipMode) { OwnershipType.GROUP -> listOf() OwnershipType.USER -> { - riddleSubmissions.map { it.findAll() }.orElse(listOf()) + riddleSubmissions.map { it.findAll() }.orElse(mutableListOf()) .groupBy { users.findById(it.ownerUserId).orElseThrow() } .map { riddleGroup -> LeaderBoardAsUserEntryDto(riddleGroup.key?.id ?: 0, @@ -340,7 +339,7 @@ open class LeaderBoardService( val challenges = when (startupPropertyConfig.challengeOwnershipMode) { OwnershipType.GROUP -> listOf() OwnershipType.USER -> { - challengeSubmissions.map { it.findAll() }.orElse(listOf()) + challengeSubmissions.map { it.findAll() }.orElse(mutableListOf()) .groupBy { it.userId } .map { entity -> entity.value.forEach { challenge -> @@ -365,7 +364,7 @@ open class LeaderBoardService( val tokens = when (startupPropertyConfig.tokenOwnershipMode) { OwnershipType.GROUP -> listOf() OwnershipType.USER -> { - tokenSubmissions.map { it.findAll() }.orElse(listOf()) + tokenSubmissions.map { it.findAll() }.orElse(mutableListOf()) .groupBy { it.ownerUser?.id ?: 0 } .map { entity -> LeaderBoardAsUserEntryDto( diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationComponentEntityConfiguration.kt index daa51139..731b538f 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.location import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationRepository.kt index eadc3cb6..33925511 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationRepository.kt @@ -12,5 +12,5 @@ interface LocationRepository : CrudRepository, EntityPageDataSource { fun findByUserId(userId: Int): Optional - override fun findAll(): List + override fun findAll(): MutableIterable } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt index 7793622e..db0b5645 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/LocationService.kt @@ -98,9 +98,9 @@ class LocationService( } } - fun findAllLocation(): List { + fun findAllLocation(): MutableList { return tokenToLocationMapping.values.toList() - .sortedBy { it.groupName } + .sortedBy { it.groupName }.toMutableList() } fun clean() { @@ -191,8 +191,8 @@ class LocationService( override fun deleteAll() = clean() - override fun saveAll(entities: Iterable): Iterable { - return entities.filterNotNull().map { save(it) } + override fun saveAll(entities: MutableIterable): MutableIterable { + return entities.map { save(it) }.toMutableList() } override fun save(entity: S): S { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/WaypointRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/WaypointRepository.kt index 27633800..67aab7dc 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/WaypointRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/location/WaypointRepository.kt @@ -10,5 +10,5 @@ import org.springframework.stereotype.Repository interface WaypointRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/news/NewsComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/news/NewsComponentEntityConfiguration.kt index 4ad6f6e4..5045b6b3 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/news/NewsComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/news/NewsComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.news import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/profile/ProfileService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/profile/ProfileService.kt index 9fba327c..23ec4a46 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/profile/ProfileService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/profile/ProfileService.kt @@ -26,8 +26,7 @@ import hu.bme.sch.cmsch.service.TimeService import hu.bme.sch.cmsch.util.isAvailableForRole import hu.bme.sch.cmsch.util.mapIfTrue import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -42,14 +41,12 @@ class ProfileService( private val profileComponent: ProfileComponent, private val debtsRepository: Optional, private val locationService: Optional, - private val groupSelectionComponent: Optional, private val tokenService: Optional, private val tokenComponent: Optional, private val tasksService: Optional, private val riddleService: Optional, private val raceService: Optional, private val loginComponent: Optional, - private val legacyBmejegyService: Optional, private val clock: TimeService, private val startupPropertyConfig: StartupPropertyConfig, private val admissionService: Optional, @@ -232,7 +229,7 @@ class ProfileService( .associate { Pair(it.id, it.name) } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun changeAlias(user: UserEntity, newAlias: String): Boolean { return if (newAlias.matches(Regex(profileComponent.aliasRegex))) { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/proto/ProtoComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/proto/ProtoComponentEntityConfiguration.kt index a43d5220..124eaa71 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/proto/ProtoComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/proto/ProtoComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.proto import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/FirebaseMessagingConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/FirebaseMessagingConfiguration.kt index 56bd5d94..c19d97a6 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/FirebaseMessagingConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/FirebaseMessagingConfiguration.kt @@ -8,9 +8,9 @@ import org.springframework.beans.factory.annotation.Value import org.springframework.boot.autoconfigure.condition.ConditionalOnBean import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.retry.backoff.BackOffPolicyBuilder -import org.springframework.retry.policy.SimpleRetryPolicy -import org.springframework.retry.support.RetryTemplate +import org.springframework.core.retry.RetryPolicy +import org.springframework.core.retry.RetryTemplate +import java.time.Duration @Configuration @ConditionalOnBean(PushNotificationComponent::class) @@ -47,15 +47,14 @@ class FirebaseMessagingConfiguration { @Bean @ConditionalOnBean(PushNotificationComponent::class) fun retryTemplate(): RetryTemplate { - val retryPolicy = SimpleRetryPolicy(5) - val backOffPolicy = BackOffPolicyBuilder.newBuilder() - .delay(500L) + val retryPolicy = RetryPolicy.builder() + .maxAttempts(5) + .delay(Duration.ofMillis(500)) .multiplier(1.5) .build() val template = RetryTemplate() template.setRetryPolicy(retryPolicy) - template.setBackOffPolicy(backOffPolicy) return template } } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationComponentEntityConfiguration.kt index c3f3c9fc..4ef337c7 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.pushnotification import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationService.kt index de67b638..473f1ec4 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/pushnotification/PushNotificationService.kt @@ -6,7 +6,7 @@ import hu.bme.sch.cmsch.dto.CmschNotification import hu.bme.sch.cmsch.model.RoleType import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.support.RetryTemplate +import org.springframework.core.retry.RetryTemplate import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -53,7 +53,7 @@ class PushNotificationService( var tokensRemaining = tokens val sendResult = runCatching { - retryTemplate.execute { + retryTemplate.execute { log.debug("Attempting notification broadcast to {} devices...", tokensRemaining.size) // The token limit per multicast message is 500 diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightComponentEntityConfiguration.kt index 6a4d9114..91f8de93 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.qrfight import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightService.kt index a6c6ded6..478487f2 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrFightService.kt @@ -15,8 +15,7 @@ import hu.bme.sch.cmsch.repository.UserRepository import hu.bme.sch.cmsch.service.TimeService import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -613,7 +612,7 @@ class QrFightService( return completedTokens >= level.minAmountToComplete } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun executeTowerTimer() { log.info("Tower time!") @@ -632,7 +631,7 @@ class QrFightService( tower.holder = state.entries.filter { it.key.isNotBlank() }.maxByOrNull { it.value }?.key ?: "0" tower.holderFor = (state.filter { it.key.isNotBlank() }.maxOfOrNull { it.value } ?: 0) * TIMER_OCCURRENCE tower - } + }.toMutableList() qrTowerRepository.saveAll(updated) log.info("Tower for USER timer executed, and updated {}/{} towers", updated.size, towers.size) } @@ -646,7 +645,7 @@ class QrFightService( tower.holder = state.entries.filter { it.key.isNotBlank() }.maxByOrNull { it.value }?.key ?: "" tower.holderFor = (state.filter { it.key.isNotBlank() }.maxOfOrNull { it.value } ?: 0) * TIMER_OCCURRENCE tower - } + }.toMutableList() qrTowerRepository.saveAll(updated) log.info("Tower for GROUP timer executed, and updated {}/{} towers", updated.size, towers.size) } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrLevelRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrLevelRepository.kt index 1bb78f24..b810f521 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrLevelRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrLevelRepository.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository interface QrLevelRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findAllByCategory(category: String): List fun findAllByVisibleTrueAndEnabledTrue(): List } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrTowerRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrTowerRepository.kt index 69fe8063..f7061975 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrTowerRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/qrfight/QrTowerRepository.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository interface QrTowerRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findAllBySelector(selector: String): List fun findAllByCategory(category: String): List fun findAllByRecordTimeTrue(): List diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/FreestyleRaceRecordRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/FreestyleRaceRecordRepository.kt index 11f56841..17e634ce 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/FreestyleRaceRecordRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/FreestyleRaceRecordRepository.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository interface FreestyleRaceRecordRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findByUserId(userId: Int): FreestyleRaceRecordEntity? } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceCategoryRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceCategoryRepository.kt index a2f6bcb4..04e4b3b4 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceCategoryRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceCategoryRepository.kt @@ -11,7 +11,7 @@ import java.util.* interface RaceCategoryRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findByVisibleTrueAndSlug(category: String): Optional override fun findById(id: Int): Optional fun findAllByVisibleTrue(): List diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceComponentEntityConfiguration.kt index 6270e60e..1b9bfb13 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.race import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceLeaderBoardController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceLeaderBoardController.kt index 537835b0..1916dafc 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceLeaderBoardController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceLeaderBoardController.kt @@ -37,11 +37,11 @@ class RaceLeaderBoardController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableList { return when (startupPropertyConfig.raceOwnershipMode) { OwnershipType.USER -> raceService.getBoardForUsers(DEFAULT_CATEGORY, true) OwnershipType.GROUP -> raceService.getBoardForGroups(DEFAULT_CATEGORY) - } + }.toMutableList() } override fun count() = findAll().count().toLong() diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceRecordRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceRecordRepository.kt index 6e88a754..4064f2ae 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceRecordRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/race/RaceRecordRepository.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository interface RaceRecordRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findAllByCategory(category: String): List diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleBusinessLogicService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleBusinessLogicService.kt index dca297d5..01a6d25f 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleBusinessLogicService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleBusinessLogicService.kt @@ -4,8 +4,7 @@ import hu.bme.sch.cmsch.component.login.CmschUser import hu.bme.sch.cmsch.service.TimeService import hu.bme.sch.cmsch.service.UserService import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Propagation @@ -128,7 +127,7 @@ class RiddleBusinessLogicService( ) } - @Retryable(value = [SQLException::class], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [SQLException::class], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) override fun unlockHintForUser(user: CmschUser, riddleId: Int): String? { val riddle = riddleCacheManager.getRiddleById(riddleId) ?: return null @@ -153,7 +152,7 @@ class RiddleBusinessLogicService( return riddle.hint } - @Retryable(value = [SQLException::class], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [SQLException::class], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) override fun unlockHintForGroup(user: CmschUser, groupId: Int?, groupName: String, riddleId: Int): String? { if (groupId == null) @@ -180,7 +179,7 @@ class RiddleBusinessLogicService( return riddle.hint } - @Retryable(value = [SQLException::class], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [SQLException::class], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE, propagation = Propagation.REQUIRES_NEW) override fun submitRiddleForUser( user: CmschUser, @@ -257,7 +256,7 @@ class RiddleBusinessLogicService( } } - @Retryable(value = [SQLException::class], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [SQLException::class], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE, propagation = Propagation.REQUIRES_NEW) override fun submitRiddleForGroup( user: CmschUser, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleCacheManager.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleCacheManager.kt index 3156d905..6f263243 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleCacheManager.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleCacheManager.kt @@ -5,8 +5,7 @@ import hu.bme.sch.cmsch.model.RoleType import jakarta.annotation.PostConstruct import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation @@ -59,7 +58,7 @@ class RiddleCacheManager( resetCache(persistMapping = false, overrideMappings = true) } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE, propagation = Propagation.REQUIRES_NEW) fun resetCache(persistMapping: Boolean, overrideMappings: Boolean) { log.info("Getting all locks for 'resetCache({}, {})'", persistMapping, overrideMappings) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleComponentEntityConfiguration.kt index 89827083..b5909591 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.riddle import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleEntityRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleEntityRepository.kt index f11a9254..554353ce 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleEntityRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddleEntityRepository.kt @@ -10,6 +10,6 @@ import org.springframework.stereotype.Repository interface RiddleEntityRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlePersistenceService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlePersistenceService.kt index 97c43f32..0fe816b2 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlePersistenceService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlePersistenceService.kt @@ -1,8 +1,7 @@ package hu.bme.sch.cmsch.component.riddle import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Propagation @@ -16,7 +15,7 @@ class RiddlePersistenceService( private val riddleMappingRepository: RiddleMappingRepository, ) { - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE, propagation = Propagation.REQUIRES_NEW) fun saveAllRiddleMapping(entities: MutableIterable) { riddleMappingRepository.saveAll(entities) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByGroupsController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByGroupsController.kt index ae8524d5..7626ec7e 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByGroupsController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByGroupsController.kt @@ -47,7 +47,7 @@ class RiddlesByGroupsController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { return transactionManager.transaction(readOnly = true) { riddleMappingRepository.findAll() } .groupBy { it.ownerGroupId } .map { it.value } @@ -60,7 +60,7 @@ class RiddlesByGroupsController( submissions.count { it.completed }, submissions.count { it.hintUsed } ) - } + }.toMutableList() } override fun delete(entity: RiddleStatsVirtualEntity) { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByUsersController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByUsersController.kt index 7c3cbc85..02e52c98 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByUsersController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/riddle/RiddlesByUsersController.kt @@ -37,7 +37,7 @@ class RiddlesByUsersController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { return transactionManager.transaction(readOnly = true) { riddleMappingRepository.findAll() } .groupBy { it.ownerUserId } .map { it.value } @@ -50,7 +50,7 @@ class RiddlesByUsersController( submissions.count { it.completed }, submissions.count { it.hintUsed } ) - } + }.toMutableList() } override fun delete(entity: RiddleStatsVirtualEntity) { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptComponentEntityConfiguration.kt index 3c56129d..47a83672 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.script import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptRunnerDashboard.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptRunnerDashboard.kt index ba908c19..426dfb17 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptRunnerDashboard.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptRunnerDashboard.kt @@ -52,7 +52,7 @@ class ScriptRunnerDashboard( ignoreFromMenu = true ) { - private final val log = LoggerFactory.getLogger(javaClass) + private val log = LoggerFactory.getLogger(javaClass) override fun getComponents(user: CmschUser, requestParams: Map): List { return listOf() diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptService.kt index 0c0175e4..89dbcdf2 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/ScriptService.kt @@ -31,7 +31,7 @@ class ScriptService( private val transactionManager: PlatformTransactionManager ) { - private final val log = LoggerFactory.getLogger(javaClass) + private val log = LoggerFactory.getLogger(javaClass) private final val objectMapper = jacksonObjectMapper() private final val artifactWriter = objectMapper.writerFor(object : TypeReference>() {}) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/sandbox/ScriptingContext.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/sandbox/ScriptingContext.kt index 98d7ad10..eefc2ec9 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/sandbox/ScriptingContext.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/script/sandbox/ScriptingContext.kt @@ -134,7 +134,7 @@ class ReadOnlyScriptingDbContext(private val supportedRepos: List(private val proxy: CrudRepository) { fun findAll(): List { - return proxy.findAll().mapNotNull { if (it is T) { it.duplicate() as T } else null }.toList() + return proxy.findAll().mapNotNull { it.duplicate() as T }.toList() } fun findById(id: ID): T? { @@ -159,4 +159,4 @@ class ModifyingScriptingComponentContext( ?: error("Cannot find component for $selectedComponent") } -} \ No newline at end of file +} diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/serviceaccount/ServiceAccountComponentConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/serviceaccount/ServiceAccountComponentConfiguration.kt index 50da1793..db723a3b 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/serviceaccount/ServiceAccountComponentConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/serviceaccount/ServiceAccountComponentConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.serviceaccount import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsComponentEntityConfiguration.kt index ea79f32a..d92611bf 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsComponentEntityConfiguration.kt @@ -1,10 +1,10 @@ package hu.bme.sch.cmsch.component.sheets import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration @ConditionalOnBean(SheetsComponent::class) @EntityScan(basePackageClasses = [SheetsComponent::class]) -class SheetsComponentEntityConfiguration \ No newline at end of file +class SheetsComponentEntityConfiguration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsUpdaterService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsUpdaterService.kt index e5feec98..2208ebd4 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsUpdaterService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/sheets/SheetsUpdaterService.kt @@ -30,7 +30,7 @@ class SheetsUpdaterService( private val responseRepository: ResponseRepository ) { - private final val log = LoggerFactory.getLogger(javaClass) + private val log = LoggerFactory.getLogger(javaClass) private final val objectMapper = jacksonObjectMapper() private final val sheetsUpdateRequestWriter = objectMapper.writerFor(SheetsUpdateRequest::class.java) private final val sheetsUpdateResponseReader = objectMapper.readerFor(SheetsUpdateResponse::class.java) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/staticpage/StaticPageComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/staticpage/StaticPageComponentEntityConfiguration.kt index b45de957..ed8dd332 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/staticpage/StaticPageComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/staticpage/StaticPageComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.staticpage import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskAdminRateController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskAdminRateController.kt index 943d5cd5..29630617 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskAdminRateController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskAdminRateController.kt @@ -42,7 +42,7 @@ class TaskAdminRateController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { val aggregatedResults = submittedRepository.findAllAggregated() return aggregatedResults.map { @@ -53,7 +53,7 @@ class TaskAdminRateController( it.rejectedCount.toInt(), it.notGradedCount.toInt() ) - }.sortedByDescending { it.notGraded }.toList() + }.sortedByDescending { it.notGraded }.toMutableList() } }, submittedRepository, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskCategoryRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskCategoryRepository.kt index c3497f60..c5bf953d 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskCategoryRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskCategoryRepository.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository interface TaskCategoryRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findAllByAvailableFromLessThanAndAvailableToGreaterThan(availableFrom: Long, availableTo: Long): List fun findAllByCategoryId(categoryId: Int): List fun findAllByType(type: TaskCategoryType): List diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskComponentEntityConfiguration.kt index c1d14664..1577081a 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TaskComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.task import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TasksService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TasksService.kt index 3ea66506..4cbeac1c 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TasksService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/task/TasksService.kt @@ -10,8 +10,7 @@ import hu.bme.sch.cmsch.service.StorageService import hu.bme.sch.cmsch.service.TimeService import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -117,7 +116,7 @@ class TasksService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun submitTaskReview( taskId: Int, @@ -173,7 +172,7 @@ class TasksService( return true } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun submitTaskForGroup(answer: TaskSubmissionDto, file: MultipartFile?, user: CmschUser): TaskSubmissionStatus { val groupId = user.groupId diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamComponentEntityConfiguration.kt index f682a958..f0dfafa7 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamComponentEntityConfiguration.kt @@ -1,6 +1,6 @@ package hu.bme.sch.cmsch.component.team -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamService.kt index 28646d34..2da08c2d 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/team/TeamService.kt @@ -20,8 +20,7 @@ import hu.bme.sch.cmsch.service.StorageService import hu.bme.sch.cmsch.service.TimeService import org.slf4j.LoggerFactory import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -57,7 +56,7 @@ class TeamService( private val log = LoggerFactory.getLogger(javaClass) - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun createTeam(user: UserEntity, name: String): TeamCreationStatus { if (user.group?.leaveable == false) @@ -117,7 +116,7 @@ class TeamService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun joinTeam(user: UserEntity, groupId: Int): TeamJoinStatus { if (user.group?.leaveable == false) @@ -141,7 +140,7 @@ class TeamService( return TeamJoinStatus.OK } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun cancelJoin(user: CmschUser): TeamJoinStatus { if (!teamComponent.joinEnabled) @@ -152,7 +151,7 @@ class TeamService( return TeamJoinStatus.OK } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun leaveTeam(user: CmschUser): TeamLeaveStatus { if (!teamComponent.leaveEnabled) @@ -410,7 +409,7 @@ class TeamService( .map { TeamMemberView(it.userName, it.userId, isAdmin = false, isYou = false) } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun acceptJoin(userId: Int, group: GroupEntity?): Boolean { if (group == null) @@ -437,7 +436,7 @@ class TeamService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun rejectJoin(userId: Int, groupId: Int?, groupName: String): Boolean { if (groupId == null) @@ -452,7 +451,7 @@ class TeamService( return false } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun toggleUserPermissions(userId: Int, groupId: Int?, groupName: String, adminUser: CmschUser): Boolean { if (groupId == null) @@ -495,7 +494,7 @@ class TeamService( } } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun promoteLeader(userId: Int, groupId: Int?, groupName: String, adminUser: CmschUser): Boolean { if (groupId == null) @@ -537,7 +536,7 @@ class TeamService( return true } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun kickUser(userId: Int, groupId: Int?, groupName: String, adminUser: CmschUser): Boolean { if (groupId == null) @@ -577,7 +576,7 @@ class TeamService( log.info("User '{}' kicked from '{}', reason: by admin '{}'", user.fullName, groupName, adminUser.userName) return true } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun setDescriptionAndLogo(description: String, logo: MultipartFile?, user: CmschUser): TeamEditStatus { val groupId = user.groupId ?: throw IllegalStateException("The user is not member of a group yet") diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/BulkTokenGeneratorDashboard.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/BulkTokenGeneratorDashboard.kt index c936ca96..90287d5a 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/BulkTokenGeneratorDashboard.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/BulkTokenGeneratorDashboard.kt @@ -155,11 +155,11 @@ class BulkTokenGeneratorDashboard( availableFrom = timeService.getTimeInSeconds(), availableUntil = timeService.getTimeInSeconds() + (dateUntil * 24 * 60 * 60), ) - }) + }.toMutableList()) return@transaction result.count() } return dashboardPage(VIEW, 2, "${n}db token beszúrva") } -} \ No newline at end of file +} diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByGroupController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByGroupController.kt index a992a6e0..8893ffd2 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByGroupController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByGroupController.kt @@ -41,7 +41,7 @@ class TokenAdminTokensByGroupController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { return repo.findAll() .groupBy { it.ownerGroup?.id ?: 0 } .map { it.value } @@ -53,7 +53,7 @@ class TokenAdminTokensByGroupController( groupName, token.count() ) - } + }.toMutableList() } override fun delete(entity: TokenListByGroupVirtualEntity) { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTeamController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTeamController.kt index 1e33859f..853599fd 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTeamController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTeamController.kt @@ -41,13 +41,13 @@ class TokenAdminTokensByTeamController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { transactionManager.transaction(readOnly = true) { val data = repo.countByAllUserGroup() data.forEach { it.memberCount = userRepository.findAllByGroupName(it.groupName).size } val highestTeamMemberCount = data.maxByOrNull { it.correctedPoints }?.memberCount ?: 0 data.forEach { it.finalPoints = (it.correctedPoints * highestTeamMemberCount).toInt() } - return data + return data.toMutableList() } } }, diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTypeController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTypeController.kt index 5f0d4c55..ec1c0baa 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTypeController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByTypeController.kt @@ -32,7 +32,7 @@ class TokenAdminTokensByTypeController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableIterable { return repo.findAll() .groupBy { it.token?.id } .map { it.value } @@ -44,7 +44,7 @@ class TokenAdminTokensByTypeController( tokenProperty[0].token?.type ?: "n/a", tokenProperty.count() ) - } + }.toMutableList() } override fun delete(entity: TokenStatVirtualEntity) { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByUsersController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByUsersController.kt index d531302e..c266a8bf 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByUsersController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenAdminTokensByUsersController.kt @@ -34,7 +34,7 @@ class TokenAdminTokensByUsersController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { + override fun findAll(): MutableList { return repo.findAll() .groupBy { it.ownerUser?.id ?: 0 } .map { it.value } @@ -47,7 +47,7 @@ class TokenAdminTokensByUsersController( groupName, tokenProperty.count() ) - } + }.toMutableList() } override fun delete(entity: TokenListByUserVirtualEntity) { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenCollectorService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenCollectorService.kt index be2ca29c..fce6b245 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenCollectorService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenCollectorService.kt @@ -10,8 +10,7 @@ import hu.bme.sch.cmsch.repository.GroupRepository import hu.bme.sch.cmsch.service.TimeService import hu.bme.sch.cmsch.service.UserService import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -35,7 +34,7 @@ class TokenCollectorService( private val qrFightComponent: Optional ) { - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun collectToken(user: CmschUser, token: String): TokenSubmittedView { val tokenEntity = tokenRepository.findAllByTokenAndVisibleTrue(token).firstOrNull() @@ -59,7 +58,7 @@ class TokenCollectorService( return TokenSubmittedView(TokenCollectorStatus.WRONG, null, null, null) } - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) fun collectTokenForGroup(user: CmschUser, token: String): TokenSubmittedView { val groupEntity = user.groupId?.let { groupId -> groupRepository.findById(groupId).getOrNull() } diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenComponentEntityConfiguration.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenComponentEntityConfiguration.kt index ff9c4bc9..720207d6 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenComponentEntityConfiguration.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenComponentEntityConfiguration.kt @@ -1,7 +1,7 @@ package hu.bme.sch.cmsch.component.token import org.springframework.boot.autoconfigure.condition.ConditionalOnBean -import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.persistence.autoconfigure.EntityScan import org.springframework.context.annotation.Configuration @Configuration diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyController.kt index 149c86a6..01534dec 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyController.kt @@ -33,8 +33,8 @@ class TokenSubmissionsController( transactionManager, object : ManualRepository() { - override fun findAll(): Iterable { - return repo.findAll().map { mapTokenProperty(it) } + override fun findAll(): MutableIterable { + return repo.findAll().map { mapTokenProperty(it) }.toMutableList() } override fun count(): Long { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyRepository.kt index 6e7dafb5..5ff15376 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/component/token/TokenPropertyRepository.kt @@ -13,7 +13,7 @@ import java.util.* interface TokenPropertyRepository : CrudRepository, EntityPageDataSource { - override fun findAll(): List + override fun findAll(): MutableIterable fun findAllByOwnerUser_Id(owner: Int): List diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/config/AppConfig.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/config/AppConfig.kt index 2472f078..819474c8 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/config/AppConfig.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/config/AppConfig.kt @@ -24,10 +24,9 @@ class AppConfig { @Bean fun objectMapper(): ObjectMapper { - val objectMapper = ObjectMapper() - objectMapper.registerKotlinModule() - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL) - return objectMapper + return ObjectMapper() + .registerKotlinModule() + .setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL) } @Bean @@ -43,7 +42,7 @@ class AppConfig { } try { return URI("https://$source").toURL() - } catch (ex: Exception) { + } catch (_: Exception) { // Ignore } return null diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/config/SecurityConfig.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/config/SecurityConfig.kt index d1019a0a..0a970d08 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/config/SecurityConfig.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/config/SecurityConfig.kt @@ -17,14 +17,11 @@ import hu.bme.sch.cmsch.service.AuditLogService import hu.bme.sch.cmsch.service.JwtTokenProvider import hu.bme.sch.cmsch.service.StorageService import org.slf4j.LoggerFactory -import org.springframework.beans.factory.annotation.Value import org.springframework.boot.autoconfigure.condition.ConditionalOnBean import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.core.Ordered import org.springframework.http.HttpHeaders import org.springframework.http.MediaType -import org.springframework.retry.annotation.EnableRetry import org.springframework.security.config.Customizer import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity @@ -40,7 +37,6 @@ import java.util.* @EnableWebSecurity @Configuration -@EnableRetry(order = Ordered.HIGHEST_PRECEDENCE) @ConditionalOnBean(LoginComponent::class) class SecurityConfig( private val clientRegistrationRepository: ClientRegistrationRepository, @@ -51,7 +47,6 @@ class SecurityConfig( private val authschLoginService: LoginService, private val loginComponent: LoginComponent, private val startupPropertyConfig: StartupPropertyConfig, - @param:Value("\${custom.keycloak.base-url:http://localhost:8081/auth/realms/master}") private val keycloakBaseUrl: String, private val auditLogService: AuditLogService ) { diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/ServerSideErrorController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/ServerSideErrorController.kt index fc34a548..cb99d3e2 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/ServerSideErrorController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/ServerSideErrorController.kt @@ -5,7 +5,7 @@ import hu.bme.sch.cmsch.util.getUserOrNull import jakarta.servlet.RequestDispatcher import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse -import org.springframework.boot.web.servlet.error.ErrorController +import org.springframework.boot.webmvc.error.ErrorController import org.springframework.security.core.Authentication import org.springframework.stereotype.Controller import org.springframework.ui.Model diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/SettingsController.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/SettingsController.kt index 516bbcb7..68906292 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/SettingsController.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/SettingsController.kt @@ -72,10 +72,12 @@ class SettingsController( auth.getUser().refresh(user) adminMenuService.invalidateUser(user.internalId) - SecurityContextHolder.getContext().authentication = UsernamePasswordAuthenticationToken( - auth.principal, auth.credentials, - mutableListOf(SimpleGrantedAuthority("ROLE_${user.role.name}")) - ) + SecurityContextHolder.getContext().authentication = auth.principal?.let { + UsernamePasswordAuthenticationToken( + it, auth.credentials, + mutableListOf(SimpleGrantedAuthority("ROLE_${user.role.name}")) + ) + } log.info("User ${user.fullName} has just relogged") return "redirect:/admin/control/settings" diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/TszImportDashboard.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/TszImportDashboard.kt index 70824626..7394aed1 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/TszImportDashboard.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/admin/TszImportDashboard.kt @@ -256,7 +256,7 @@ class TszImportDashboard( group.staff3 = if (mappings.value.size > 2) mappings.value[2] else "" group.staff4 = if (mappings.value.size > 3) mappings.value[3] else "" return@map group - } + }.toMutableList() groupRepository.saveAll(affectedGroups) affectedSize = affectedGroups.size } @@ -289,4 +289,4 @@ class TszImportDashboard( return results } -} \ No newline at end of file +} diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/dashboard/InstanceInfoDashboard.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/dashboard/InstanceInfoDashboard.kt index 865c30a8..e5d754be 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/dashboard/InstanceInfoDashboard.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/controller/dashboard/InstanceInfoDashboard.kt @@ -14,9 +14,9 @@ import hu.bme.sch.cmsch.service.ControlPermissions import hu.bme.sch.cmsch.service.TimeService import hu.bme.sch.cmsch.statistics.UserActivityFilter import org.apache.catalina.util.ServerInfo -import org.springframework.boot.autoconfigure.web.ServerProperties -import org.springframework.boot.autoconfigure.web.servlet.MultipartProperties import org.springframework.boot.info.BuildProperties +import org.springframework.boot.servlet.autoconfigure.MultipartProperties +import org.springframework.boot.web.server.autoconfigure.ServerProperties import org.springframework.core.env.Environment import org.springframework.stereotype.Controller import org.springframework.web.bind.annotation.RequestMapping @@ -100,11 +100,7 @@ class InstanceInfoDashboard( listOf("Token ownership mode", startupPropertyConfig.tokenOwnershipMode.name), listOf("Challenge ownership mode", startupPropertyConfig.challengeOwnershipMode.name), listOf("Race ownership mode", startupPropertyConfig.raceOwnershipMode.name), - listOf("Max threads", serverProperties?.tomcat?.threads?.max?.toString() ?: "n/a"), - listOf("Min spare threads", serverProperties?.tomcat?.threads?.minSpare?.toString() ?: "n/a"), - listOf("Accept count", serverProperties?.tomcat?.acceptCount?.toString() ?: "n/a"), - listOf("Max connections", serverProperties?.tomcat?.maxConnections?.toString() ?: "n/a"), - listOf("Max swallow size ( ͡° ͜ʖ ͡°)", serverProperties?.tomcat?.maxSwallowSize?.toString() ?: "n/a"), + listOf("Max request header size", serverProperties?.maxHttpRequestHeaderSize?.toString() ?: "n/a"), listOf("Max file size", multipartProperties?.maxFileSize?.toString() ?: "n/a"), listOf("Max request size", multipartProperties?.maxRequestSize?.toString() ?: "n/a"), listOf("Datasource url", env.getProperty("spring.datasource.url", "n/a")), diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/EntityPageDataSource.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/EntityPageDataSource.kt index 0e28b2ea..c3d0d801 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/EntityPageDataSource.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/EntityPageDataSource.kt @@ -4,7 +4,7 @@ import java.util.* interface EntityPageDataSource { - fun findAll(): Iterable + fun findAll(): MutableIterable fun findById(id: ID): Optional @@ -14,8 +14,8 @@ interface EntityPageDataSource { fun save(entity: S): S - fun saveAll(entities: Iterable): Iterable + fun saveAll(entities: MutableIterable): MutableIterable fun deleteAll() -} \ No newline at end of file +} diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/ManualRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/ManualRepository.kt index 4daa8fd5..a539a233 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/ManualRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/ManualRepository.kt @@ -4,7 +4,7 @@ import java.util.* abstract class ManualRepository : EntityPageDataSource { - override fun findAll(): Iterable = + override fun findAll(): MutableIterable = throw UnsupportedOperationException("This data source does not support: findAll()") override fun count(): Long = @@ -13,7 +13,7 @@ abstract class ManualRepository : EntityPageDataSource { override fun deleteAll(): Unit = throw UnsupportedOperationException("This data source does not support: deleteAll()") - override fun saveAll(entities: Iterable): Iterable = + override fun saveAll(entities: MutableIterable): MutableIterable = throw UnsupportedOperationException("This data source does not support: saveAll(entities)") override fun save(entity: S): S = diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/UserRepository.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/UserRepository.kt index 9ba8dd13..f836d4f5 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/UserRepository.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/repository/UserRepository.kt @@ -41,8 +41,8 @@ interface UserRepository : CrudRepository, fun findAllByGroupName(groupName: String): List fun findByEmail(email: String): Optional fun countAllByGroup(group: GroupEntity): Long - fun findAllByRoleOrRoleOrPermissionsNot(role1: RoleType, role2: RoleType, emptyString: String): List - fun findAllByRoleOrRole(role1: RoleType, role2: RoleType): List + fun findAllByRoleOrRoleOrPermissionsNot(role1: RoleType, role2: RoleType, emptyString: String): MutableList + fun findAllByRoleOrRole(role1: RoleType, role2: RoleType): MutableList @Query("SELECT NEW hu.bme.sch.cmsch.repository.UserSelectorView(e.id, e.fullName, e.alias, e.provider, e.email) FROM UserEntity e") fun findAllSelectorView(): List diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/service/UserService.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/service/UserService.kt index 2692bc88..f83e5099 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/service/UserService.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/service/UserService.kt @@ -10,8 +10,7 @@ import hu.bme.sch.cmsch.repository.GroupToUserMappingRepository import hu.bme.sch.cmsch.repository.GuildToUserMappingRepository import hu.bme.sch.cmsch.repository.UserRepository import hu.bme.sch.cmsch.repository.UserSelectorView -import org.springframework.retry.annotation.Backoff -import org.springframework.retry.annotation.Retryable +import org.springframework.resilience.annotation.Retryable import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Isolation import org.springframework.transaction.annotation.Transactional @@ -29,7 +28,7 @@ open class UserService( private val userConfigReader = objectMapper.readerFor(UserConfig::class.java) - @Retryable(value = [ SQLException::class ], maxAttempts = 5, backoff = Backoff(delay = 500L, multiplier = 1.5)) + @Retryable(value = [ SQLException::class ], maxAttempts = 5, delay = 500L, multiplier = 1.5) @Transactional(readOnly = false, isolation = Isolation.SERIALIZABLE) open fun save(user: UserEntity) { users.save(user) diff --git a/backend/src/main/kotlin/hu/bme/sch/cmsch/statistics/StatisticsFilterConfig.kt b/backend/src/main/kotlin/hu/bme/sch/cmsch/statistics/StatisticsFilterConfig.kt index 06a4f293..9a33cada 100644 --- a/backend/src/main/kotlin/hu/bme/sch/cmsch/statistics/StatisticsFilterConfig.kt +++ b/backend/src/main/kotlin/hu/bme/sch/cmsch/statistics/StatisticsFilterConfig.kt @@ -19,9 +19,8 @@ class StatisticsFilterConfig( @Bean fun userActivityFilterRegistration(): FilterRegistrationBean { - val registration = FilterRegistrationBean() - registration.filter = userActivityFilter.orElseThrow() + val registration = FilterRegistrationBean(userActivityFilter.orElseThrow()) registration.addUrlPatterns("/api/*") return registration } -} \ No newline at end of file +} diff --git a/backend/src/main/resources/config/application.properties b/backend/src/main/resources/config/application.properties index 136f4d69..2d2337d6 100644 --- a/backend/src/main/resources/config/application.properties +++ b/backend/src/main/resources/config/application.properties @@ -172,5 +172,3 @@ management.endpoint.health.probes.enabled=true management.endpoints.web.exposure.include=* spring.jpa.properties.hibernate.generate_statistics=true management.metrics.tags.application=insert_application_name -# It's spamming the console otherwise -logging.level.org.hibernate=warn