RRRRHHHH_Code
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 |
package businessLogic; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.sql.Date; import java.util.Vector; import common.OfferInterface; import dataAccess.DB4oManager; import domain.Offer; import domain.RuralHouse; import exceptions.BadDates; import exceptions.OverlappingOfferExists; public final class OfferManager extends UnicastRemoteObject implements OfferInterface{ /** * */ private static final long serialVersionUID = 1L; private int offerNumber = 0; dataAccess.DB4oManager dbMngr; public OfferManager() throws RemoteException { super(); try { this.dbMngr = DB4oManager.getInstance(); } catch (Exception e) { e.printStackTrace(); } } /** * This method creates an offer with a house number, first day, last day and price * * @param House * number, start day, last day and price * @return the created offer, or null, or an exception */ public Offer createOffer(RuralHouse ruralHouse, Date firstDay, Date lastDay, float price) throws OverlappingOfferExists, BadDates, RemoteException, Exception { if (firstDay.after(lastDay)||firstDay==null||lastDay==null) throw new BadDates(); boolean b = dbMngr.existsOverlappingOffer(ruralHouse,firstDay,lastDay); // The ruralHouse object in the client may not be updated if (!b) { dbMngr.createOffer(ruralHouse,firstDay,lastDay,price); return ruralHouse.createOffer(offerNumber, firstDay, lastDay, price); } return null; } public void deleteOffer(RuralHouse rh, Offer o) throws RemoteException, Exception{ rh.offers.removeElement(o); dbMngr.deleteOffer( o); } @Override public Vector<Offer> getRuralHouseOffers(RuralHouse rh) throws RemoteException { // TODO Auto-generated method stub return dbMngr.getRHsOffer(rh.getHouseName()); } } |
Commits for RRRRHHHH_CoderuralHouses/src/businessLogic/OfferManager.java
Revision | Author | Commited | Message |
---|---|---|---|
ad3773 ... Diff | pinene | Tue 19 May, 2015 18:01:40 +0000 | data now is gotten using queries |
799949 ... Diff | epinzolas001 | Mon 18 May, 2015 11:12:36 +0000 | debugging |
4f8bcc ... Diff | epinzolas001 | Mon 18 May, 2015 09:49:54 +0000 | Merge conflicts solutioned |
42679b ... Diff | pinene | Sun 19 Apr, 2015 14:18:02 +0000 | Merge branch ‘master’ of https://xp-dev.com/git/RRRRHHHH_Code Conflicts: |
520867 ... Diff | pinene | Sun 19 Apr, 2015 14:09:12 +0000 | tmp |
837fab ... Diff | Eneko Pinzolas Murua | Sat 18 Apr, 2015 14:09:49 +0000 | no warnings |
5761bc ... Diff | camjan | Wed 15 Apr, 2015 15:27:07 +0000 | Bugs when deleting houses and offers fixed and GUI’s adapated for empty cases |
e2ae30 ... Diff | Eneko Pinzolas Murua | Tue 14 Apr, 2015 15:07:35 +0000 | imports leaned |
64482a ... Diff | Eneko Pinzolas Murua | Sat 04 Apr, 2015 12:23:48 +0000 | DeleteOffers and Modify Offers completed, both logic and GUI |
95c4ff ... | pinene | Tue 10 Mar, 2015 18:36:52 +0000 | deleted: ruralHouses/hs_err_pid6014.log |