| Line 13... |
Line 13... |
| 13 |
import org.tela_botanica.client.modeles.Valeur;
|
13 |
import org.tela_botanica.client.modeles.Valeur;
|
| 14 |
import org.tela_botanica.client.modeles.ValeurListe;
|
14 |
import org.tela_botanica.client.modeles.ValeurListe;
|
| 15 |
import org.tela_botanica.client.modeles.aDonnee;
|
15 |
import org.tela_botanica.client.modeles.aDonnee;
|
| 16 |
import org.tela_botanica.client.modeles.projet.Projet;
|
16 |
import org.tela_botanica.client.modeles.projet.Projet;
|
| 17 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
17 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
| - |
|
18 |
import org.tela_botanica.client.util.Debug;
|
| 18 |
import org.tela_botanica.client.util.UtilString;
|
19 |
import org.tela_botanica.client.util.UtilString;
|
| Line 19... |
Line 20... |
| 19 |
|
20 |
|
| 20 |
import com.extjs.gxt.ui.client.Registry;
|
21 |
import com.extjs.gxt.ui.client.Registry;
|
| 21 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
22 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
| Line 219... |
Line 220... |
| 219 |
}
|
220 |
}
|
| 220 |
}
|
221 |
}
|
| 221 |
}
|
222 |
}
|
| Line 222... |
Line 223... |
| 222 |
|
223 |
|
| - |
|
224 |
public String construireTxtListeOntologie(String chaineAAnalyser) {
|
| - |
|
225 |
return construireTxtListeOntologie(chaineAAnalyser, true, true, false);
|
| - |
|
226 |
}
|
| - |
|
227 |
|
| 223 |
public String construireTxtListeOntologie(String chaineAAnalyser) {
|
228 |
public String construireTxtListeOntologie(String chaineAAnalyser, boolean valeurEstOntologie, boolean typeEstOntologie, boolean donneeEstOntologie) {
|
| 224 |
ArrayList<String> termes = new ArrayList<String>();
|
229 |
ArrayList<String> termes = new ArrayList<String>();
|
| 225 |
ArrayList<String> autres = new ArrayList<String>();
|
230 |
ArrayList<String> autres = new ArrayList<String>();
|
| 226 |
if ((chaineAAnalyser != null) && (!chaineAAnalyser.trim().equals(""))) {
|
231 |
if ((chaineAAnalyser != null) && (!chaineAAnalyser.trim().equals(""))) {
|
| 227 |
String[] valeurs = chaineAAnalyser.split(aDonnee.SEPARATEUR_VALEURS);
|
232 |
String[] valeurs = chaineAAnalyser.split(aDonnee.SEPARATEUR_VALEURS);
|
| 228 |
int nbreValeurs = valeurs.length;
|
233 |
int nbreValeurs = valeurs.length;
|
| 229 |
if (nbreValeurs > 0) {
|
234 |
if (nbreValeurs > 0) {
|
| 230 |
for (int i = 0; i < nbreValeurs; i++) {
|
235 |
for (int i = 0; i < nbreValeurs; i++) {
|
| - |
|
236 |
String valeur = valeurs[i];
|
| - |
|
237 |
|
| - |
|
238 |
// VALEUR SANS TYPE
|
| 231 |
String id = valeurs[i];
|
239 |
// La valeur sans type est une entrée de l'ontologie
|
| - |
|
240 |
if (valeurEstOntologie && valeur.matches("^[0-9]+$")) {
|
| - |
|
241 |
if (valeur.equals("0")) {
|
| - |
|
242 |
valeur = "";
|
| 232 |
if (id.matches("^(?:"+aDonnee.TYPE_AUTRE+"|[0-9]+)[\\#]{2}.+$")) {
|
243 |
} else if (ontologie != null) {
|
| - |
|
244 |
Valeur valeurOntologie = ontologie.get(valeur);
|
| - |
|
245 |
if (valeurOntologie != null) {
|
| - |
|
246 |
valeur = valeurOntologie.getNom();
|
| - |
|
247 |
}
|
| - |
|
248 |
}
|
| - |
|
249 |
}
|
| - |
|
250 |
|
| - |
|
251 |
// VALEUR AVEC TYPE
|
| 233 |
//Chaine truk typé : type##valeur;
|
252 |
// Type : AUTRE
|
| 234 |
String idAutre = aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR;
|
253 |
String valeurTypeAutre = aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR;
|
| 235 |
if (id.contains(idAutre)) {
|
254 |
if (valeur.matches("^"+valeurTypeAutre+".+$")) {
|
| 236 |
String txt = id.replaceFirst("^"+idAutre, "");
|
255 |
String txtAutre = valeur.replaceFirst("^"+valeurTypeAutre, "");
|
| 237 |
if (!txt.equals("")) {
|
256 |
if (!txtAutre.equals("")) {
|
| - |
|
257 |
autres.add(txtAutre);
|
| - |
|
258 |
}
|
| - |
|
259 |
valeur = "";
|
| - |
|
260 |
}
|
| - |
|
261 |
// Type correspondant à une entrée de l'ontologie
|
| - |
|
262 |
if (typeEstOntologie) {
|
| - |
|
263 |
String valeurTypeOntologie = "[0-9]+"+aDonnee.SEPARATEUR_TYPE_VALEUR;
|
| - |
|
264 |
if (valeur.matches("^"+valeurTypeOntologie+".+$")) {
|
| - |
|
265 |
String type = valeur.substring(0, valeur.indexOf(aDonnee.SEPARATEUR_TYPE_VALEUR));
|
| - |
|
266 |
if (ontologie != null && ontologie.get(type) != null) {
|
| - |
|
267 |
Valeur valeurOntologie = ontologie.get(type);
|
| 238 |
autres.add(txt);
|
268 |
valeur = valeur.replaceFirst("^"+type, valeurOntologie.getNom()+": ");
|
| 239 |
}
|
- |
|
| 240 |
} else {
|
- |
|
| 241 |
String type = id.substring(0, id.indexOf(aDonnee.SEPARATEUR_TYPE_VALEUR));
|
- |
|
| 242 |
Valeur valeur = ontologie.get(type);
|
- |
|
| 243 |
String txt = id.replaceFirst("^" + type + aDonnee.SEPARATEUR_TYPE_VALEUR, valeur.getNom() + ": ");
|
- |
|
| 244 |
termes.add(txt);
|
269 |
}
|
| - |
|
270 |
}
|
| 245 |
}
|
271 |
}
|
| 246 |
} else if (id.matches("^[0-9]+$")) {
|
272 |
// Donnée correspondant à une entrée de l'ontologie
|
| - |
|
273 |
if (donneeEstOntologie) {
|
| 247 |
if (ontologie != null) {
|
274 |
String donneeOntologie = aDonnee.SEPARATEUR_TYPE_VALEUR+"[0-9]+";
|
| - |
|
275 |
if (valeur.matches("^.+"+donneeOntologie+"$")) {
|
| - |
|
276 |
String donnee = valeur.substring(valeur.indexOf(aDonnee.SEPARATEUR_TYPE_VALEUR), valeur.length());
|
| 248 |
Valeur valeur = ontologie.get(id);
|
277 |
donnee = donnee.replaceFirst("^"+aDonnee.SEPARATEUR_TYPE_VALEUR, "");
|
| 249 |
if (valeur != null) {
|
278 |
if (ontologie != null && ontologie.get(donnee) != null) {
|
| 250 |
String termeOntologie = valeur.getNom();
|
279 |
Valeur valeurOntologie = ontologie.get(donnee);
|
| 251 |
termes.add(termeOntologie);
|
280 |
valeur = valeur.replaceFirst(donnee+"$", valeurOntologie.getNom());
|
| 252 |
}
|
281 |
}
|
| 253 |
}
|
282 |
}
|
| - |
|
283 |
}
|
| - |
|
284 |
|
| - |
|
285 |
// Nettoyage final
|
| - |
|
286 |
valeur = valeur.replaceFirst(aDonnee.SEPARATEUR_TYPE_VALEUR, "");
|
| - |
|
287 |
|
| - |
|
288 |
if (!UtilString.isEmpty(valeur)) {
|
| - |
|
289 |
termes.add(valeur);
|
| 254 |
}
|
290 |
}
|
| 255 |
}
|
291 |
}
|
| 256 |
}
|
292 |
}
|
| Line 257... |
Line 293... |
| 257 |
}
|
293 |
}
|