File tree 2 files changed +20
-6
lines changed
src/main/kotlin/application/controller
2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ package application.controller
10
10
11
11
import application.controller.manager.RoomDatabaseManager
12
12
import application.controller.manager.RoomDigitalTwinManager
13
+ import application.controller.util.rollback
13
14
import entity.zone.Room
14
15
import entity.zone.RoomID
15
16
import usecase.repository.RoomRepository
@@ -43,10 +44,4 @@ class RoomController(
43
44
}
44
45
45
46
override fun getRooms (): Set <Room > = this .roomDatabaseManager.getAllRooms()
46
-
47
- private fun Boolean.rollback (rollbackActions : () -> Unit ): Boolean =
48
- if (! this ) {
49
- rollbackActions()
50
- false
51
- } else true
52
47
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2023. Smart Operating Block
3
+ *
4
+ * Use of this source code is governed by an MIT-style
5
+ * license that can be found in the LICENSE file or at
6
+ * https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ package application.controller.util
10
+
11
+ /* *
12
+ * Extension method used with methods that return a boolean result status
13
+ * that allows to perform [rollbackActions] when it returns false.
14
+ */
15
+ fun Boolean.rollback (rollbackActions : () -> Unit ): Boolean =
16
+ if (! this ) {
17
+ rollbackActions()
18
+ false
19
+ } else true
You can’t perform that action at this time.
0 commit comments