Skip to content

Commit 9a96f34

Browse files
AndreaGiulianellimergify[bot]
authored andcommitted
style: correct code formatting and style due to kotlin-qa update
1 parent d56fc0b commit 9a96f34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+208
-180
lines changed

src/main/kotlin/application/controller/MedicalTechnologyController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import java.time.Instant
2525
*/
2626
class MedicalTechnologyController(
2727
private val digitalTwinManager: MedicalTechnologyDigitalTwinManager,
28-
private val databaseManager: MedicalTechnologyDatabaseManager
28+
private val databaseManager: MedicalTechnologyDatabaseManager,
2929
) : MedicalTechnologyRepository {
3030
override fun createMedicalTechnology(medicalTechnology: MedicalTechnology): MedicalTechnology? = (
3131
this.digitalTwinManager.createMedicalTechnologyDigitalTwin(medicalTechnology) &&

src/main/kotlin/application/controller/RoomController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import java.time.Instant
2525
*/
2626
class RoomController(
2727
private val roomDtManager: RoomDigitalTwinManager,
28-
private val roomDatabaseManager: RoomDatabaseManager
28+
private val roomDatabaseManager: RoomDatabaseManager,
2929
) : RoomRepository {
3030
override fun createRoom(room: Room): Room? = (
3131
this.roomDtManager.createRoomDigitalTwin(room) &&

src/main/kotlin/application/controller/manager/MedicalTechnologyDatabaseManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ interface MedicalTechnologyDatabaseManager {
5454
medicalTechnologyId: MedicalTechnologyID,
5555
usage: Boolean,
5656
roomId: RoomID,
57-
dateTime: Instant
57+
dateTime: Instant,
5858
): Boolean
5959
}

src/main/kotlin/application/controller/manager/RoomDatabaseManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ interface RoomDatabaseManager {
4646
fun getRoomEnvironmentalData(
4747
roomId: RoomID,
4848
start: Instant,
49-
end: Instant
49+
end: Instant,
5050
): List<Pair<Instant, RoomEnvironmentalData>>?
5151

5252
/**
@@ -62,6 +62,6 @@ interface RoomDatabaseManager {
6262
fun updateRoomEnvironmentalData(
6363
roomId: RoomID,
6464
environmentalData: RoomEnvironmentalData,
65-
dateTime: Instant
65+
dateTime: Instant,
6666
): Boolean
6767
}

src/main/kotlin/application/controller/util/Rollback.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ fun Boolean.rollback(rollbackActions: () -> Unit): Boolean =
1616
if (!this) {
1717
rollbackActions()
1818
false
19-
} else true
19+
} else {
20+
true
21+
}

src/main/kotlin/application/handler/EventHandlers.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object EventHandlers {
4040
updateRoomEnvironmentData(
4141
this,
4242
RoomEnvironmentalData(temperature = this.data.toTemperature()),
43-
this@TemperatureEventHandler.roomRepository
43+
this@TemperatureEventHandler.roomRepository,
4444
)
4545
}
4646
}
@@ -57,7 +57,7 @@ object EventHandlers {
5757
updateRoomEnvironmentData(
5858
this,
5959
RoomEnvironmentalData(humidity = this.data.toHumidity()),
60-
this@HumidityEventHandler.roomRepository
60+
this@HumidityEventHandler.roomRepository,
6161
)
6262
}
6363
}
@@ -74,7 +74,7 @@ object EventHandlers {
7474
updateRoomEnvironmentData(
7575
this,
7676
RoomEnvironmentalData(luminosity = this.data.toLuminosity()),
77-
this@LuminosityEventHandler.roomRepository
77+
this@LuminosityEventHandler.roomRepository,
7878
)
7979
}
8080
}
@@ -91,15 +91,15 @@ object EventHandlers {
9191
updateRoomEnvironmentData(
9292
this,
9393
RoomEnvironmentalData(presence = this.data.toPresence()),
94-
this@PresenceEventHandler.roomRepository
94+
this@PresenceEventHandler.roomRepository,
9595
)
9696
}
9797
}
9898
}
9999

100100
/** Event handler for medical technology usage update event. */
101101
class MedicalTechnologyEventHandler(
102-
private val medicalTechnologyRepository: MedicalTechnologyRepository
102+
private val medicalTechnologyRepository: MedicalTechnologyRepository,
103103
) : EventHandler {
104104
override fun canHandle(event: Event<*>): Boolean = event is MedicalTechnologyEvent
105105

@@ -109,7 +109,7 @@ object EventHandlers {
109109
MedicalTechnologyID(this.data.medicalTechnologyID),
110110
this.data.inUse,
111111
Instant.parse(this.dateTime),
112-
medicalTechnologyRepository
112+
medicalTechnologyRepository,
113113
).execute()
114114
}
115115
}
@@ -118,16 +118,18 @@ object EventHandlers {
118118
private fun updateRoomEnvironmentData(
119119
event: RoomEvent<*>,
120120
environmentalData: RoomEnvironmentalData,
121-
roomRepository: RoomRepository
121+
roomRepository: RoomRepository,
122122
) =
123123
RoomService.UpdateRoomEnvironmentData(
124124
RoomID(event.roomId),
125125
environmentalData,
126126
Instant.parse(event.dateTime),
127-
roomRepository
127+
roomRepository,
128128
).execute()
129129

130130
private inline fun <reified T> Any?.cast(operation: T.() -> Boolean = { true }): Boolean = if (this is T) {
131131
operation()
132-
} else false
132+
} else {
133+
false
134+
}
133135
}

src/main/kotlin/application/presenter/api/deserializer/ApiDeserializer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object ApiDeserializer {
3131
id = RoomID(this.id),
3232
type = this.type.toRoomType(),
3333
zoneId = ZoneID(this.zoneId),
34-
name = this.name
34+
name = this.name,
3535
)
3636

3737
private fun RoomApiDtoType.toRoomType() = when (this) {
@@ -46,7 +46,7 @@ object ApiDeserializer {
4646
id = MedicalTechnologyID(this.id),
4747
name = this.name,
4848
description = this.description,
49-
type = this.type.toMedicalTechnologyType()
49+
type = this.type.toMedicalTechnologyType(),
5050
)
5151

5252
private fun MedicalTechnologyApiDtoType.toMedicalTechnologyType() = when (this) {

src/main/kotlin/application/presenter/api/model/MedicalTechnologyApiDto.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ data class MedicalTechnologyApiDto(
2121
val description: String,
2222
val type: MedicalTechnologyApiDtoType,
2323
val inUse: Boolean = false,
24-
val roomId: String? = null
24+
val roomId: String? = null,
2525
)
2626

2727
/**
@@ -33,7 +33,7 @@ data class MedicalTechnologyEntry(
3333
val id: String,
3434
val name: String,
3535
val description: String,
36-
val type: MedicalTechnologyApiDtoType
36+
val type: MedicalTechnologyApiDtoType,
3737
)
3838

3939
/**

src/main/kotlin/application/presenter/api/model/RoomApiDto.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ data class RoomApiDto(
2020
val name: String,
2121
val zoneId: String,
2222
val type: RoomApiDtoType,
23-
val environmentalData: EnvironmentalDataApiDto = EnvironmentalDataApiDto()
23+
val environmentalData: EnvironmentalDataApiDto = EnvironmentalDataApiDto(),
2424
)
2525

2626
/**
@@ -32,7 +32,7 @@ data class RoomEntry(
3232
val id: String,
3333
val name: String,
3434
val zoneId: String,
35-
val type: RoomApiDtoType
35+
val type: RoomApiDtoType,
3636
)
3737

3838
/**
@@ -42,8 +42,9 @@ data class RoomEntry(
4242
enum class RoomApiDtoType {
4343
/** Operating room type. */
4444
OPERATING_ROOM,
45+
4546
/** Pre-operating room type. */
46-
PRE_OPERATING_ROOM
47+
PRE_OPERATING_ROOM,
4748
}
4849

4950
/**
@@ -67,5 +68,5 @@ data class EnvironmentalDataApiDto(
6768
val temperature: ValueWithUnit<Double>? = null,
6869
val humidity: Double? = null,
6970
val luminosity: ValueWithUnit<Double>? = null,
70-
val presence: Boolean? = null
71+
val presence: Boolean? = null,
7172
)

src/main/kotlin/application/presenter/api/serializer/ApiSerializer.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object ApiSerializer {
3333
id = this.id.value,
3434
name = this.name.orEmpty(),
3535
zoneId = this.zoneId.value,
36-
type = this.type.toRoomApiDtoType()
36+
type = this.type.toRoomApiDtoType(),
3737
)
3838

3939
/**
@@ -44,14 +44,14 @@ object ApiSerializer {
4444
name = this.name.orEmpty(),
4545
zoneId = this.zoneId.value,
4646
type = this.type.toRoomApiDtoType(),
47-
environmentalData = this.environmentalData.toEnvironmentDataApiDto()
47+
environmentalData = this.environmentalData.toEnvironmentDataApiDto(),
4848
)
4949

5050
private fun RoomEnvironmentalData.toEnvironmentDataApiDto() = EnvironmentalDataApiDto(
5151
temperature = this.temperature?.let { ValueWithUnit(it.value, it.unit.toString()) },
5252
humidity = this.humidity?.percentage,
5353
luminosity = this.luminosity?.let { ValueWithUnit(it.value, it.unit.toString()) },
54-
presence = this.presence?.presenceDetected
54+
presence = this.presence?.presenceDetected,
5555
)
5656

5757
private fun RoomType.toRoomApiDtoType() = when (this) {
@@ -69,7 +69,7 @@ object ApiSerializer {
6969
description = this.description,
7070
type = this.type.toMedicalTechnologyApiDtoType(),
7171
inUse = this.isInUse,
72-
roomId = this.roomId?.value
72+
roomId = this.roomId?.value,
7373
)
7474

7575
private fun MedicalTechnologyType.toMedicalTechnologyApiDtoType() = when (this) {

0 commit comments

Comments
 (0)