RRRRHHHH_Code
Diff Revisions
c92b61 ...
vs
d30bcc ...
for ruralHouses/src/businessLogic/BookingManager.java
|
@@ -23,10 +23,8 @@ |
23 |
23 |
|
* |
24 |
24 |
|
*/ |
25 |
25 |
|
private static final long serialVersionUID = 1L; |
26 |
|
- |
private int bookingNumber = 0; |
27 |
26 |
|
dataAccess.DB4oManager dbMngr; |
28 |
27 |
|
|
29 |
|
- |
private static BookingManager theBookingManager; |
30 |
28 |
|
|
31 |
29 |
|
public BookingManager() throws RemoteException { |
32 |
30 |
|
super(); |
|
@@ -37,39 +35,7 @@ |
37 |
35 |
|
} |
38 |
36 |
|
} |
39 |
37 |
|
|
40 |
|
- |
/** |
41 |
|
- |
* This method returns the next Booking number |
42 |
|
- |
* |
43 |
|
- |
* @return the book number |
44 |
|
- |
*/ |
45 |
|
- |
|
46 |
|
- |
public int getNumber() throws RemoteException{ |
47 |
|
- |
ObjectContainer db=DB4oManager.getContainer(); |
48 |
|
- |
BookingManager b=getInstance(); |
49 |
|
- |
b.bookingNumber++; |
50 |
|
- |
db.store(b); |
51 |
|
- |
db.commit(); |
52 |
|
- |
return b.bookingNumber; |
53 |
|
- |
} |
54 |
38 |
|
|
55 |
|
- |
/** |
56 |
|
- |
* This method returns the instance of the BookingManager class |
57 |
|
- |
* |
58 |
|
- |
* @return the booking manager |
59 |
|
- |
* @throws RemoteException |
60 |
|
- |
*/ |
61 |
|
- |
|
62 |
|
- |
public BookingManager getInstance() throws RemoteException { |
63 |
|
- |
ObjectContainer db=DB4oManager.getContainer(); |
64 |
|
- |
BookingManager b = new BookingManager(); |
65 |
|
- |
ObjectSet<BookingManager> result = db.queryByExample(b); |
66 |
|
- |
if (!result.hasNext()){ |
67 |
|
- |
theBookingManager = new BookingManager(); |
68 |
|
- |
db.store(theBookingManager); |
69 |
|
- |
db.commit(); |
70 |
|
- |
} else theBookingManager=(BookingManager)result.next(); |
71 |
|
- |
return theBookingManager; |
72 |
|
- |
} |
73 |
39 |
|
|
74 |
40 |
|
public void removeDenyBooking(Booking b) throws RemoteException{ |
75 |
41 |
|
b.getOffer().getBookings().remove(b); |