import java.rmi.RemoteException;
import domain.Account;
+import domain.Owner;
public interface AccountInterface extends Remote{
import java.util.Vector;
import domain.Account;
+import domain.Owner;
import domain.RuralHouse;
public interface AdminInterface extends Remote {
public boolean addDeletionRequest(RuralHouse rh) throws RemoteException ;
- public boolean addAccount(Account acc) throws RemoteException ;
+ public boolean addAccountRequest(String usr,
+ String pss, Owner ow) throws RemoteException;
public void saveInstance() throws RemoteException;
private boolean admin = false;
- public Account(String usr){
-
-
- }
- public Account(String usr, String pass, boolean isAdmin) {
-
-
- }
-
- public Account(String usr, String pass, Owner ow) {
-
-
- }
+
public byte[] getUsername() {
return username;
this.setSize(new Dimension(513, 433));
this.setTitle("Set availability");
+ OfferInterface om = null;
+
jComboBox1 = new JComboBox<RuralHouse>(v);
comboBox_o = new JComboBox<Offer>(
this.bank1Field.getText() + " " + this.bank2Field.getText()
+ " " + this.bank3Field.getText() + " "
+ this.bank4Field.getText(), this.emailField.getText());
- Account acc = new Account(this.userNameField.getText(),
- this.passField.getText(), own);
+
try {
- if (this.am.addAccount(acc)) {
+ if (this.am.addAccountRequest(this.userNameField.getText(),
+ this.passField.getText(), own)) {
+ this.am.saveInstance();
this.feedback.setText("Request sended");
} else {
this.feedback.setText("Can't send the request");
try {
if(am.addDeletionRequest(toDel)){
+ am.saveInstance();
feedback.setText("Delete request sended");
}else{
try {
if(am.addAdditionRequest(rh)){
+ am.saveInstance();
feedback.setText("Request sended");
}else{
feedback.setText("Request cannot be sended(Already added)");
import java.util.Vector;
import common.AdminInterface;
-
import domain.Account;
import domain.Administrator;
+import domain.Owner;
import domain.RuralHouse;
public class AdminManager extends UnicastRemoteObject implements AdminInterface {
}
-
- public boolean addAccount(Account acc) throws RemoteException {
+ 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;
}
+
// public boolean removeAccount(Account acc) {
// if (this.getDeletionRequests().contains(acc))
// return false;
public Vector<RuralHouse> getHouses(String name,String town, int nBed, int nKit,
int nBath, int nPark, int nLiv) {
- return this.dbMngr.getRuralHouses(name ,town, nBed, nKit, nBath, nPark, nLiv);
+ return this.dbMngr.getRuralHouses( name ,town, nBed, nKit, nBath, nPark, nLiv);
}
@Override
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;
dbMngr.deleteOffer( o);
}
+
+
+ @Override
+ public Vector<RuralHouse> getRuralHouseOffers(RuralHouse rh)
+ throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
import java.util.Vector;
import domain.Account;
+import domain.Owner;
import domain.RuralHouse;
public interface AdminInterface extends Remote {
public boolean addDeletionRequest(RuralHouse rh) throws RemoteException ;
- public boolean addAccount(Account acc) throws RemoteException ;
+ public boolean addAccountRequest(String usr,
+ String pss, Owner ow) throws RemoteException;
public void saveInstance() throws RemoteException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.sql.Date;
+import java.util.Vector;
import domain.Offer;
import domain.RuralHouse;
public void deleteOffer(RuralHouse rh, Offer o) throws RemoteException,
Exception;
+
+ public Vector<RuralHouse> getRuralHouseOffers(RuralHouse rh)throws RemoteException;
}
Account admin = new Account("admin", "admin", true);
db.store(Administrator.getInstance());
-
db.store(jonAcc);
db.store(alfredoAcc);
db.store(admin);
/**
*
*/
- BEA("Beatriz"), GUA("Guazate"), VEG("Vegas"), FAR("Farallón"), CED("Cedro"), MOT(
- "Monte LLano"), RIN("Rincón"), PUE("Pueblo"), QUA("Quebrada Arriba"), QEB(
- "Quebrada Abajo"), TOI("Toita"), MAB("Matón Abajo"), MAA(
- "Matón Arriba"), PIE("Piedras"), PAV("Pasto Viejo"), PEA(
+ BEA("Beatriz"), GUA("Guazate"), VEG("Vegas"), FAR("Farallón"), CED("Cedro"), MOT(
+ "Monte LLano"), RIN("Rincón"), PUE("Pueblo"), QUA("Quebrada Arriba"), QEB(
+ "Quebrada Abajo"), TOI("Toita"), MAB("Matón Abajo"), MAA(
+ "Matón Arriba"), PIE("Piedras"), PAV("Pasto Viejo"), PEA(
"PedroAvila"), SUM("Sumido"), LAP("Lapa"), CER("Cercadillo"), JAJ(
- "JájomeAlto"), CUL("CulebrasAbajo");
+ "JójomeAlto"), CUL("CulebrasAbajo");
private static final long serialVersionUID = 1L;