mirror of
https://github.com/2martens/tsw-timetable.git
synced 2026-10-17 07:57:55 +02:00
Moved generic value classes to separate module
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
plugins {
|
||||
id("twomartens.kotlin")
|
||||
id("twomartens.java")
|
||||
kotlin("kapt")
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.twomartens.timetable.model.base
|
||||
package de.twomartens.timetable.types
|
||||
|
||||
@JvmInline
|
||||
value class Hour private constructor(val value: Int) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.twomartens.timetable.model.base
|
||||
package de.twomartens.timetable.types
|
||||
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.twomartens.timetable.model.base
|
||||
package de.twomartens.timetable.types
|
||||
|
||||
@JvmInline
|
||||
value class NonEmptyString(val name: String) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package de.twomartens.timetable.model.base
|
||||
package de.twomartens.timetable.types
|
||||
|
||||
@JvmInline
|
||||
value class PositiveInteger(val value: Int) {
|
||||
@@ -5,6 +5,7 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":common"))
|
||||
implementation(libs.mapstruct.base)
|
||||
implementation(libs.bundles.spring.boot.security)
|
||||
implementation(libs.jaxb.impl)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package de.twomartens.timetable.bahnApi.mapper
|
||||
|
||||
import de.twomartens.timetable.bahnApi.model.db.BahnTimetable
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import org.mapstruct.*
|
||||
import java.time.LocalDateTime
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package de.twomartens.timetable.bahnApi.model
|
||||
|
||||
import de.twomartens.timetable.bahnApi.model.db.ScheduledFetchTask
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import org.springframework.stereotype.Component
|
||||
import java.time.LocalDateTime
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package de.twomartens.timetable.bahnApi.model.db
|
||||
|
||||
import de.twomartens.timetable.bahnApi.model.Eva
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import org.bson.types.ObjectId
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.Id
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package de.twomartens.timetable.bahnApi.model.db
|
||||
|
||||
import de.twomartens.timetable.bahnApi.model.Eva
|
||||
import de.twomartens.timetable.bahnApi.model.dto.BahnStationStop
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import org.bson.types.ObjectId
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.Id
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package de.twomartens.timetable.bahnApi.model.db
|
||||
|
||||
import de.twomartens.timetable.bahnApi.model.Eva
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import org.bson.types.ObjectId
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.Id
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ data class BahnStopEvent(
|
||||
@field:XmlAttribute(name = "wings") var wings: String,
|
||||
@field:XmlAttribute(name = "l") var line: String
|
||||
) {
|
||||
constructor(): this("", "",
|
||||
constructor() : this("", "",
|
||||
null,
|
||||
null,
|
||||
"", "", "", "",
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import de.twomartens.timetable.bahnApi.model.dto.BahnStation
|
||||
import de.twomartens.timetable.bahnApi.model.dto.BahnStations
|
||||
import de.twomartens.timetable.bahnApi.model.dto.BahnTimetable
|
||||
import de.twomartens.timetable.bahnApi.property.BahnApiProperties
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import org.springframework.http.HttpEntity
|
||||
import org.springframework.http.HttpHeaders
|
||||
import org.springframework.http.HttpMethod
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import de.twomartens.timetable.bahnApi.model.dto.BahnStation
|
||||
import de.twomartens.timetable.bahnApi.model.dto.BahnTimetable
|
||||
import de.twomartens.timetable.bahnApi.repository.BahnStationRepository
|
||||
import de.twomartens.timetable.bahnApi.repository.BahnTimetableRepository
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import org.mapstruct.factory.Mappers
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ import de.twomartens.timetable.bahnApi.model.FetchDates
|
||||
import de.twomartens.timetable.bahnApi.model.TaskFactory
|
||||
import de.twomartens.timetable.bahnApi.model.db.ScheduledFetchTask
|
||||
import de.twomartens.timetable.bahnApi.repository.ScheduledFetchTaskRepository
|
||||
import de.twomartens.timetable.model.base.Hour
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.model.db.TswRoute
|
||||
import de.twomartens.timetable.types.Hour
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import mu.KotlinLogging
|
||||
import org.springframework.stereotype.Service
|
||||
import java.time.LocalDate
|
||||
|
||||
+1
-1
@@ -6,8 +6,8 @@ import de.twomartens.timetable.bahnApi.repository.ScheduledFetchTaskRepository
|
||||
import de.twomartens.timetable.bahnApi.tasks.DeleteScheduledTask
|
||||
import de.twomartens.timetable.bahnApi.tasks.FetchTimetableTask
|
||||
import de.twomartens.timetable.bahnApi.tasks.StoreTimetableTask
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.property.TimeProperties
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package de.twomartens.timetable.bahnApi.tasks
|
||||
import de.twomartens.timetable.bahnApi.model.Eva
|
||||
import de.twomartens.timetable.bahnApi.service.BahnApiService
|
||||
import de.twomartens.timetable.bahnApi.service.TaskScheduler
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import mu.KotlinLogging
|
||||
import org.springframework.scheduling.annotation.Async
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package de.twomartens.timetable.bahnApi.tasks
|
||||
|
||||
import de.twomartens.timetable.bahnApi.model.dto.BahnTimetable
|
||||
import de.twomartens.timetable.bahnApi.service.BahnDatabaseService
|
||||
import de.twomartens.timetable.model.base.HourAtDay
|
||||
import de.twomartens.timetable.types.HourAtDay
|
||||
import mu.KotlinLogging
|
||||
import org.springframework.scheduling.annotation.Async
|
||||
|
||||
|
||||
+1
-1
@@ -1,9 +1,9 @@
|
||||
package de.twomartens.timetable.controller
|
||||
|
||||
import de.twomartens.timetable.bahnApi.service.ScheduledTaskService
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.model.db.UserId
|
||||
import de.twomartens.timetable.repository.TswRouteRepository
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import io.swagger.v3.oas.annotations.Operation
|
||||
import io.swagger.v3.oas.annotations.Parameter
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.PositiveInteger
|
||||
import de.twomartens.timetable.types.PositiveInteger
|
||||
|
||||
@JvmInline
|
||||
value class CoachCapacity(val capacity: PositiveInteger)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
|
||||
@JvmInline
|
||||
value class CountryCode(val countryCode: NonEmptyString) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import kotlin.time.Duration
|
||||
|
||||
data class Depot(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import org.bson.types.ObjectId
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.Id
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.PositiveInteger
|
||||
import de.twomartens.timetable.types.PositiveInteger
|
||||
|
||||
@JvmInline
|
||||
value class FormationId(val id: PositiveInteger)
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import kotlin.time.Duration
|
||||
|
||||
data class Portal(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
|
||||
@JvmInline
|
||||
value class Section(val name: NonEmptyString)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
|
||||
@JvmInline
|
||||
value class StationId(val id: NonEmptyString) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.PositiveInteger
|
||||
import de.twomartens.timetable.types.PositiveInteger
|
||||
|
||||
@JvmInline
|
||||
value class TrackId(val id: PositiveInteger)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import org.bson.types.ObjectId
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.Id
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import org.bson.types.ObjectId
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.Id
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package de.twomartens.timetable.model.db
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
|
||||
@JvmInline
|
||||
value class UserId(val id: NonEmptyString)
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package de.twomartens.timetable.repository
|
||||
|
||||
import de.twomartens.timetable.model.base.NonEmptyString
|
||||
import de.twomartens.timetable.model.db.TswRoute
|
||||
import de.twomartens.timetable.model.db.UserId
|
||||
import de.twomartens.timetable.types.NonEmptyString
|
||||
import org.bson.types.ObjectId
|
||||
import org.springframework.data.mongodb.repository.MongoRepository
|
||||
|
||||
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
package de.twomartens.timetable.support.configuration
|
||||
|
||||
import de.twomartens.timetable.property.RestTemplateTimeoutProperties
|
||||
import de.twomartens.timetable.support.interceptor.HeaderInterceptorRest
|
||||
import de.twomartens.timetable.support.interceptor.LoggingInterceptorRest
|
||||
import de.twomartens.timetable.property.RestTemplateTimeoutProperties
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
|
||||
|
||||
@ControllerAdvice(annotations = [RestController::class])
|
||||
class ExceptionController: ResponseEntityExceptionHandler() {
|
||||
class ExceptionController : ResponseEntityExceptionHandler() {
|
||||
@ExceptionHandler(HttpStatusException::class)
|
||||
fun handleException(e: HttpStatusException): ResponseEntity<ErrorMessage> {
|
||||
if (e.cause != null) {
|
||||
|
||||
+2
-1
@@ -65,7 +65,8 @@ class VersionHtmlController {
|
||||
JarFile(jarFileName).use { jarFile ->
|
||||
val entry = jarFile.getEntry(JarFile.MANIFEST_NAME)
|
||||
jarFile.getInputStream(entry).use { `in` ->
|
||||
return String(`in`.readAllBytes(), StandardCharsets.UTF_8).lines().toList() }
|
||||
return String(`in`.readAllBytes(), StandardCharsets.UTF_8).lines().toList()
|
||||
}
|
||||
}
|
||||
} catch (ignored: FileNotFoundException) {
|
||||
// do nothing if manifest file is not available
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package de.twomartens.timetable.support.exception
|
||||
|
||||
import org.springframework.http.HttpStatus
|
||||
|
||||
class HttpStatusException(val status: HttpStatus, message: String, cause: Throwable?):
|
||||
class HttpStatusException(val status: HttpStatus, message: String, cause: Throwable?) :
|
||||
RuntimeException(message, cause)
|
||||
+1
-1
@@ -8,7 +8,7 @@ import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
|
||||
class BufferingClientHttpResponseWrapper(private val response: ClientHttpResponse): ClientHttpResponse {
|
||||
class BufferingClientHttpResponseWrapper(private val response: ClientHttpResponse) : ClientHttpResponse {
|
||||
private var body: ByteArray? = null
|
||||
|
||||
@Throws(IOException::class)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package de.twomartens.timetable.support.monitoring.actuator
|
||||
|
||||
import de.twomartens.timetable.support.interceptor.HeaderInterceptorRest
|
||||
import de.twomartens.timetable.property.ServiceProperties
|
||||
import de.twomartens.timetable.support.interceptor.HeaderInterceptorRest
|
||||
import org.springframework.boot.actuate.health.Health
|
||||
import org.springframework.boot.actuate.health.HealthIndicator
|
||||
import org.springframework.boot.actuate.health.Status
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding
|
||||
import org.springframework.boot.convert.DurationUnit
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import java.time.Duration
|
||||
import java.time.temporal.ChronoUnit
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
val projectname: String = providers.gradleProperty("projectname").get()
|
||||
rootProject.name = projectname
|
||||
|
||||
include("common")
|
||||
include("server")
|
||||
include("deploy")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user