Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1468 Rev 1513
Line 1... Line 1...
1
package org.tela_botanica.client.composants.pagination;
1
package org.tela_botanica.client.composants.pagination;
Line 2... Line 2...
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
-
 
4
import java.util.Date;
-
 
5
import java.util.HashMap;
4
import java.util.Date;
6
import java.util.Iterator;
-
 
7
import java.util.List;
Line 5... Line 8...
5
import java.util.List;
8
import java.util.Set;
6
 
9
 
Line 7... Line 10...
7
import org.tela_botanica.client.modeles.ValeurListe;
10
import org.tela_botanica.client.modeles.ValeurListe;
Line 29... Line 32...
29
 
32
 
Line 30... Line 33...
30
public class TransformateurJSONaModelData<D> extends JsonPagingLoadResultReader<D> {
33
public class TransformateurJSONaModelData<D> extends JsonPagingLoadResultReader<D> {
Line -... Line 34...
-
 
34
 
-
 
35
	private ModelType modelType = null;
-
 
36
	
31
 
37
	// HashMap<'nom du champ virtuel', 'nom du champ à binder'>
32
	private ModelType modelType = null;
38
	private HashMap<String, String> virtualFields = null;
33
	
39
	
-
 
40
	public TransformateurJSONaModelData(ModelType modelType, HashMap<String, String> virtualFields) {
34
	public TransformateurJSONaModelData(ModelType modelType) {
41
		super(modelType);
Line 35... Line 42...
35
		super(modelType);
42
		this.modelType = modelType;
36
		this.modelType = modelType;
43
		this.virtualFields = virtualFields;
37
	}
44
	}
Line 119... Line 126...
119
	            model.set(name, s);
126
	            model.set(name, s);
120
	          }
127
	          }
121
	        } else if (value.isNull() != null) {
128
	        } else if (value.isNull() != null) {
122
	          model.set(name, null);
129
	          model.set(name, null);
123
	        }
130
	        }
-
 
131
	        
-
 
132
		    if (virtualFields != null) {
-
 
133
				Set<String> cles = virtualFields.keySet();
-
 
134
				Iterator<String> it = cles.iterator();
-
 
135
				while(it.hasNext()) {
-
 
136
					String vField = it.next();
-
 
137
					// si il y a un champ à binder
-
 
138
					if (virtualFields.get(vField) != null) {
-
 
139
						model.set(vField, model.get(virtualFields.get(vField)));
-
 
140
					}
-
 
141
					// sinon affecter la propriété à 'chaîne vide'
-
 
142
					else {
-
 
143
						model.set(virtualFields.get(vField), "");
-
 
144
					}
-
 
145
				}
-
 
146
		    }
124
	      }
147
	      }
125
	      models.add(model);
148
	      models.add(model);
126
	    }
149
	    }
127
	    int totalCount = models.size();
150
	    int totalCount = models.size();
128
	    if (modelType.getTotalName() != null) {
151
	    if (modelType.getTotalName() != null) {