From 8df471281d10bdd9ac243dc961dfc09ebabc520b Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 22 Nov 2023 21:32:37 +0100 Subject: [PATCH] chore: replace deprecated Kotlin methods in enums --- .../kotlin/com/egm/stellio/search/model/EntityTypeInfo.kt | 2 +- .../src/main/kotlin/com/egm/stellio/shared/model/GeoQuery.kt | 4 ++-- .../src/main/kotlin/com/egm/stellio/shared/util/AuthUtils.kt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/search-service/src/main/kotlin/com/egm/stellio/search/model/EntityTypeInfo.kt b/search-service/src/main/kotlin/com/egm/stellio/search/model/EntityTypeInfo.kt index 831acfe089..16ceefd97e 100644 --- a/search-service/src/main/kotlin/com/egm/stellio/search/model/EntityTypeInfo.kt +++ b/search-service/src/main/kotlin/com/egm/stellio/search/model/EntityTypeInfo.kt @@ -25,6 +25,6 @@ enum class AttributeType(val key: String) { companion object { fun forKey(key: String): AttributeType = - values().find { it.key == key }!! + entries.find { it.key == key }!! } } diff --git a/shared/src/main/kotlin/com/egm/stellio/shared/model/GeoQuery.kt b/shared/src/main/kotlin/com/egm/stellio/shared/model/GeoQuery.kt index e3162f36af..df8b5bc782 100644 --- a/shared/src/main/kotlin/com/egm/stellio/shared/model/GeoQuery.kt +++ b/shared/src/main/kotlin/com/egm/stellio/shared/model/GeoQuery.kt @@ -20,10 +20,10 @@ data class GeoQuery( companion object { fun isSupportedType(type: String): Boolean = - values().any { it.type == type } + entries.any { it.type == type } fun forType(type: String): GeometryType? = - values().find { it.type == type } + entries.find { it.type == type } } } } diff --git a/shared/src/main/kotlin/com/egm/stellio/shared/util/AuthUtils.kt b/shared/src/main/kotlin/com/egm/stellio/shared/util/AuthUtils.kt index ae9ea1e2d5..4b6fda0156 100644 --- a/shared/src/main/kotlin/com/egm/stellio/shared/util/AuthUtils.kt +++ b/shared/src/main/kotlin/com/egm/stellio/shared/util/AuthUtils.kt @@ -128,7 +128,7 @@ enum class GlobalRole(val key: String) { companion object { fun forKey(key: String): Option = - values().find { it.key == key }.toOption() + entries.find { it.key == key }.toOption() } } @@ -139,7 +139,7 @@ enum class AccessRight(val attributeName: String) { companion object { fun forAttributeName(attributeName: String): Option = - values().find { it.attributeName == attributeName.removePrefix(AUTHORIZATION_ONTOLOGY) }.toOption() + entries.find { it.attributeName == attributeName.removePrefix(AUTHORIZATION_ONTOLOGY) }.toOption() fun forExpandedAttributeName(attributeName: ExpandedTerm): Option = when (attributeName) {