Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
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
package businessLogic;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.Vector;

import common.AdminInterface;

import dataAccess.DB4oManager;
import domain.Account;
import domain.Administrator;
import domain.Owner;
import domain.RuralHouse;

public class AdminManager extends UnicastRemoteObject implements AdminInterface {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public AdminManager() throws RemoteException {

	}

	public Vector<RuralHouse> getAdditionRequests() throws RemoteException {
		return new Vector<RuralHouse>(Administrator.getInstance()
				.getAddRequest());
	}

	public Vector<RuralHouse> getDeletionRequests() throws RemoteException {
		return new Vector<RuralHouse>(Administrator.getInstance()
				.getRemoveRequest());
	}

	public Vector<Account> getOwnerAdditionRequests() throws RemoteException {
		return new Vector<Account>(Administrator.getInstance()
				.getNewOwnerRequest());
	}

	public Vector<Owner> getAllOwners() throws RemoteException {
		try {
			return new Vector<Owner>(DB4oManager.getInstance().getOwners());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public void removeHouseAdditionRequests(RuralHouse house)
			throws RemoteException {
		Administrator.getInstance().getAddRequest().remove(house);
	}

	public void removeHouseDeletionRequests(RuralHouse house)
			throws RemoteException {
		Administrator.getInstance().getRemoveRequest().remove(house);
	}

	public void removeOwnerAdditionRequests(int index) throws RemoteException {
		Administrator.getInstance().getNewOwnerRequest().remove(index);
	}

	public boolean addAdditionRequest(RuralHouse rh) throws RemoteException {
		if (this.getAdditionRequests().contains(rh)
				|| !suitsRegulations(rh.getFeatures().getnKitchens(), rh
						.getFeatures().getnBaths(),rh
						.getFeatures().getnLivings())) {
			return false;
		}
		return Administrator.getInstance().getAddRequest().add(rh);

	}

	public boolean addDeletionRequest(RuralHouse rh) throws RemoteException {
		if (this.getDeletionRequests().contains(rh))
			return false;

		return Administrator.getInstance().getRemoveRequest().add(rh);

	}

	public boolean addAccountRequest(String usr, String pss, Owner ow)
			throws RemoteException {

		Account acc = new Account(usr, pss, ow);
		if (this.getOwnerAdditionRequests().contains(acc)) {
			return false;
		}
		return Administrator.getInstance().getNewOwnerRequest().add(acc);
	}

	@Override
	public void saveInstance() throws RemoteException {
		Administrator.saveInstance();

	}

	private boolean suitsRegulations(int nKitchens, int nBaths, int nLivings) {
		if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
			return false;
		else
			return true;
	}

	// public boolean removeAccount(Account acc) {
	// if (this.getDeletionRequests().contains(acc))
	// return false;
	// return Administrator.getInstance().getNewOwnerRequest().add(acc);
	// }
}

Commits for RRRRHHHH_CoderuralHouses/src/businessLogic/AdminManager.java

Diff revisions: vs.
Revision Author Commited Message
076d76 ... Diff Diff camjan Fri 22 May, 2015 22:22:23 +0000

The bug found in the presentation that we forgot to review has been fixed

ccac99 ... Diff Diff pinene picture pinene Wed 20 May, 2015 16:42:17 +0000

Merge branch ‘master’ of ssh://xp-dev.com/RRRRHHHH_Code

Conflicts:
ruralHouses client/src/domain/Owner.java
ruralHouses client/src/domain/RuralHouse.java
ruralHouses client/src/gui/BookRuralHouseConfirmationWindow.java
ruralHouses client/src/gui/ModifyOfferGUI.java
ruralHouses/src/dataAccess/DB4oManager.java
ruralHouses/src/domain/Booking.java

d30bcc ... Diff Diff pinene picture pinene Wed 20 May, 2015 16:32:33 +0000

cleaning

32ba0e ... Diff Diff camjan Wed 20 May, 2015 12:44:59 +0000

Now AdminManager gets the owner for removing them

ad3773 ... Diff Diff pinene picture pinene Tue 19 May, 2015 18:01:40 +0000

data now is gotten using queries

25898b ... Diff Diff camjan Mon 18 May, 2015 15:26:01 +0000

Account adding and deleting fixed

578bec ... Diff Diff epinzolas001 Mon 18 May, 2015 11:44:38 +0000

New owners now can be created properly.

799949 ... Diff Diff epinzolas001 Mon 18 May, 2015 11:12:36 +0000

debugging

4f8bcc ... Diff Diff epinzolas001 Mon 18 May, 2015 09:49:54 +0000

Merge conflicts solutioned

7bf57b ... camjan Sun 17 May, 2015 11:59:22 +0000

Possibility of registering new owners added