Changes between Initial Version and Version 1 of PrototypeImplementation


Ignore:
Timestamp:
06/18/26 23:51:35 (2 days ago)
Author:
223091
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PrototypeImplementation

    v1 v1  
     1= Prototype Implementation =
     2
     3== Implemented use-cases ==
     4
     5This page documents the first application prototype for the Room Reservation System. The prototype is implemented as a Java console application that connects to the PostgreSQL database created in the previous phase. The goal of the prototype is not to represent a complete final application, but to demonstrate that the most important database usage scenarios from Phase P3 can be implemented and executed against the created database.
     6
     7The prototype implements the following selected use-cases:
     8
     9* [[UseCase0001PrototypeImplementation|UseCase0001PrototypeImplementation - Search available rooms]]
     10* [[UseCase0002PrototypeImplementation|UseCase0002PrototypeImplementation - Create reservation request]]
     11* [[UseCase0003PrototypeImplementation|UseCase0003PrototypeImplementation - Approve or reject reservation]]
     12
     13The implemented use-cases cover the main database operations needed by the system:
     14
     15* reading available rooms from the database;
     16* checking reservation availability for a selected date and time interval;
     17* creating a new reservation request;
     18* selecting users and rooms from lists instead of manually entering identifiers;
     19* approving a pending reservation;
     20* verifying the created and modified data in the PostgreSQL database.
     21
     22== Prototype overview ==
     23
     24The prototype is a simple command-line Java application. After starting the application, the user enters the database connection parameters, and the system connects to the PostgreSQL database through the SSH tunnel. If the connection is successful, the application displays a main menu with the implemented scenarios.
     25
     26[[Image(p4_connection_success.png, width=100%)]]
     27
     28The main menu contains the following options:
     29
     30* Search available rooms
     31* Create reservation request
     32* Approve or reject reservation
     33* Exit
     34
     35The application uses real SQL statements executed against the project schema named ''project''. The prototype uses the same database structure that was created in Phase P2 and the same use-case scenarios that were documented in Phase P3.
     36
     37== Implemented functionality ==
     38
     39=== Search available rooms ===
     40
     41The first implemented scenario allows a requester to search for available rooms for a selected date and time interval. The user enters the reservation date, start time, end time, minimum capacity, room type filter, and optional required equipment. The system reads rooms, buildings, equipment assigned to rooms, and existing reservations from the database and returns only rooms that satisfy the selected criteria and do not have an overlapping active reservation.
     42
     43Detailed documentation: [[UseCase0001PrototypeImplementation]]
     44
     45=== Create reservation request ===
     46
     47The second implemented scenario allows a requester to create a new reservation request. The user does not need to remember internal identifiers such as user_id or room_id. Instead, the application lists available users and available rooms, and the user selects values from the displayed lists. The system then inserts a new reservation record into the database with status ''pending''.
     48
     49Detailed documentation: [[UseCase0002PrototypeImplementation]]
     50
     51=== Approve or reject reservation ===
     52
     53The third implemented scenario allows an approver to review pending reservations and record an approval decision. The application lists pending reservations, allows the approver to select a reservation, and then records either an approved or rejected decision. The system updates the reservation status and inserts a corresponding approval record.
     54
     55Detailed documentation: [[UseCase0003PrototypeImplementation]]
     56
     57== Build and run instructions ==
     58
     59The instructions for compiling, configuring, running, and testing the prototype are documented on the following page:
     60
     61* [[BuildInstructions|BuildInstructions]]
     62
     63== Source code ==
     64
     65The source code of the prototype is prepared as a Java Maven project. The project contains the source code of the application and the required configuration for compiling and running it.
     66
     67The main source file of the prototype is:
     68
     69* ''src/main/java/mk/finki/roomreservation/App.java''
     70
     71The Maven configuration file is:
     72
     73* ''pom.xml''
     74
     75The application uses JDBC to connect to PostgreSQL and execute the SQL statements needed for the implemented scenarios.
     76
     77= Build Instructions =
     78
     79== Development environment description ==
     80
     81The prototype application is implemented as a Java console application using Maven. It connects to the PostgreSQL project database through an SSH tunnel. The application uses JDBC for database access.
     82
     83Required software:
     84
     85* Java JDK 21 or compatible newer Java version
     86* IntelliJ IDEA
     87* Maven
     88* PostgreSQL JDBC driver, included through Maven
     89* DBeaver, used for database verification
     90* SSH tunnel script provided through the EPRMS / Databases section
     91
     92The project structure is:
     93
     94{{{
     95room-reservation-prototype
     96├── pom.xml
     97├── README.md
     98└── src
     99└── main
     100└── java
     101└── mk
     102└── finki
     103└── roomreservation
     104└── App.java
     105}}}
     106
     107== Database connection requirements ==
     108
     109The application does not connect directly to the remote database server. The SSH tunnel must be started first. The provided tunnel script opens access to the PostgreSQL database through:
     110
     111{{{
     112localhost:9999
     113}}}
     114
     115The application uses the following JDBC URL:
     116
     117{{{
     118jdbc:postgresql://localhost:9999/db_202526z_va_prj_room_reservation
     119}}}
     120
     121The database username is:
     122
     123{{{
     124db_202526z_va_prj_room_reservation_owner
     125}}}
     126
     127The database password is the database user password assigned in the EPRMS system.
     128
     129Important: real passwords are not written in the source code or in this documentation. The password is entered manually when starting the application.
     130
     131== Starting the SSH tunnel ==
     132
     133Before starting the Java prototype, the SSH tunnel script must be started.
     134
     135Steps:
     136
     1371. Open the folder containing the provided tunnel script and ''plink''.
     1382. Open PowerShell or Command Prompt in that folder.
     1393. Start the tunnel script.
     1404. Enter the SSH tunnel parameters provided in the EPRMS system if they are not already configured in the script.
     1415. Keep the tunnel window open while the Java prototype is running.
     142
     143The tunnel must remain active during the entire test. If the tunnel window is closed, the Java application will lose access to the database.
     144
     145== Build instructions ==
     146
     147Open the project in IntelliJ IDEA.
     148
     1491. Open IntelliJ IDEA.
     1502. Choose ''Open'' and select the ''room-reservation-prototype'' project folder.
     1513. Make sure that the project SDK is set to Java JDK 21 or compatible.
     1524. Wait until Maven imports the project dependencies.
     1535. Open ''src/main/java/mk/finki/roomreservation/App.java''.
     1546. Run the ''App'' class.
     155
     156The project can also be compiled with Maven using:
     157
     158{{{
     159mvn clean package
     160}}}
     161
     162== Running the application ==
     163
     164After starting the application, the program asks for database connection parameters.
     165
     166Use the default database URL by pressing Enter:
     167
     168{{{
     169jdbc:postgresql://localhost:9999/db_202526z_va_prj_room_reservation
     170}}}
     171
     172Use the default database username by pressing Enter:
     173
     174{{{
     175db_202526z_va_prj_room_reservation_owner
     176}}}
     177
     178Enter the assigned database password manually when prompted.
     179
     180If the connection is successful, the application displays:
     181
     182{{{
     183Connected to database successfully.
     184}}}
     185
     186Then the main menu is shown:
     187
     188{{{
     189Main menu
     190
     1911. Search available rooms
     1922. Create reservation request
     1933. Approve or reject reservation
     1944. Exit
     195   Choose option:
     196   }}}
     197
     198== Testing instructions ==
     199
     200The prototype should be tested by executing the three implemented scenarios.
     201
     202=== Test 1: Search available rooms ===
     203
     204Select option:
     205
     206{{{
     2071
     208}}}
     209
     210Example input:
     211
     212{{{
     213Reservation date: 2026-03-01
     214Start time: 09:00
     215End time: 10:00
     216Minimum capacity: 1
     217Room type filter:
     218Required equipment name:
     219}}}
     220
     221Expected result:
     222
     223The system displays a list of available rooms with room code, type, capacity, building name, and address.
     224
     225=== Test 2: Create reservation request ===
     226
     227Select option:
     228
     229{{{
     2302
     231}}}
     232
     233Example input:
     234
     235{{{
     236Choose user number: 1
     237Reservation date: 2026-03-01
     238Start time: 09:00
     239End time: 10:00
     240Include room in reservation: y
     241Minimum capacity: 1
     242Room type filter:
     243Required equipment in room:
     244Choose room number: 3
     245Request additional/general equipment: n
     246}}}
     247
     248Expected result:
     249
     250The system creates a new reservation request and displays the generated reservation ID. The created reservation has status ''pending''.
     251
     252=== Test 3: Approve or reject reservation ===
     253
     254Select option:
     255
     256{{{
     2573
     258}}}
     259
     260Example input:
     261
     262{{{
     263Choose reservation number: 2
     264Choose approver number: 1
     265Choose decision: 1
     266Decision note: Approved after checking room availability.
     267}}}
     268
     269Expected result:
     270
     271The system saves the approval decision, updates the reservation status to ''approved'', and displays the final reservation details.
     272
     273== Database verification ==
     274
     275The result can be verified in DBeaver by executing the following SQL statements:
     276
     277{{{
     278SELECT *
     279FROM project.reservations
     280ORDER BY reservation_id DESC;
     281
     282SELECT *
     283FROM project.approvals
     284ORDER BY approval_id DESC;
     285}}}
     286
     287The created reservation should appear in the ''project.reservations'' table, and the approval decision should appear in the ''project.approvals'' table.
     288
     289== Notes ==
     290
     291The prototype is intentionally minimal. It demonstrates the essential database operations required for the selected use-cases, but it is not a complete production application. The completion and extension of the application can be done in later project phases.