RRRRHHHH_Code
7bf57b2f0f2b3cf0ae9489a8204918762e64648e
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 75 76 77 78 79 80 81 82 83 84 |
package businessLogic; import java.util.Date; import java.util.Vector; import com.db4o.ObjectContainer; import com.db4o.ObjectSet; import dataAccess.DB4oManager; import domain.Booking; import domain.Offer; import domain.Owner; import domain.RuralHouse; import exceptions.OfferCanNotBeBooked; public final class BookingManager { private int bookingNumber = 0; dataAccess.DB4oManager dbMngr; private static BookingManager theBookingManager; public BookingManager() { try { this.dbMngr = DB4oManager.getInstance(); } catch (Exception e) { e.printStackTrace(); } } /** * This method returns the next Booking number * * @return the book number */ public static int getNumber() { ObjectContainer db = DB4oManager.getContainer(); BookingManager b = getInstance(); b.bookingNumber++; db.store(b); db.commit(); return b.bookingNumber; } /** * This method returns the instance of the BookingManager class * * @return the booking manager */ public static BookingManager getInstance() { ObjectContainer db = DB4oManager.getContainer(); BookingManager b = new BookingManager(); ObjectSet<BookingManager> result = db.queryByExample(b); if (!result.hasNext()) { theBookingManager = new BookingManager(); db.store(theBookingManager); db.commit(); } else theBookingManager = (BookingManager) result.next(); return theBookingManager; } public void removeBooking(Booking B) { // TODO } /** * This method creates a book with a corresponding parameters * * @param First * day, last day, house number and telephone * @return a book */ public Booking createBooking(RuralHouse ruralHouse, Date firstDate, Date lastDate, String bookTelephoneNumber) throws OfferCanNotBeBooked { return dbMngr.createBooking(ruralHouse, firstDate, lastDate, bookTelephoneNumber); } } |
Commits for RRRRHHHH_CoderuralHouses/src/businessLogic/BookingManager.java
Revision | Author | Commited | Message |
---|---|---|---|
7bf57b ... Diff | camjan | Sun 17 May, 2015 11:59:22 +0000 | Possibility of registering new owners added |
0f75b2 ... Diff | camjan | Sat 16 May, 2015 14:34:49 +0000 | Username is saved hashed and password hashed and salted |
520867 ... Diff | pinene | Sun 19 Apr, 2015 14:09:12 +0000 | tmp |
3e4f7e ... Diff | camjan | Wed 08 Apr, 2015 13:18:53 +0000 | New GUI for booking and querying availability |
e16868 ... Diff | Eneko Pinzolas Murua | Mon 09 Mar, 2015 13:02:33 +0000 | deleted aplicationFacade and imported it’s functions to specific business logics. |
e0d74d ... | unknown | Thu 26 Feb, 2015 19:24:02 +0000 | Given code uploaded |