RRRRHHHH_Code
Diff Revisions
e0d74d ...
vs
e16868 ...
for ruralHouses/src/businessLogic/BookingManager.java
|
@@ -1,9 +1,14 @@ |
1 |
1 |
|
package businessLogic; |
2 |
2 |
|
|
|
3 |
+ |
import java.sql.Date; |
|
4 |
+ |
|
3 |
5 |
|
import com.db4o.ObjectContainer; |
4 |
6 |
|
import com.db4o.ObjectSet; |
5 |
7 |
|
|
6 |
8 |
|
import dataAccess.DB4oManager; |
|
9 |
+ |
import domain.Booking; |
|
10 |
+ |
import domain.RuralHouse; |
|
11 |
+ |
import exceptions.OfferCanNotBeBooked; |
7 |
12 |
|
|
8 |
13 |
|
|
9 |
14 |
|
public final class BookingManager { |
|
@@ -13,7 +18,13 @@ |
13 |
18 |
|
|
14 |
19 |
|
private static BookingManager theBookingManager; |
15 |
20 |
|
|
16 |
|
- |
private BookingManager() {} |
|
21 |
+ |
public BookingManager() { |
|
22 |
+ |
try { |
|
23 |
+ |
this.dbMngr = DB4oManager.getInstance(); |
|
24 |
+ |
} catch (Exception e) { |
|
25 |
+ |
e.printStackTrace(); |
|
26 |
+ |
} |
|
27 |
+ |
} |
17 |
28 |
|
|
18 |
29 |
|
/** |
19 |
30 |
|
* This method returns the next Booking number |
|
@@ -46,4 +57,17 @@ |
46 |
57 |
|
return theBookingManager; |
47 |
58 |
|
} |
48 |
59 |
|
|
|
60 |
+ |
/** |
|
61 |
+ |
* This method creates a book with a corresponding parameters |
|
62 |
+ |
* |
|
63 |
+ |
* @param First |
|
64 |
+ |
* day, last day, house number and telephone |
|
65 |
+ |
* @return a book |
|
66 |
+ |
*/ |
|
67 |
+ |
public Booking createBooking(RuralHouse ruralHouse, Date firstDate, Date lastDate, String bookTelephoneNumber) |
|
68 |
+ |
throws OfferCanNotBeBooked { |
|
69 |
+ |
|
|
70 |
+ |
return dbMngr.createBooking(ruralHouse,firstDate,lastDate,bookTelephoneNumber); |
|
71 |
+ |
} |
|
72 |
+ |
|
49 |
73 |
|
} |