/trunk/src/org/tela_botanica/client/modeles/dao/ImageGeneriqueVueAsynchroneDAO.java |
---|
40,13 → 40,13 |
* @param numeroNomenclaturalSaisiObservation |
*/ |
public void obtenirURLImage(final Rafraichissable r, String numeroNomenclaturalSaisiObservation) { |
public void obtenirURLImage(final Rafraichissable r, String referentielTaxo, String numeroNomenclaturalSaisiObservation) { |
String referentielDefaut = Configuration.getReferentielsDispos().get(0).getCode(); |
referentielTaxo = (referentielTaxo != null && !referentielTaxo.isEmpty()) ? referentielTaxo : referentielDefaut; |
// on envoie le get asynchrone |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,Configuration.getServiceBaseUrl() |
+"/NameImage/"+numeroNomenclaturalSaisiObservation) ; |
+"/NameImage/"+referentielTaxo+"/"+numeroNomenclaturalSaisiObservation) ; |
try { |
rb.sendRequest(null, new RequestCallback() { |
/trunk/src/org/tela_botanica/client/modeles/dao/ImageInformationRepartitionAsynchroneDAO.java |
---|
40,13 → 40,14 |
* @param numeroNomenclaturalSaisiObservation |
*/ |
public void obtenirURLImage(final Rafraichissable r, String numeroNomenclaturalSaisiObservation) { |
public void obtenirURLImage(final Rafraichissable r, String referentielTaxo, String numeroNomenclaturalSaisiObservation) { |
String referentielDefaut = Configuration.getReferentielsDispos().get(0).getCode(); |
referentielTaxo = (referentielTaxo != null && !referentielTaxo.isEmpty()) ? referentielTaxo : referentielDefaut; |
// on envoie le get asynchrone |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,Configuration.getServiceBaseUrl() |
+"/NameMap/"+numeroNomenclaturalSaisiObservation) ; |
+"/NameMap/"+referentielTaxo+"/"+numeroNomenclaturalSaisiObservation) ; |
try { |
rb.sendRequest(null, new RequestCallback() { |
/trunk/src/org/tela_botanica/client/modeles/dao/ListeReferentielNomAsynchroneDAO.java |
---|
56,16 → 56,11 |
* @param r le rafraichissable qui demande la mise à jour |
* @param criteres un string contenant le terme a rechercher |
*/ |
@Override |
public void obtenirListeDonnees(final Rafraichissable r, final String critere) |
public void obtenirListeDonnees(final Rafraichissable r,final String referentiel, final String critere) |
{ |
ListeReferentielNom referentielNomDataFromCache=null; |
// En cache ? |
if ((referentielNomDataFromCache=getFromCache(critere))!=null) { |
r.rafraichir(referentielNomDataFromCache,true); |
76,7 → 71,7 |
// On vérifie si un genre et une espèce sont demandées |
// et ajoute le / manuellement car sinon il devient urlencode |
String[] criteres =critere.split("/"); |
String urlParams = "/NameSearch/"; |
String urlParams = "/NameSearch/"+referentiel+"/"; |
if(criteres.length > 1) { |
String critere1 = criteres[0]; |
String critere2 = criteres[1]; |
143,14 → 138,16 |
} |
private void addToCache(String query, ListeReferentielNom result) { |
cache.put(query.toLowerCase(),result); |
} |
@Override |
public void obtenirListeDonnees(Rafraichissable r, String critere) { |
obtenirListeDonnees(r, "bdtfx", critere); |
} |
private void addToCache(String query, ListeReferentielNom result) { |
cache.put(query.toLowerCase(),result); |
} |
private ListeReferentielNom getFromCache (String query) { |
return cache.get(query.toLowerCase()); |
} |
private ListeReferentielNom getFromCache (String query) { |
return cache.get(query.toLowerCase()); |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/dao/ListeReferentielCommuneAsynchroneDAO.java |
---|
76,73 → 76,71 |
} |
else { |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, Configuration.getServiceBaseUrl() + "/LocationSearch/" + URL.encodeComponent(critere)); |
try { |
rb.sendRequest(null, new RequestCallback() { |
@Override |
public void onError(final Request request, final Throwable exception) { |
// TODO Auto-generated method stub |
} |
@Override |
public void onResponseReceived(final Request request, |
final Response response) { |
final ListeReferentielCommune referentielCommuneData; |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
JSONArray reponse = null; |
// si c'est un tableau |
if ((reponse = responseValue.isArray()) != null) { |
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, Configuration.getServiceBaseUrl() + "/LocationSearch/" + URL.encodeComponent(critere)); |
try { |
rb.sendRequest(null, new RequestCallback() { |
@Override |
public void onError(final Request request, final Throwable exception) { |
// TODO Auto-generated method stub |
JSONArray communes; |
final int taillemax = reponse.size(); |
} |
@Override |
public void onResponseReceived(final Request request, |
final Response response) { |
referentielCommuneData = new ListeReferentielCommune(taillemax); |
final ListeReferentielCommune referentielCommuneData; |
final JSONValue responseValue = JSONParser.parse(response.getText()); |
JSONArray reponse = null; |
// si c'est un tableau |
if ((reponse = responseValue.isArray()) != null) { |
JSONArray communes; |
final int taillemax = reponse.size(); |
referentielCommuneData = new ListeReferentielCommune(taillemax); |
for (int i = 0; i < taillemax; i++) { |
if ((communes = reponse.get(i).isArray()) != null) { |
String commune = ((JSONString) communes.get(0)).stringValue(); |
String departement = ((JSONString) communes.get(1)).stringValue(); |
ReferentielCommune com = new ReferentielCommune(commune, departement); |
referentielCommuneData.put(com.getCommune() + com.getDepartement(), com); |
} |
} |
} else { |
referentielCommuneData = new ListeReferentielCommune(0); |
} |
addToCache(critere, referentielCommuneData); |
r.rafraichir(referentielCommuneData, true); |
for (int i = 0; i < taillemax; i++) { |
if ((communes = reponse.get(i).isArray()) != null) { |
String commune = ((JSONString) communes.get(0)).stringValue(); |
String departement = ((JSONString) communes.get(1)).stringValue(); |
ReferentielCommune com = new ReferentielCommune(commune, departement); |
referentielCommuneData.put(com.getCommune() + com.getDepartement(), com); |
} |
} |
} else { |
referentielCommuneData = new ListeReferentielCommune(0); |
} |
addToCache(critere, referentielCommuneData); |
r.rafraichir(referentielCommuneData, true); |
} |
} |
}); |
}); |
} catch (RequestException e) { |
e.printStackTrace(); |
} |
} catch (RequestException e) { |
e.printStackTrace(); |
} |
} // Fin else si pas de cache |
} |
private void addToCache(String query, ListeReferentielCommune result) { |
cache.put(query.toLowerCase(),result); |
} |
/** |
* Fonction à implémenter dans le futur, lors de l'utilisation de plusieurs |
* référentiels de localité |
*/ |
@Override |
public void obtenirListeDonnees(Rafraichissable r, String referentiel, String critere) { |
// TODO Auto-generated method stub |
} |
private void addToCache(String query, ListeReferentielCommune result) { |
cache.put(query.toLowerCase(),result); |
} |
private ListeReferentielCommune getFromCache (String query) { |
return cache.get(query.toLowerCase()); |
} |
private ListeReferentielCommune getFromCache (String query) { |
return cache.get(query.toLowerCase()); |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/dao/ObservationAsynchroneDAO.java |
---|
65,7 → 65,9 |
+"&latitude="+URL.encodeComponent(""+obs.getLatitude()) |
+"&longitude="+URL.encodeComponent(""+obs.getLongitude()) |
+"&abondance="+URL.encodeComponent(""+obs.getAbondance()) |
+"&certitude="+URL.encodeComponent(""+obs.getCertitude()); |
+"&certitude="+URL.encodeComponent(""+obs.getCertitude()) |
+"&phenologie="+URL.encodeComponent(""+obs.getPhenologie()) |
+"&nom_referentiel="+URL.encodeComponent(""+obs.getReferentielTaxo()); |
try { |
rb.sendRequest(postData, new RequestCallback() { |
115,7 → 117,9 |
+"&latitude="+URL.encodeComponent(""+obs.getLatitude()) |
+"&longitude="+URL.encodeComponent(""+obs.getLongitude()) |
+"&abondance="+URL.encodeComponent(""+obs.getAbondance()) |
+"&certitude="+URL.encodeComponent(""+obs.getCertitude()); |
+"&certitude="+URL.encodeComponent(""+obs.getCertitude()) |
+"&phenologie="+URL.encodeComponent(""+obs.getPhenologie()) |
+"&nom_referentiel="+URL.encodeComponent(""+obs.getReferentielTaxo()); |
try { |
rb.sendRequest(postData, new RequestCallback() { |
/trunk/src/org/tela_botanica/client/modeles/dao/ListeObservationAsynchroneDAO.java |
---|
187,6 → 187,14 |
if(obs.getCertitude() != null) { |
postData += "&certitude="+URL.encodeComponent(""+obs.getCertitude()); |
} |
if(obs.getPhenologie() != null) { |
postData += "&phenologie="+URL.encodeComponent(""+obs.getPhenologie()); |
} |
if(obs.getReferentielTaxo() != null) { |
postData += "&nom_referentiel="+URL.encodeComponent(""+obs.getReferentielTaxo()); |
} |
try { |
rb.sendRequest(postData, new RequestCallback() { |