5,7 → 5,8 |
* |
*/ |
|
import org.tela_botanica.client.interfaces.iRetourUtilisateur; |
import org.tela_botanica.client.CarnetEnLigneModele; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
|
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONBoolean; |
19,15 → 20,25 |
|
|
|
|
/** |
* Le modèle associé au DAO |
*/ |
private CarnetEnLigneModele carnetEnLigneModele = null ; |
|
/** |
* Constructeur |
*/ |
|
public UtilisateurAsynchroneDAO() { |
public UtilisateurAsynchroneDAO(CarnetEnLigneModele carnetEnLigneModele) { |
|
this.carnetEnLigneModele=carnetEnLigneModele; |
|
} |
|
|
|
|
/** |
* Methode de classe d'appel du service gestion identification |
* @param baseURL : URL du service |
34,11 → 45,11 |
* @param retour : methode appelle en retour d'appel |
*/ |
|
public void getUtilisateur(String baseURL, final iRetourUtilisateur retour) { |
public void getEtatUtilisateur(final Rafraichissable r) { |
|
// Recherche identifiant utilisateur identifie |
|
HTTPRequest.asyncGet(baseURL + "/User/", new ResponseTextHandler() { |
HTTPRequest.asyncGet(carnetEnLigneModele.getConfig().getServiceBaseUrl() + "/User/", new ResponseTextHandler() { |
|
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
51,7 → 62,7 |
boolean identifie = ((JSONBoolean) jsonArray.get(1)) |
.booleanValue(); // Drapeau leve si utilisateur |
// deja identifie |
retour.onRetour(new Utilisateur(identifiant, identifie)); |
r.rafraichir(new Utilisateur(identifiant, identifie),true); |
} |
} |
}); |
60,9 → 71,9 |
|
|
|
public void deconnecterUtilisateur(String baseURL, final iRetourUtilisateur retour, String user) { |
public void deconnecterUtilisateur(final Rafraichissable r, String user) { |
|
HTTPRequest.asyncGet(baseURL + "/User/" + user , |
HTTPRequest.asyncGet(carnetEnLigneModele.getConfig().getServiceBaseUrl()+ "/User/" + user , |
new ResponseTextHandler() { |
|
public void onCompletion(String str) { |
78,8 → 89,7 |
.booleanValue(); // Drapeau leve si utilisateur |
// deja identifie |
|
|
retour.onRetour(new Utilisateur(identifiant, identifie)); |
r.rafraichir(new Utilisateur(identifiant, identifie),true); |
} |
} |
}); |
87,9 → 97,9 |
|
|
|
public void connecteUtilisateur(String baseURL,final iRetourUtilisateur retour, String login, String password) { |
public void connecteUtilisateur (final Rafraichissable r, String login, String password) { |
|
HTTPRequest.asyncGet(baseURL + "/User/" + login + "/" + password , |
HTTPRequest.asyncGet(carnetEnLigneModele.getConfig().getServiceBaseUrl() + "/User/" + login + "/" + password , |
new ResponseTextHandler() { |
|
public void onCompletion(String str) { |
107,7 → 117,7 |
// deja identifie |
|
|
retour.onRetour(new Utilisateur(identifiant, identifie)); |
r.rafraichir(new Utilisateur(identifiant, identifie),true); |
} |
} |
}); |
114,4 → 124,7 |
|
} |
|
|
|
|
} |