Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 963 → Rev 965

/trunk/src/org/tela_botanica/client/modeles/ListeEntiteGeographiqueObservationAsynchroneDAO.java
3,7 → 3,9
import org.tela_botanica.client.interfaces.FournisseurListe;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.observation.ObservationModele;
import org.tela_botanica.client.util.Util;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
10,6 → 12,7
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
78,20 → 81,20
// si c'est un tableau
if ((reponse = responseValue.isArray()) != null) {
JSONArray entites;
JSONObject entites;
final int taillemax = reponse.size();
listeEntiteGeographiqueObservation = new ListeEntiteGeographiqueObservation(taillemax);
for (int i = 0; i < taillemax; i++) {
if ((entites = reponse.get(i).isArray()) != null) {
if ((entites = reponse.get(i).isObject()) != null) {
String localite = ((JSONString) entites.get(0)).stringValue();
String commune = ((JSONString) entites.get(1)).stringValue();
String lieuDit = ((JSONString) entites.get(2)).stringValue();
String station = ((JSONString) entites.get(3)).stringValue();
String idZoneGeo = Util.convertirChaineZoneGeoVersDepartement(((JSONString) entites.get("ce_zone_geo")).stringValue());
String zoneGeo = ((JSONString) entites.get("zone_geo")).stringValue();
String lieuDit = ((JSONString) entites.get("lieudit")).stringValue();
String station = ((JSONString) entites.get("station")).stringValue();
EntiteGeographiqueObservation ent = new EntiteGeographiqueObservation(localite, commune, lieuDit, station);
EntiteGeographiqueObservation ent = new EntiteGeographiqueObservation(idZoneGeo, zoneGeo, lieuDit, station);
listeEntiteGeographiqueObservation.put(ent);
}
}
/trunk/src/org/tela_botanica/client/modeles/UtilisateurAsynchroneDAO.java
154,7 → 154,7
try {
String postData = "acceptation_licence=1";
String postData = "licence=1";
rb.sendRequest(postData, new RequestCallback() {
 
/trunk/src/org/tela_botanica/client/modeles/EntiteGeographiqueObservation.java
2,7 → 2,7
 
/**
*
* Classe representant une idLocalite geographique (localite, commune, lieu dit) presente dans la liste des observations
* Classe representant une idZoneGeo geographique (localite, zoneGeo, lieu dit) presente dans la liste des observations
*
*/
 
10,8 → 10,8
 
 
private String idLocalite=null;
private String commune=null;
private String idZoneGeo=null;
private String zoneGeo=null;
private String lieuDit=null;
private String station=null;
private String lat=null;
25,14 → 25,14
 
/**
* @param commune
* @param zoneGeo
* @param departement
*/
public EntiteGeographiqueObservation(String idLocalite, String commune, String lieuDit, String station) {
public EntiteGeographiqueObservation(String idZoneGeo, String zoneGeo, String lieuDit, String station) {
this.idLocalite = idLocalite;
this.commune = commune;
this.idZoneGeo = idZoneGeo;
this.zoneGeo = zoneGeo;
this.lieuDit = lieuDit;
this.station = station;
54,13 → 54,13
return lon;
}
 
public String getIdLocalite() {
return idLocalite;
public String getIdZoneGeo() {
return idZoneGeo;
}
 
 
public String getCommune() {
return commune;
public String getZoneGeo() {
return zoneGeo;
}
 
 
71,8 → 71,4
public String getStation() {
return station;
}
 
 
 
}
/trunk/src/org/tela_botanica/client/modeles/ListeObservationAsynchroneDAO.java
13,6 → 13,7
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
54,9 → 55,7
* @param criteres un tableau nom/valeur des critères pour les observations
*/
public final void obtenirListeObservation(final Rafraichissable r, final String utilisateur, final String[][] criteres)
{
{
String requete = "" ;
if(criteres != null)
66,8 → 65,6
for (int i = 0; i < criteres.length; i++) {
GWT.log(criteres[i][0]+" : "+criteres[i][1]);
if(criteres[i][1] != null && !criteres[i][1].equals(""))
{
if(i!= 0)
102,7 → 99,7
// si c'est un tableau
if ((reponse=responseValue.isArray()) != null) {
JSONArray observation;
JSONObject observation;
final int taillemax = reponse.size();
observationData = new ListeObservation(taillemax);
109,34 → 106,34
for (int i = 0; i < taillemax; i++) {
if ((observation=reponse.get(i).isArray()) != null) {
if ((observation=reponse.get(i).isObject()) != null) {
String transmis=((JSONString) observation.get(13)).stringValue();
String identifiantLocalite=((JSONString) observation.get(14)).toString();
String nomSaisi=Util.toCelString(((JSONString) observation.get(0)).toString());
String nomRetenu=Util.toCelString(((JSONString) observation.get(2)).toString());
String numeroNomenclaturalSaisi=((JSONString) observation.get(1)).stringValue();
String numeroNomenclaturalRetenu=((JSONString) observation.get(3)).stringValue();
String numeroTaxonomique=((JSONString) observation.get(4)).stringValue();
String famille=Util.toCelString(((JSONString) observation .get(5)).toString());
String localite=Util.toCelString(((JSONString) observation .get(6)).toString());
String lieudit=Util.toCelString(((JSONString) observation .get(9)).toString());
String station=Util.toCelString(((JSONString) observation .get(10)).toString());
String milieu=Util.toCelString(((JSONString) observation .get(11)).toString());
String commentaire=Util.toCelString(((JSONString) observation .get(12)).toString());
String date=((JSONString) observation .get(8)).stringValue();
String numeroOrdre=((JSONString) observation.get(7)).stringValue();
String coordX=((JSONString) observation.get(15)).stringValue();
String coordY=((JSONString) observation.get(16)).stringValue();
String motsCles=((JSONString) observation.get(17)).stringValue();
String transmis=((JSONString) observation.get("transmission")).stringValue();
String identifiantLocalite=((JSONString) observation.get("ce_zone_geo")).toString();
String nomSaisi=Util.toCelString(((JSONString) observation.get("nom_sel")).toString());
String nomRetenu=Util.toCelString(((JSONString) observation.get("nom_ret")).toString());
String numeroNomenclaturalSaisi=((JSONString) observation.get("nom_sel_nn")).stringValue();
String numeroNomenclaturalRetenu=((JSONString) observation.get("nom_ret_nn")).stringValue();
String numeroTaxonomique=((JSONString) observation.get("nt")).stringValue();
String famille=Util.toCelString(((JSONString) observation .get("famille")).toString());
String localite=Util.toCelString(((JSONString) observation .get("zone_geo")).toString());
String lieudit=Util.toCelString(((JSONString) observation .get("lieudit")).toString());
String station=Util.toCelString(((JSONString) observation .get("station")).toString());
String milieu=Util.toCelString(((JSONString) observation .get("milieu")).toString());
String commentaire=Util.toCelString(((JSONString) observation .get("commentaire")).toString());
String date=((JSONString) observation .get("date_observation")).stringValue();
String numeroOrdre=((JSONString) observation.get("ordre")).stringValue();
String numeroId=((JSONString) observation.get("id_observation")).stringValue();
String coordX=((JSONString) observation.get("latitude")).stringValue();
String coordY=((JSONString) observation.get("longitude")).stringValue();
String motsCles=((JSONString) observation.get("mots_cles")).stringValue();
Observation obs=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclaturalSaisi, numeroNomenclaturalRetenu ,numeroTaxonomique, famille, localite, identifiantLocalite, lieudit, station, milieu, commentaire, date, numeroOrdre/*, motsCles*/);
obs.setCoordonneeX(coordX);
obs.setCoordonneeY(coordY);
obs.setId(numeroId);
obs.setMotsCles(motsCles);
observationData.put(obs.getNumeroOrdre(),obs);
observationData.put(obs.getNumeroOrdre(),obs);
}
}
} else {
200,12 → 197,12
postData += "&commentaire="+obs.getCommentaire();
}
if(obs.getCoordonneeX() != null ) {
postData += "&coord_x="+URL.encodeComponent(""+obs.getCoordonneeX());
if(obs.getLatitude() != null ) {
postData += "&coord_x="+URL.encodeComponent(""+obs.getLatitude());
}
if(obs.getCoordonneeY() != null) {
postData += "&coord_y="+URL.encodeComponent(""+obs.getCoordonneeY());
if(obs.getLongitude() != null) {
postData += "&coord_y="+URL.encodeComponent(""+obs.getLongitude());
}
 
try {
/trunk/src/org/tela_botanica/client/modeles/NombreObservationAsynchroneDAO.java
14,7 → 14,6
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.HTTPRequest;
import com.google.gwt.user.client.ResponseTextHandler;
import com.google.gwt.user.client.Window;
 
87,13 → 86,13
final JSONValue responseValue = JSONParser.parse(response.getText());
// si la requete se passe bien on reçoit un tableau JSON
if(responseValue.isArray() != null)
if(responseValue.isString() != null)
{
// qui contient une valeur : le nombre d'images correspondant au critères
JSONValue res = responseValue.isArray().get(0) ;
JSONString reponseNombre = res.isString() ;
int maxObservations = Integer.parseInt(reponseNombre.stringValue()) ;
JSONString res = responseValue.isString() ;
int maxObservations = Integer.parseInt(res.stringValue()) ;
int[] nbObservations = {maxObservations} ;
 
// on le met dans un tableau d'entiers qu'on tranmset au demandeur de la mise à jour
r.rafraichir(nbObservations, true) ;
} else {
/trunk/src/org/tela_botanica/client/modeles/ImageCarnet.java
4,7 → 4,12
import java.util.Iterator;
import java.util.Set;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.NodeList;
import com.google.gwt.xml.client.XMLParser;
import com.google.gwt.xml.client.impl.DOMParseException;
 
/**
*
107,7 → 112,7
*/
public String getId() {
 
return renvoyerValeurCorrecte("ci_id_image");
return renvoyerValeurCorrecte("id_image");
}
 
/**
117,7 → 122,7
*/
public String getOrdre() {
 
return renvoyerValeurCorrecte("ci_ordre");
return renvoyerValeurCorrecte("ordre");
}
 
/**
241,13 → 246,13
* @return un tableau de deux string contenant la hauteur puis la largeur
*/
public String[] getTailleImage() {
String[] XY = { renvoyerValeurCorrecte("ci_meta_height"),
renvoyerValeurCorrecte("ci_meta_width") };
String[] XY = { renvoyerValeurCorrecte("hauteur"),
renvoyerValeurCorrecte("largeur") };
return XY;
}
 
public String[] getNote() {
String[] note = { renvoyerValeurCorrecte("ci_note_image") };
String[] note = { renvoyerValeurCorrecte("note_qualite") };
return note;
}
 
258,11 → 263,11
*/
public String getDate() {
 
if(renvoyerValeurCorrecte("ci_meta_date").equals("00/00/0000"))
if(renvoyerValeurCorrecte("date_prise_de_vue").equals("00/00/0000"))
{
return "" ;
}
return renvoyerValeurCorrecte("ci_meta_date");
return renvoyerValeurCorrecte("date_prise_de_vue");
}
 
/**
272,7 → 277,7
*/
public Object getIptcCity() {
 
return renvoyerValeurCorrecte("ci_meta_iptc_city");
return renvoyerValeurCorrecte("");
}
 
/**
282,7 → 287,7
*/
public String getMake() {
 
return renvoyerValeurCorrecte("ci_meta_make");
return renvoyerValeurCorrecte("appareil_fabricant");
}
 
/**
292,7 → 297,7
*/
public String getModel() {
 
return renvoyerValeurCorrecte("ci_meta_model");
return renvoyerValeurCorrecte("appareil_modele");
}
 
/**
301,31 → 306,37
* @return les métadonnées iptc
*/
public String[][] getMetadonnesIptc() {
String[][] metaIptc = {{},{}};
String xml = renvoyerValeurCorrecte("meta_iptc");
String invalidXmlPattern = "[^"
+ "\\u0009\\u000A\\u000D"
+ "\\u0020-\\uD7FF"
+ "\\uE000-\\uFFFD"
+ "\\u10000-\\u10FFFF"
+ "]+";
xml = xml.replaceAll(invalidXmlPattern, " ");
try {
Document d = XMLParser.parse(xml);
NodeList attributs = d.getFirstChild().getChildNodes();
 
String[][] metaIptc = new String[14][2];
int elem = 0;
 
for (Iterator<String> it = this.keySet().iterator(); it.hasNext();) {
 
String key = it.next();
 
// on filtre le "ci"
String type[] = key.split("_", 3);
 
// si c'est une metadonnee exif ou iptc
if (type[1].equals("meta")) {
String[] genre = type[2].split("_", 2);
if (genre[0].equals("iptc")) {
String nom = genre[1];
metaIptc[elem][0] = nom;
metaIptc[elem][1] = renvoyerValeurCorrecte(key);
elem++;
}
 
int taille = attributs.getLength();
metaIptc = new String[taille][2];
for(int i = 0; i < taille; i++) {
XMLParser.removeWhitespace(attributs.item(i));
attributs.item(i).normalize();
metaIptc[i][0] = attributs.item(i).getNodeName();
metaIptc[i][1] = attributs.item(i).getNodeValue();
}
 
}
 
return metaIptc;
} catch(DOMParseException e) {
}
return metaIptc;
}
 
335,31 → 346,35
* @return les métadonnées Exif
*/
public String[][] getMetadonnesExif() {
String[][] metaExif = {{},{}};
String xml = renvoyerValeurCorrecte("meta_exif");
String invalidXmlPattern = "[^"
+ "\\u0009\\u000A\\u000D"
+ "\\u0020-\\uD7FF"
+ "\\uE000-\\uFFFD"
+ "\\u10000-\\u10FFFF"
+ "]+";
xml = xml.replaceAll(invalidXmlPattern, " ");
 
String[][] metaExif = new String[31][2];
int elem = 0;
 
for (Iterator<String> it = this.keySet().iterator(); it.hasNext();) {
 
String key = it.next();
 
// on filtre le "ci"
String type[] = key.split("_", 3);
 
// si c'est une metadonnee exif ou iptc
if (type[1].equals("meta")) {
String[] genre = type[2].split("_", 2);
if (genre[0].equals("exif")) {
String nom = genre[1];
metaExif[elem][0] = nom;
metaExif[elem][1] = renvoyerValeurCorrecte(key);
elem++;
}
 
try {
Document d = XMLParser.parse(xml);
NodeList attributs = d.getFirstChild().getChildNodes();
int taille = attributs.getLength();
metaExif = new String[taille][2];
for(int i = 0; i < taille; i++) {
XMLParser.removeWhitespace(attributs.item(i));
attributs.item(i).normalize();
metaExif[i][0] = attributs.item(i).getNodeName();
metaExif[i][1] = attributs.item(i).getNodeValue();
}
 
}
 
} catch(DOMParseException e) {
}
return metaExif;
 
}
373,11 → 388,11
 
String[][] metaGen = new String[2][2];
 
metaGen[0][0] = "ci_meta_comment";
metaGen[0][1] = this.renvoyerValeurCorrecte("ci_meta_comment");
metaGen[0][0] = "commentaire";
metaGen[0][1] = this.renvoyerValeurCorrecte("commentaire");
 
metaGen[1][0] = "ci_meta_date";
metaGen[1][1] = this.renvoyerValeurCorrecte("ci_meta_date");
metaGen[1][0] = "date_prise_de_vue";
metaGen[1][1] = this.renvoyerValeurCorrecte("date_prise_de_vue");
 
return metaGen;
}
389,7 → 404,7
*/
public String getMotsCles() {
 
return renvoyerValeurCorrecte("ci_meta_mots_cles");
return renvoyerValeurCorrecte("mots_cles");
}
 
/**
402,9 → 417,9
*/
public void miseAJourInfoGenerales(String commentaires, String date,
String note) {
put("ci_meta_comment", commentaires);
put("ci_note_image", note);
put("ci_meta_date", date);
put("commentaire", commentaires);
put("note_qualite", note);
put("date_prise_de_vue", date);
}
 
/**
415,12 → 430,12
*/
public void mettreAjourMotsCles(String motsClesEnCours) {
 
put("ci_meta_mots_cles", motsClesEnCours);
put("mots_cles", motsClesEnCours);
 
}
public void mettreAjourObsAssociees(String idsObsAssociees) {
put("ci_ce_observation", idsObsAssociees);
put("id_observation", idsObsAssociees);
}
/**
429,12 → 444,12
* @return le nom orginal de l'image
*/
public String getNomOriginal() {
return renvoyerValeurCorrecte("ci_nom_original");
return renvoyerValeurCorrecte("nom_original");
}
public String getIdsObsAssociees() {
String observationsAssociees = renvoyerValeurCorrecte("ci_ce_observation");
String observationsAssociees = renvoyerValeurCorrecte("id_observation");
observationsAssociees = observationsAssociees.replaceAll("null", "");
return observationsAssociees;
/trunk/src/org/tela_botanica/client/modeles/LiaisonMotsClesAsynchroneDAO.java
43,13 → 43,12
* @param motcle
* le mots clés à ajouter avec son parent et son identifiant
*/
public void modifier(final Rafraichissable r, String utilisateur, String idObs, String idMC) {
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,Configuration.getServiceBaseUrl()+ "/InventoryKeyWordObsLink/" + utilisateur + "/" +idObs+ "/") ;
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST,Configuration.getServiceBaseUrl()+ "/InventoryKeyWordObsLink/") ;
String postData = "identifiant="
+ utilisateur
String postData = "ce_utilisateur="+utilisateur
+"&observations="+idObs
+"&mots_cles="+URL.encodeComponent(""+idMC);
try {
/trunk/src/org/tela_botanica/client/modeles/NombreImageAsynchroneDAO.java
68,7 → 68,7
// on fait un get asynchrone
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, Configuration.getServiceBaseUrl()
+ "/InventoryImageCount/"
+ iModele.getIdentifiant()
+ Utilisateur.getInstance().getIdentifiantUtilisateurConsulte()
+ "/"
+ requete);
try {
85,12 → 85,11
final JSONValue responseValue = JSONParser.parse(response
.getText());
 
// si la requete se passe bien on reçoit un tableau JSON
if (responseValue.isArray() != null) {
// si la requete se passe bien on reçoit une chaine JSON
if (responseValue.isString() != null) {
// qui contient une valeur : le nombre d'images
// correspondant au critères
JSONValue res = responseValue.isArray().get(0);
JSONString reponseNombre = res.isString();
JSONString reponseNombre = responseValue.isString();
int maxImages = Integer.parseInt(reponseNombre
.stringValue());
int[] nbImages = { maxImages };