The cancelBooking method sets the status of a booking to CANCELLED. If an error occurs, the method throws a QuickCarRentalException.
|
You have opened the bean class QuickOrderProcessorBean in the Java Editor. |
1. Add the following code in the cancelBooking() method:
try { QuickBookingLocal booking = bookingHome.findByPrimaryKey(bookingId); booking.setStatus(Constants.STATUS_CANCELLED); } catch (FinderException e) { e.printStackTrace(); throw new QuickCarRentalException(e.getMessage()); }
|
2. Replace the default return value return null; with:
return bookingId + " cancelled.";
|
3. To add the import statements, choose Source → Organize Imports from the context menu.
4. If necessary, correct the formatting of these new lines of code.
5. Save the contents of the Editor.
You have completely implemented the business method cancelBooking.
Implementing the viewActiveBookings() Method