RRRRHHHH_Code
e3043c3b5cbff18b2388a9c95c411cc60367000d
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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
package businessLogic; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.util.Date; import java.util.Vector; import javax.mail.MessagingException; import com.db4o.ObjectContainer; import com.db4o.ObjectSet; import common.BookingInterface; import dataAccess.DB4oManager; import domain.Booking; import domain.Client; import domain.RuralHouse; import exceptions.OfferCanNotBeBooked; public final class BookingManager extends UnicastRemoteObject implements BookingInterface { /** * */ private static final long serialVersionUID = 1L; private int bookingNumber = 0; dataAccess.DB4oManager dbMngr; private static BookingManager theBookingManager; public BookingManager() throws RemoteException { super(); try { this.dbMngr = DB4oManager.getInstance(); } catch (Exception e) { e.printStackTrace(); } } /** * This method returns the next Booking number * * @return the book number */ public int getNumber() throws RemoteException{ 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 * @throws RemoteException */ public BookingManager getInstance() throws RemoteException { 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 denyBooking(Booking b) throws RemoteException{ this.dbMngr.removeBooking(b); try { MailManager.getInstance().Send(b.getClient().getMailAccount(), "Your booking has not been accepted","We are sorry"); } catch (MessagingException e) { e.printStackTrace(); } } public void acceptBooking(Booking b) throws RemoteException{ b.getOffer().setBooked(true); b.getOffer().getBookings().clear(); b.getOffer().getBookings().add(b); this.dbMngr.acceptBooking(b.getOffer()); try { MailManager.getInstance().Send(b.getClient().getMailAccount(), "Your booking has been accepted","Here should be the bill"); } catch (MessagingException e) { e.printStackTrace(); } } /** * This method creates a book with a corresponding parameters * * @param First * day, last day, house number and telephone * @return a book */ public Vector<Booking> createBooking(RuralHouse ruralHouse, Date firstDate, Date lastDate, Client client) throws OfferCanNotBeBooked,RemoteException { return dbMngr.createBooking(ruralHouse, firstDate, lastDate, client); } } |
Commits for RRRRHHHH_CoderuralHouses/src/businessLogic/BookingManager.java
Revision | Author | Commited | Message |
---|---|---|---|
e3043c ... Diff | camjan | Wed 20 May, 2015 16:45:21 +0000 | Some bugs have been fixed |
4bc36b ... Diff | camjan | Tue 19 May, 2015 23:23:13 +0000 | Merge branch ‘master’ of https://xp-dev.com/git/RRRRHHHH_Code Conflicts: |
fca164 ... Diff | camjan | Tue 19 May, 2015 14:51:35 +0000 | Some improvements done, owner deletion started, some bugs remain there |
4f8bcc ... Diff | epinzolas001 | Mon 18 May, 2015 09:49:54 +0000 | Merge conflicts solutioned |
6a5d4d ... Diff | camjan | Sun 17 May, 2015 20:35:45 +0000 | Booking confirmation and e-mail service added. Some bugs to be solved. |
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 ... | Eneko Pinzolas Murua | Mon 09 Mar, 2015 13:02:33 +0000 | deleted aplicationFacade and imported it’s functions to specific business logics. |