Skip to content

Commit e3f0efd

Browse files
chore: create room database manager interface
1 parent 10bf92b commit e3f0efd

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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.manager
10+
11+
import entity.zone.Room
12+
import entity.zone.RoomID
13+
import java.util.Date
14+
15+
/**
16+
* This interface models the manager of the database for rooms.
17+
* In this way it is independent respect to the specific technology that is used,
18+
* having the only semantic dependency on the concept of db.
19+
*/
20+
interface RoomDatabaseManager {
21+
/**
22+
* Save a [room] inside the DB.
23+
* @return true if successfully stored, false otherwise.
24+
*/
25+
fun saveRoom(room: Room): Boolean
26+
27+
/**
28+
* Delete a room identified by its [roomId] from the DB.
29+
* @return true if successfully deleted, false otherwise.
30+
*/
31+
fun deleteRoom(roomId: RoomID): Boolean
32+
33+
/**
34+
* Get a room identified by its [roomId] from the DB.
35+
* Specify a past [dateTime] in order to get historical data.
36+
* @return null if data is not available, the room instead.
37+
*/
38+
fun findBy(roomId: RoomID, dateTime: Date): Room?
39+
}

0 commit comments

Comments
 (0)