Skip to content

Commit 345114b

Browse files
chore: create room event class
1 parent c5062e0 commit 345114b

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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.presenter.event.model.roomevent;
10+
11+
import application.presenter.event.model.Event;
12+
import application.presenter.event.model.roomevent.payload.RoomEventPayload;
13+
14+
/**
15+
* Room environment conditions update event.
16+
* In addition to a normal {@link application.presenter.event.model.Event} it has the roomId and the roomType to which
17+
* the event refers.
18+
* @param <E> the type of the event payload.
19+
*/
20+
public class RoomEvent<E extends RoomEventPayload> implements Event<E> {
21+
private final String key;
22+
private final String roomId;
23+
private final RoomTypePayload roomType;
24+
private final E data;
25+
private final String dateTime;
26+
27+
/**
28+
* Default constructor.
29+
* @param key the key of the event.
30+
* @param roomId the room identification to which the event is related to.
31+
* @param roomType the room type to which the event is related to.
32+
* @param data the payload.
33+
* @param dateTime the date time of the event.
34+
*/
35+
public RoomEvent(
36+
final String key,
37+
final String roomId,
38+
final RoomTypePayload roomType,
39+
final E data,
40+
final String dateTime
41+
) {
42+
this.key = key;
43+
this.roomId = roomId;
44+
this.roomType = roomType;
45+
this.data = data;
46+
this.dateTime = dateTime;
47+
}
48+
49+
@Override
50+
public final String getKey() {
51+
return this.key;
52+
}
53+
54+
/**
55+
* Obtain the room id to which the event is related to.
56+
* @return the room id.
57+
*/
58+
public String getRoomId() {
59+
return this.roomId;
60+
}
61+
62+
/**
63+
* Obtain the room type to which the event is related to.
64+
* @return the room type.
65+
*/
66+
public RoomTypePayload getRoomType() {
67+
return this.roomType;
68+
}
69+
70+
@Override
71+
public final E getData() {
72+
return this.data;
73+
}
74+
75+
@Override
76+
public final String getDateTime() {
77+
return this.dateTime;
78+
}
79+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.presenter.event.model.roomevent;
10+
11+
/**
12+
* The type of the room described in the {@link RoomEvent}.
13+
*/
14+
public enum RoomTypePayload {
15+
/** Operating room. */
16+
OPERATING_ROOM,
17+
/** Pre operating room. */
18+
PRE_OPERATING_ROOM
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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.presenter.event.model.roomevent.payload;
10+
11+
/**
12+
* Interface that identify a data payload that is accepted inside a
13+
* {@link application.presenter.event.model.roomevent.RoomEvent}.
14+
*/
15+
public interface RoomEventPayload { }

0 commit comments

Comments
 (0)