Subversion Repositories eFlore/Applications.coel

Rev

Rev 602 | Rev 608 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 602 Rev 603
Line 250... Line 250...
250
			String[] valeurs = chaineExistante.split(";;");
250
			String[] valeurs = chaineExistante.split(";;");
251
			if (valeurs.length >= position) {
251
			if (valeurs.length >= position) {
252
				for (int i = 0; i < valeurs.length; i++) {
252
				for (int i = 0; i < valeurs.length; i++) {
253
					if (i == (position - 1)) {
253
					if (i == (position - 1)) {
254
						if (valeurs[i].contains("##")) {
254
						if (valeurs[i].contains("##")) {
255
							sortie =  valeurs[i].replaceFirst("^[^#]+##", "");
255
							sortie = valeurs[i].replaceFirst("^[^#]+##", "");
256
						} else {
256
						} else {
257
							sortie =  valeurs[i];
257
							sortie = valeurs[i];
258
						}
258
						}
259
						break;
259
						break;
260
					}
260
					}
261
				}
261
				}
262
			}
262
			}
Line 273... Line 273...
273
	 * @param champ le nom du champ dénormalisé
273
	 * @param champ le nom du champ dénormalisé
274
	 * @param position le type de la valeur à modifier
274
	 * @param position le type de la valeur à modifier
275
	 * @param valeur la valeur à remplacer à la position indiquée
275
	 * @param valeur la valeur à remplacer à la position indiquée
276
	 */
276
	 */
277
	protected void modifierChaineDenormaliseParPosition(String champ, int position, Object valeur) {
277
	protected void modifierChaineDenormaliseParPosition(String champ, int position, Object valeur) {
-
 
278
		if (valeur == null) {
-
 
279
			supprimerChaineDenormaliseParPosition(champ, position);
278
		if (valeur instanceof String) {
280
		} else if (valeur instanceof String) {
279
			String chaineExistante = renvoyerValeurCorrecte(champ);
281
			String chaineExistante = renvoyerValeurCorrecte(champ);
280
			if (!chaineExistante.equals("")) {
282
			if (chaineExistante.equals("")) {
-
 
283
				this.set(champ, valeur);
-
 
284
			} else {
281
				String[] valeurs = chaineExistante.split(";;");
285
				String[] valeurs = chaineExistante.split(";;");
282
				if (valeurs.length == 0) {
-
 
283
					this.set(champ, valeur);
-
 
284
				} else if (valeurs.length >= position) {
286
				if (valeurs.length >= position) {
285
					for (int i = 0; i < valeurs.length; i++) {
287
					for (int i = 0; i < valeurs.length; i++) {
286
						if (i == (position - 1)) {
288
						if (i == (position - 1)) {
287
							valeurs[i] = (String) valeur;
289
							valeurs[i] = (String) valeur;
288
							break;
290
							break;
289
						}
291
						}
Line 292... Line 294...
292
				}
294
				}
293
			}
295
			}
294
		}
296
		}
295
	}
297
	}
Line -... Line 298...
-
 
298
	
-
 
299
	protected void supprimerChaineDenormaliseParPosition(String champ, int position) {
-
 
300
		String chaineExistante = renvoyerValeurCorrecte(champ);
-
 
301
		if (!chaineExistante.equals("")) {
-
 
302
			String[] valeurs = chaineExistante.split(";;");
-
 
303
			HashMap<String,String> valeursModifiees = new HashMap<String,String>();
-
 
304
			if (valeurs.length >= position) {
-
 
305
				for (int i = 0; i < valeurs.length; i++) {
-
 
306
					if (i != (position - 1)) {
-
 
307
						valeursModifiees.put(""+i, valeurs[i]);
-
 
308
					}
-
 
309
				}
-
 
310
				String[] tableauValeursModifiees = valeursModifiees.values().toArray(new String[valeursModifiees.size()]);
-
 
311
				this.set(champ, UtilArray.implode(tableauValeursModifiees, ";;"));
-
 
312
			}
-
 
313
		}
-
 
314
	}
296
	
315
	
297
	public String getDateModification() {
316
	public String getDateModification() {
298
		return (String) renvoyerValeurCorrecte("cmhl_date_modification");
317
		return (String) renvoyerValeurCorrecte("cmhl_date_modification");
Line 299... Line 318...
299
	}
318
	}