transaction-script.urm.puml 2.0 KB
Newer Older
A
Ashish Trivedi 已提交
1 2
@startuml
package com.ashishtrivedi16.transaction-script {
A
Ashish Trivedi 已提交
3
  class App {
A
Ashish Trivedi 已提交
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
    - H2_DB_URL : String {static}
    - LOGGER : Logger {static}
    - addRooms(hotelDaoImpl : HotelDaoImpl) {static}
    - createDataSource() : DataSource {static}
    - createSchema(dataSource : DataSource) {static}
    - deleteSchema(dataSource : DataSource) {static}
    - getRoomsStatus(hotelDaoImpl : HotelDaoImpl) {static}
    - generateSampleRooms() : List<Room> {static}
    + main(args : String[]) {static}
  }
  class Room {
    - id: Int
    - roomType: String
    - price: Int
    - booked: Boolean
    + Customer(id : int, roomType : String, price: Int, booked: Boolean)
    + getId() : int
    + getRoomType() : String
    + getPrice() : Int
    + isBooked() : Boolean
    + setId(id : int)
    + setRoomType(roomType : String)
    + setPrice(price : Int)
    + setBooked(booked : boolean)
    + equals(that : Object) : boolean
    + hashCode() : int
    + toString() : String
  }
  interface HotelDao {
    + add(Room) : boolean {abstract}
    + delete(Room) : boolean {abstract}
    + getAll() : Stream<Room> {abstract}
    + getById(int) : Optional<Room> {abstract}
    + update(Room) : boolean {abstract}
  }
  class RoomSchemaSql {
    + CREATE_SCHEMA_SQL : String {static}
    + DELETE_SCHEMA_SQL : String {static}
    - RoomSchemaSql()
  }
  class HotelDaoImpl {
    - dataSource : DataSource
    + HotelDaoImpl(dataSource : DataSource)
    + add(room : Room) : boolean
    - createRoom(resultSet : ResultSet) : Room
    + delete(room : Room) : boolean
    + getAll() : Stream<Room>
    + getById(id : int) : Optional<Room>
    - getConnection() : Connection
    - mutedClose(connection : Connection, statement : PreparedStatement, resultSet : ResultSet)
    + update(room : Room) : boolean
  }
  class Hotel {
  - LOGGER : Logger {static}
  - hotelDao: HotelDaoImpl
  + Hotel(hotelDao: HotelDaoImpl)
  + bookRoom(roomNumber: Int)
  + cancelRoomBooking(roomNumber: Int)
  }
}
HotelDaoImpl ..|> HotelDao
@enduml