-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestaurantClassDiagramOCL.puml
74 lines (62 loc) · 2 KB
/
RestaurantClassDiagramOCL.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@startuml
class User {
- userID: String
- name: String
- email: String
- password: String
+ register(): void
+ login(): void
+ logout(): void
}
class Customer extends User {
+ viewTables(): void
+ makeReservation(): void
+ modifyReservation(): void
+ cancelReservation(): void
}
class Staff extends User {
- staffID: String
- role: String
+ manageReservations(): void
+ updateTableAvailability(): void
}
class Reservation {
- reservationID: String
- date: Date
- time: Time
- specialRequests: String
+ createReservation(): void
+ modifyReservation(): void
+ cancelReservation(): void
}
class Table {
- tableID: String
- capacity: int
- isAvailable: boolean
+ updateAvailability(): void
}
note right of Reservation
A reservation must be associated with a table that is available.
inv: self.table.isAvailable = true
A reservation must have a valid date and time.
inv: self.date <> null and self.time <> null
end note
note right of Table
A table cannot be reserved if it is not available.
inv: self.isAvailable = true implies self.reservations->size() = 0
end note
note right of Customer
A customer cannot make a reservation if they are logged out.
inv: self.isLoggedIn() implies self.makeReservation() = true
end note
note right of User
Password must be at least 8 characters long, contain at least one uppercase letter, one lowercase letter, and one number.
inv: self.password.length() >= 8 and self.password.matches('[a-zA-Z0-9]*') and self.password.matches('.*[A-Z].*') and self.password.matches('.*[0-9].*')
Email must follow a valid format.
inv: self.email.matches('[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}')
end note
User "1" --> "0..*" Reservation
Reservation "1" --> "1" Table
Staff "1" --> "0..*" Table
Staff "1" --> "0..*" Reservation
@enduml