Yes, the system you are creating does not interact with these numbers (like, they are not taken from a table that keeps the customers data). You just have to accept them, assuming that any 8 digit number provided is valid, you know? For instance, this is how the GUI of my project works: there's a JTable that shows all records in the database. There's an area that shows some data of the record that is selected in the JTable. When you click on any record, its data is shown in this area, which also has a JTextField where you insert any 8 digit number (it can be 98767433 or 16510200 or even 41610001! ). Then, when you click on the "Book Room" button, a JOptionPane.showConfirmDialog is shown, with some data of the room being booked, the number of the customer booking the room, and a phrase "Please make sure this information is correct. This action cannot be undone" (before you have this other doubt, I'll tell you now ). An "unbook" function is not required in this project (that is, updating the customer ID field so it is blank again), that's why I did not implement one (and another advice: stick to simplicity). When you confirm the booking of the room, the record is updated with that customer ID. Do not forget to make sure that the client updating that record has locked it first. You also have to check this in your delete method (note the comments of the lock method in your interface).
It must be composed exclusively with components from the Java Foundation Classes (Swing components).
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
It must present search results in a JTable.
It must allow the user to book a selected record, updating the database file accordingly.
I didn't use a swing worker / progress bar. I think it is important to keep the time a record is locked (the time between the calls to lock and unlock) as short as possible! I used a thin client approach, so everything is handled at the server (so not really necessary to have a progress bar).Do i need to put a progress (Swing worker) bar in user B's GUI showing something like 'The record is locking by other user' during user B is waiting for the lock or just let the program freezing? If I just choose let the program freezing (Because it is simple ), will I fail? Assuming user A takes a long time to finish the update.
If a record is booked by customerA it can NOT be booked by customerB. Otherwise different customers will be able to book the same room and i don't think customers will be happy if they appear at the hotel and it seems the room they booked is already taken.Do i need to show a warning dialog showing information like 'The record has been booked, Continue?' or just let User B overwrites update the record without any extract actions? If i choose let user B override the update without any extract actions (Because it is simple ), will I fail?
I didn't implement Observable pattern to refresh the information in my JTable. The table is refreshed with each find- and book-operation.I'll continue to use MVC design pattern to build my GUI, but it will only refresh the Jtable's information when user runs the find function. That means I don't apply the Observer design pattern in the MVC. Will I fail if I choose the routine?
The purpose of lock/unlock methods is preventing a record being overwritten by different threads. So why use these methods if you plan allowing overwriting booked records?The assignment doesn't neither request to display the least information in JTable when the Database has been updated or pervent user overwriting a booked record.
So that means that a record containing a customer-id is not for sale and thus can't be booked.The id value (an 8 digit number) of the customer who has booked this. Note that for this application, you should assume that customers and CSRs know their customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale.
But if you use thick client approach:
1/ user hits book-button, record is locked, dialog opens, user enters customer-id, user confirms dialog/booking and record is updated and unlocked
2/ user hits book-button, dialog opens, user enters customer-id, user confirms dialog/booking and record is locked, updated and unlocked
SCJP 6.0(95%), SCWCD 5(94%), SCJD (working on B&S v.2.3.1)
My Data class throws an IllegalStateException.What if the same client already has a lock and is trying to obtain another record's lock?
SCJP 6.0(95%), SCWCD 5(94%), SCJD (working on B&S v.2.3.1)
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|