Revision 20419
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/UpdateAttributeCommand.java | ||
---|---|---|
7 | 7 |
public class UpdateAttributeCommand extends AbstractAttributeCommand{ |
8 | 8 |
private IFeatureAttributeDescriptor oldAttributeDescriptor; |
9 | 9 |
|
10 |
public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor, IFeatureAttributeDescriptor oldAttributeDescriptor) {
|
|
10 |
public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor) { |
|
11 | 11 |
super(attributeManager,attributeDescriptor); |
12 |
this.oldAttributeDescriptor=oldAttributeDescriptor;
|
|
12 |
this.oldAttributeDescriptor=attributeDescriptor.getOldAttributeDescriptor();
|
|
13 | 13 |
} |
14 | 14 |
|
15 |
public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor,IFeatureAttributeDescriptor oldAttributeDescriptor, String description) {
|
|
15 |
public UpdateAttributeCommand(AttributeManager attributeManager, IFeatureAttributeDescriptor attributeDescriptor, String description) { |
|
16 | 16 |
super(attributeManager,attributeDescriptor, description); |
17 |
this.oldAttributeDescriptor=oldAttributeDescriptor;
|
|
17 |
this.oldAttributeDescriptor=attributeDescriptor.getOldAttributeDescriptor();
|
|
18 | 18 |
} |
19 | 19 |
|
20 | 20 |
public void undo() { |
... | ... | |
26 | 26 |
|
27 | 27 |
attributeManager.restoreAttribute(oldAttributeDescriptor.getName()); |
28 | 28 |
} |
29 |
|
|
30 | 29 |
public void redo() { |
31 | 30 |
execute(); |
32 | 31 |
} |
... | ... | |
40 | 39 |
attributeManager.deleteAttribute(oldAttributeDescriptor.getName()); |
41 | 40 |
attributeManager.addAttribute(attributeDescriptor); |
42 | 41 |
} else { |
43 |
attributeManager.updateAttribute(attributeDescriptor, oldAttributeDescriptor); |
|
42 |
|
|
43 |
attributeManager.updateAttribute(attributeDescriptor); |
|
44 | 44 |
} |
45 | 45 |
} |
46 | 46 |
public IFeatureAttributeDescriptor getOldAttributeDescriptor(){ |
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/FeatureCommandsRecord.java | ||
---|---|---|
59 | 59 |
add(command); |
60 | 60 |
command.execute(); |
61 | 61 |
} |
62 |
public void update(Object obj, Object oldObj) {
|
|
62 |
public void update(Object obj) { |
|
63 | 63 |
ICommand command=null; |
64 | 64 |
if (obj instanceof IFeature){ |
65 | 65 |
IFeature feature=(IFeature)obj; |
66 |
IFeature oldFeature=(IFeature)oldObj; |
|
67 |
command=new UpdateFeatureCommand(expansionManager,spatialManager, feature,oldFeature);
|
|
66 |
// IFeature oldFeature=(IFeature)oldObj;
|
|
67 |
command=new UpdateFeatureCommand(expansionManager,spatialManager, feature); |
|
68 | 68 |
}else if (obj instanceof IFeatureAttributeDescriptor){ |
69 | 69 |
IFeatureAttributeDescriptor attributeDescriptor=(IFeatureAttributeDescriptor)obj; |
70 |
IFeatureAttributeDescriptor oldAttributeDescriptor=(IFeatureAttributeDescriptor)oldObj; |
|
71 |
command=new UpdateAttributeCommand(attributeManager,attributeDescriptor,oldAttributeDescriptor);
|
|
70 |
// IFeatureAttributeDescriptor oldAttributeDescriptor=(IFeatureAttributeDescriptor)oldObj;
|
|
71 |
command=new UpdateAttributeCommand(attributeManager,attributeDescriptor); |
|
72 | 72 |
}else{ |
73 | 73 |
throw new RuntimeException("Object not supported by any command"); |
74 | 74 |
} |
... | ... | |
81 | 81 |
attributeManager.clear(); |
82 | 82 |
spatialManager.clear(); |
83 | 83 |
} |
84 |
|
|
84 |
|
|
85 | 85 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/commands/implementation/UpdateFeatureCommand.java | ||
---|---|---|
82 | 82 |
*/ |
83 | 83 |
package org.gvsig.data.commands.implementation; |
84 | 84 |
|
85 |
import java.util.Map; |
|
86 |
|
|
85 | 87 |
import org.gvsig.data.commands.ICommand; |
86 | 88 |
import org.gvsig.data.vectorial.IFeature; |
87 | 89 |
import org.gvsig.data.vectorial.SpatialManager; |
... | ... | |
97 | 99 |
private IFeature oldFeature; |
98 | 100 |
|
99 | 101 |
public UpdateFeatureCommand(FeatureManager expansionManager, |
100 |
SpatialManager spatialManager, IFeature feature, |
|
101 |
IFeature oldFeature) { |
|
102 |
SpatialManager spatialManager, IFeature feature) { |
|
102 | 103 |
super(expansionManager, spatialManager, feature); |
103 |
this.oldFeature = oldFeature;
|
|
104 |
this.oldFeature = feature.getOldFeature();
|
|
104 | 105 |
} |
105 | 106 |
|
106 | 107 |
public UpdateFeatureCommand(FeatureManager expansionManager, |
107 |
SpatialManager spatialManager, IFeature feature, |
|
108 |
IFeature oldFeature, String description) { |
|
108 |
SpatialManager spatialManager, IFeature feature, String description) { |
|
109 | 109 |
super(expansionManager, spatialManager, feature, description); |
110 |
this.oldFeature = oldFeature;
|
|
110 |
this.oldFeature = feature.getOldFeature();
|
|
111 | 111 |
} |
112 | 112 |
|
113 | 113 |
/* (non-Javadoc) |
trunk/libraries/libDataSource/src/org/gvsig/data/commands/ICommandsRecord.java | ||
---|---|---|
55 | 55 |
public List getCommandsFeatureInserted(); |
56 | 56 |
public void insert(Object obj); |
57 | 57 |
public void delete(Object obj); |
58 |
public void update(Object obj, Object oldObj);
|
|
58 |
public void update(Object obj); |
|
59 | 59 |
public List getCommandsAttributeDeleted(); |
60 | 60 |
public List getCommandsAttributeUpdated(); |
61 | 61 |
public List getCommandsAttributeInserted(); |
trunk/libraries/libDataSource/src/org/gvsig/data/IDataStore.java | ||
---|---|---|
30 | 30 |
* @throws IsNotFeatureSettingException |
31 | 31 |
* |
32 | 32 |
*/ |
33 |
public void open() throws OpenException, IsNotFeatureSettingException;
|
|
33 |
public void open() throws OpenException; |
|
34 | 34 |
/** |
35 | 35 |
* Hace que se cierre el soporte f?sico de la capa. Cierra el fichero de |
36 | 36 |
* ?ndices en caso de que exista. |
... | ... | |
39 | 39 |
public void close() throws CloseException; |
40 | 40 |
public void dispose() throws CloseException; |
41 | 41 |
|
42 |
public IDataCollection getDataCollection() throws ReadException, IsNotFeatureSettingException;
|
|
42 |
public IDataCollection getDataCollection() throws ReadException; |
|
43 | 43 |
|
44 | 44 |
public IDataCollection getSelection(); |
45 | 45 |
public void setSelection(IDataCollection selection); |
... | ... | |
56 | 56 |
public boolean isEditable(); |
57 | 57 |
public void startEditing() throws ReadException; |
58 | 58 |
public void cancelEditing(); |
59 |
public void finishEditing() throws WriteException, ReadException, IsNotFeatureSettingException;
|
|
59 |
public void finishEditing() throws WriteException, ReadException; |
|
60 | 60 |
public boolean isEditing(); |
61 | 61 |
|
62 | 62 |
public void undo(); |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/CreatedFeature.java | ||
---|---|---|
12 | 12 |
super(feature); |
13 | 13 |
} |
14 | 14 |
|
15 |
public CreatedFeature(IFeatureType type, boolean b) throws NumberFormatException, IsNotFeatureSettingException {
|
|
15 |
public CreatedFeature(IFeatureType type, boolean b) { |
|
16 | 16 |
super(type,b); |
17 | 17 |
} |
18 | 18 |
|
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/MemoryFeature.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.vectorial; |
2 | 2 |
|
3 | 3 |
import java.text.ParseException; |
4 |
import java.util.Date; |
|
4 | 5 |
import java.util.Iterator; |
5 | 6 |
import java.util.List; |
6 | 7 |
|
... | ... | |
32 | 33 |
|
33 | 34 |
} |
34 | 35 |
|
35 |
public MemoryFeature(IFeatureType type,boolean defaultValues) throws NumberFormatException, IsNotFeatureSettingException {
|
|
36 |
public MemoryFeature(IFeatureType type,boolean defaultValues) { |
|
36 | 37 |
super(type); |
37 | 38 |
if (defaultValues){ |
38 | 39 |
Iterator iterator=type.iterator(); |
... | ... | |
44 | 45 |
|
45 | 46 |
Object defaultValue=featureAttribute.getDefaultValue(); |
46 | 47 |
if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_BYTE)){ |
47 |
set(i,Byte.parseByte((String)defaultValue)); |
|
48 |
try { |
|
49 |
set(i,Byte.parseByte((String)defaultValue)); |
|
50 |
} catch (IsNotFeatureSettingException e) { |
|
51 |
e.printStackTrace(); |
|
52 |
} |
|
48 | 53 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_DATE)){ |
49 | 54 |
try { |
50 | 55 |
set(i,type.getDateFormat().parse((String)defaultValue)); |
... | ... | |
93 | 98 |
// TODO Auto-generated method stub |
94 | 99 |
return null; |
95 | 100 |
} |
96 |
|
|
97 | 101 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/Feature.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.ArrayList; |
4 | 4 |
import java.util.Date; |
5 |
import java.util.HashMap; |
|
6 | 5 |
import java.util.Iterator; |
7 |
import java.util.Map; |
|
8 | 6 |
|
9 | 7 |
public abstract class Feature extends ArrayList implements IFeature{ |
10 | 8 |
protected IFeatureType featureType; |
11 | 9 |
protected Object defaultGeometry; |
12 | 10 |
protected Object object; |
13 | 11 |
private boolean editing = false; |
14 |
private HashMap originalValues=new HashMap(); |
|
12 |
// private HashMap originalValues=new HashMap();
|
|
15 | 13 |
private boolean loading = false; |
14 |
private IFeature oldFeature; |
|
16 | 15 |
|
16 |
protected IFeature cloneFeature() throws IsNotFeatureSettingException { |
|
17 |
MemoryFeature mfeature=new MemoryFeature(featureType,false); |
|
18 |
Iterator iterator=featureType.iterator(); |
|
19 |
this.loading(); |
|
20 |
while(iterator.hasNext()){ |
|
21 |
IFeatureAttributeDescriptor featureAttribute=(IFeatureAttributeDescriptor)iterator.next(); |
|
22 |
int i=featureAttribute.ordinal(); |
|
23 |
String attributeType=featureAttribute.getDataType(); |
|
24 |
if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_BYTE)){ |
|
25 |
set(i,this.getByte(i)); |
|
26 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_DATE)){ |
|
27 |
set(i,(Date)this.getDate(i).clone()); |
|
28 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_DOUBLE)){ |
|
29 |
set(i,getDouble(i)); |
|
30 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_FLOAT)){ |
|
31 |
set(i,getFloat(i)); |
|
32 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_GEOMETRY)){ |
|
33 |
//TODO falta clonar la geometr?a |
|
34 |
set(i,getGeometry(i)); |
|
35 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_INT)){ |
|
36 |
set(i,getInt(i)); |
|
37 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_LONG)){ |
|
38 |
set(i,getLong(i)); |
|
39 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_OBJECT)){ |
|
40 |
//TODO falta clonar el objeto |
|
41 |
set(i,get(i)); |
|
42 |
}else if (attributeType.equals(IFeatureAttributeDescriptor.TYPE_STRING)){ |
|
43 |
set(i,getString(i)); |
|
44 |
} |
|
45 |
i++; |
|
46 |
} |
|
47 |
this.stopLoading(); |
|
48 |
return mfeature; |
|
49 |
} |
|
50 |
|
|
17 | 51 |
public Feature(IFeatureType featureType){ |
18 | 52 |
super(featureType.size()); |
19 | 53 |
this.featureType=featureType; |
... | ... | |
151 | 185 |
if (!editing && !loading) |
152 | 186 |
throw new IsNotFeatureSettingException("setInt"); |
153 | 187 |
int i=featureType.getFieldIndex(name); |
154 |
if (editing) |
|
155 |
originalValues.put(new Integer(i),new Integer(getInt(i)));
|
|
188 |
// if (editing)
|
|
189 |
// oldFeature.set(name,value);
|
|
156 | 190 |
super.set(i,new Integer(value)); |
157 | 191 |
// put(name,new Integer(value)); |
158 | 192 |
|
... | ... | |
162 | 196 |
if (!editing && !loading) |
163 | 197 |
throw new IsNotFeatureSettingException("setBoolean"); |
164 | 198 |
int i=featureType.getFieldIndex(name); |
165 |
if (editing) |
|
166 |
originalValues.put(new Integer(i),new Boolean(getBoolean(i)));
|
|
199 |
// if (editing)
|
|
200 |
// oldFeature.set(i,value);
|
|
167 | 201 |
super.set(i,new Boolean(value)); |
168 | 202 |
// put(name,new Boolean(value)); |
169 | 203 |
} |
... | ... | |
172 | 206 |
if (!editing && !loading) |
173 | 207 |
throw new IsNotFeatureSettingException("setLong"); |
174 | 208 |
int i=featureType.getFieldIndex(name); |
175 |
if (editing) |
|
176 |
originalValues.put(new Integer(i),new Long(getLong(i)));
|
|
209 |
// if (editing)
|
|
210 |
// oldFeature.set(i,value);
|
|
177 | 211 |
super.set(i,new Long(value)); |
178 | 212 |
// put(name,new Long(value)); |
179 | 213 |
} |
... | ... | |
182 | 216 |
if (!editing && !loading) |
183 | 217 |
throw new IsNotFeatureSettingException("setFloat"); |
184 | 218 |
int i=featureType.getFieldIndex(name); |
185 |
if (editing) |
|
186 |
originalValues.put(new Integer(i),new Float(getFloat(i)));
|
|
219 |
// if (editing)
|
|
220 |
// oldFeature.set(i,value);
|
|
187 | 221 |
super.set(i,new Float(value)); |
188 | 222 |
// put(name,new Float(value)); |
189 | 223 |
} |
... | ... | |
192 | 226 |
if (!editing && !loading) |
193 | 227 |
throw new IsNotFeatureSettingException("setDouble"); |
194 | 228 |
int i=featureType.getFieldIndex(name); |
195 |
if (editing) |
|
196 |
originalValues.put(new Integer(i),new Double(getDouble(i)));
|
|
229 |
// if (editing)
|
|
230 |
// oldFeature.set(i,value);
|
|
197 | 231 |
super.set(i,new Double(value)); |
198 | 232 |
// put(name,new Double(value)); |
199 | 233 |
} |
... | ... | |
201 | 235 |
public void setObject(int index, Object value) throws IsNotFeatureSettingException { |
202 | 236 |
if (!editing && !loading) |
203 | 237 |
throw new IsNotFeatureSettingException("setObject"); |
204 |
if (editing){ |
|
205 |
//TODO falta comprobar que tipo y guardarlo en el originalValues |
|
206 |
} |
|
238 |
// if (editing){
|
|
239 |
// //TODO falta comprobar que tipo y guardarlo en el originalValues
|
|
240 |
// }
|
|
207 | 241 |
super.set(index,value); |
208 | 242 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
209 | 243 |
// |
... | ... | |
213 | 247 |
public void set(int index, int value) throws IsNotFeatureSettingException { |
214 | 248 |
if (!editing && !loading) |
215 | 249 |
throw new IsNotFeatureSettingException("setInt"); |
216 |
if (editing) |
|
217 |
originalValues.put(new Integer(index),new Integer(getInt(index)));
|
|
250 |
// if (editing)
|
|
251 |
// oldFeature.set(index,value);
|
|
218 | 252 |
super.set(index,new Integer(value)); |
219 | 253 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
220 | 254 |
// put(name,new Integer(value)); |
... | ... | |
223 | 257 |
public void set(int index, boolean value) throws IsNotFeatureSettingException { |
224 | 258 |
if (!editing && !loading) |
225 | 259 |
throw new IsNotFeatureSettingException("setBoolean"); |
226 |
if (editing) |
|
227 |
originalValues.put(new Integer(index),new Boolean(getBoolean(index)));
|
|
260 |
// if (editing)
|
|
261 |
// oldFeature.set(index,value);
|
|
228 | 262 |
super.set(index,new Boolean(value)); |
229 | 263 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
230 | 264 |
// put(name,new Boolean(value)); |
... | ... | |
233 | 267 |
public void set(int index, long value) throws IsNotFeatureSettingException { |
234 | 268 |
if (!editing && !loading) |
235 | 269 |
throw new IsNotFeatureSettingException("setLong"); |
236 |
if (editing) |
|
237 |
originalValues.put(new Integer(index),new Long(getLong(index)));
|
|
270 |
// if (editing)
|
|
271 |
// oldFeature.set(index,value);
|
|
238 | 272 |
super.set(index,new Long(value)); |
239 | 273 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
240 | 274 |
// put(name,new Long(value)); |
... | ... | |
243 | 277 |
public void set(int index, float value) throws IsNotFeatureSettingException { |
244 | 278 |
if (!editing && !loading) |
245 | 279 |
throw new IsNotFeatureSettingException("setFloat"); |
246 |
if (editing) |
|
247 |
originalValues.put(new Integer(index),new Float(getFloat(index)));
|
|
280 |
// if (editing)
|
|
281 |
// oldFeature.set(index,value);
|
|
248 | 282 |
super.set(index,new Float(value)); |
249 | 283 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
250 | 284 |
// put(name,new Float(value)); |
... | ... | |
253 | 287 |
public void set(int index, double value) throws IsNotFeatureSettingException { |
254 | 288 |
if (!editing && !loading) |
255 | 289 |
throw new IsNotFeatureSettingException("setDouble"); |
256 |
if (editing) |
|
257 |
originalValues.put(new Integer(index),new Double(getDouble(index)));
|
|
290 |
// if (editing)
|
|
291 |
// oldFeature.set(index,value);
|
|
258 | 292 |
super.set(index,new Double(value)); |
259 | 293 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
260 | 294 |
// put(name,new Double(value)); |
... | ... | |
301 | 335 |
public void set(int index, byte value) throws IsNotFeatureSettingException { |
302 | 336 |
if (!editing && !loading) |
303 | 337 |
throw new IsNotFeatureSettingException("setByte"); |
304 |
if (editing) |
|
305 |
originalValues.put(new Integer(index),new Byte(getByte(index)));
|
|
338 |
// if (editing)
|
|
339 |
// oldFeature.set(index,value);
|
|
306 | 340 |
super.set(index,new Byte(value)); |
307 | 341 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
308 | 342 |
// put(name,new Byte(value)); |
... | ... | |
310 | 344 |
public void set(int index, String value) throws IsNotFeatureSettingException { |
311 | 345 |
if (!editing && !loading) |
312 | 346 |
throw new IsNotFeatureSettingException("setString"); |
313 |
if (editing) |
|
314 |
originalValues.put(new Integer(index),new String(getString(index)));
|
|
347 |
// if (editing)
|
|
348 |
// oldFeature.set(index,value);
|
|
315 | 349 |
super.set(index,value); |
316 | 350 |
// String name=((IFeatureAttributeDescriptor)featureType.get(index)).getName(); |
317 | 351 |
// put(name,new Byte(value)); |
... | ... | |
320 | 354 |
if (!editing && !loading) |
321 | 355 |
throw new IsNotFeatureSettingException("setByte"); |
322 | 356 |
int i=featureType.getFieldIndex(name); |
323 |
if (editing) |
|
324 |
originalValues.put(new Integer(i),new Byte(getByte(i)));
|
|
357 |
// if (editing)
|
|
358 |
// oldFeature.set(i,value);
|
|
325 | 359 |
set(i,new Byte(value)); |
326 | 360 |
} |
327 | 361 |
public void setGeometry(String name,Object geometry) throws IsNotFeatureSettingException { |
328 | 362 |
if (!editing && !loading) |
329 | 363 |
throw new IsNotFeatureSettingException("setGeometry"); |
330 | 364 |
int i=featureType.getFieldIndex(name); |
331 |
if (editing){ |
|
332 |
//TODO falta poder clonar la geometr?a |
|
333 |
// originalValues.put(new Integer(i),getGeometry(i).clone()); |
|
334 |
} |
|
365 |
// if (editing){
|
|
366 |
// //TODO falta poder clonar la geometr?a
|
|
367 |
//// originalValues.put(new Integer(i),getGeometry(i).clone());
|
|
368 |
// }
|
|
335 | 369 |
set(i,geometry); |
336 | 370 |
if (featureType.getDefaultGeometry().equals(name)){ |
337 | 371 |
defaultGeometry=geometry; |
... | ... | |
357 | 391 |
} |
358 | 392 |
public void cancelEditing() { |
359 | 393 |
editing=false; |
360 |
originalValues.clear(); |
|
394 |
oldFeature=null; |
|
395 |
// originalValues.clear(); |
|
361 | 396 |
|
362 | 397 |
} |
363 |
public void editing() { |
|
398 |
public void editing() throws IsNotFeatureSettingException {
|
|
364 | 399 |
editing=true; |
400 |
oldFeature=this.cloneFeature(); |
|
365 | 401 |
// originalValues.addAll(this); |
366 | 402 |
} |
367 |
public Map getOriginalValues() {
|
|
368 |
return originalValues;
|
|
403 |
public IFeature getOldFeature() {
|
|
404 |
return oldFeature;
|
|
369 | 405 |
} |
370 | 406 |
public void loading(){ |
371 | 407 |
loading=true; |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/joinstore/JoinFetureStore.java | ||
---|---|---|
55 | 55 |
import org.gvsig.data.vectorial.IFeatureStore; |
56 | 56 |
import org.gvsig.data.vectorial.IFeatureStoreNotification; |
57 | 57 |
import org.gvsig.data.vectorial.IFeatureType; |
58 |
import org.gvsig.data.vectorial.IsNotAttributeSettingException; |
|
58 | 59 |
import org.gvsig.data.vectorial.IsNotFeatureSettingException; |
59 | 60 |
import org.gvsig.exceptions.BaseException; |
60 | 61 |
import org.gvsig.metadata.IMetadata; |
... | ... | |
184 | 185 |
/* (non-Javadoc) |
185 | 186 |
* @see org.gvsig.data.IDataStore#open() |
186 | 187 |
*/ |
187 |
public void open() throws OpenException, IsNotFeatureSettingException {
|
|
188 |
public void open() throws OpenException { |
|
188 | 189 |
this.storePrimary.open(); |
189 | 190 |
this.storeSecondary.open(); |
190 | 191 |
|
... | ... | |
214 | 215 |
String prefix = jParams.getFieldNamePrefix(); |
215 | 216 |
while(iter.hasNext()){ |
216 | 217 |
DefaultAttributeDescriptor attr = (DefaultAttributeDescriptor) iter.next(); |
217 |
attr.setName(prefix + attr.getName()); |
|
218 |
attr.loading(); |
|
219 |
try { |
|
220 |
attr.setName(prefix + attr.getName()); |
|
221 |
} catch (IsNotAttributeSettingException e) { |
|
222 |
throw new InitializeException("Is not posible change AttributeDescriptor",this.getName()); |
|
223 |
} |
|
224 |
attr.stopLoading(); |
|
218 | 225 |
this.featureType.add(attr); |
219 | 226 |
} |
220 | 227 |
this.linkFieldSecondary = prefix + jParams.getLinkFieldSecondary(); |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/AbstractFeatureStore.java | ||
---|---|---|
55 | 55 |
featureManager=new FeatureManager(expansionFeatureAdapter); |
56 | 56 |
} |
57 | 57 |
|
58 |
public IDataCollection getDataCollection() throws ReadException, IsNotFeatureSettingException {
|
|
58 |
public IDataCollection getDataCollection() throws ReadException { |
|
59 | 59 |
return getDataCollection(null, null, null); |
60 | 60 |
} |
61 | 61 |
|
... | ... | |
295 | 295 |
|
296 | 296 |
} |
297 | 297 |
|
298 |
public void finishEditing() throws WriteException, ReadException, IsNotFeatureSettingException {
|
|
298 |
public void finishEditing() throws WriteException, ReadException{ |
|
299 | 299 |
if( !alterMode ) { |
300 | 300 |
//FIXME: OJO arreglar esta excepci?n!!! |
301 | 301 |
throw new RuntimeException("alterMode is false"); |
... | ... | |
324 | 324 |
|
325 | 325 |
} |
326 | 326 |
|
327 |
protected abstract void doFinishEdition() throws WriteException, ReadException, IsNotFeatureSettingException ;
|
|
327 |
protected abstract void doFinishEdition() throws WriteException, ReadException ; |
|
328 | 328 |
|
329 | 329 |
|
330 | 330 |
public Iterator getChilds() { |
... | ... | |
367 | 367 |
return alterMode; |
368 | 368 |
} |
369 | 369 |
|
370 |
protected void validateEndEditing() throws ReadException, IsNotFeatureSettingException{
|
|
370 |
protected void validateEndEditing() throws ReadException{ |
|
371 | 371 |
IFeatureCollection collection = (IFeatureCollection)this.getDataCollection(); |
372 | 372 |
Iterator iter = collection.iterator(); |
373 | 373 |
while (iter.hasNext()){ |
... | ... | |
434 | 434 |
return feature; |
435 | 435 |
} |
436 | 436 |
|
437 |
public IFeature createDefaultFeature(boolean defaultValues) throws IsNotFeatureSettingException {
|
|
437 |
public IFeature createDefaultFeature(boolean defaultValues){ |
|
438 | 438 |
IFeature feature=new CreatedFeature(getDefaultFeatureType(),defaultValues); |
439 | 439 |
return feature; |
440 | 440 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/MemoryFeatureID.java | ||
---|---|---|
7 | 7 |
public MemoryFeatureID(IFeature feature){ |
8 | 8 |
this.feature=feature; |
9 | 9 |
} |
10 |
public IFeature getFeature(IFeatureType featureType) throws IsNotFeatureSettingException { |
|
11 |
IFeature auxFeature=new MemoryFeature(featureType,false); |
|
12 |
Iterator iterator=featureType.iterator(); |
|
10 |
public IFeature getFeature(IFeatureType featureType) { |
|
11 |
IFeature auxFeature=new MemoryFeature(featureType,false); |
|
12 |
Iterator iterator=featureType.iterator(); |
|
13 |
try{ |
|
13 | 14 |
auxFeature.loading(); |
14 | 15 |
while (iterator.hasNext()) { |
15 | 16 |
IFeatureAttributeDescriptor fad = (IFeatureAttributeDescriptor) iterator.next(); |
... | ... | |
41 | 42 |
} |
42 | 43 |
} |
43 | 44 |
auxFeature.stopLoading(); |
45 |
}catch (IsNotFeatureSettingException e) { |
|
46 |
e.printStackTrace(); |
|
47 |
} |
|
44 | 48 |
return auxFeature; |
45 | 49 |
} |
46 | 50 |
public boolean equals(Object obj) { |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/IFeature.java | ||
---|---|---|
81 | 81 |
public String getDefaultSRS(); |
82 | 82 |
public IFeature getFeature(String name); |
83 | 83 |
|
84 |
public void editing(); |
|
84 |
public void editing() throws IsNotFeatureSettingException;
|
|
85 | 85 |
public void cancelEditing(); |
86 |
public Map getOriginalValues();
|
|
86 |
public IFeature getOldFeature();
|
|
87 | 87 |
public void loading(); |
88 | 88 |
public void stopLoading(); |
89 | 89 |
|
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/DefaultAttributeDescriptor.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
package org.gvsig.data.vectorial; |
44 | 44 |
|
45 |
import java.util.HashMap; |
|
46 | 45 |
|
47 | 46 |
|
48 | 47 |
/** |
... | ... | |
68 | 67 |
protected boolean readOnly; |
69 | 68 |
protected String expression; |
70 | 69 |
|
71 |
private boolean editing = false;
|
|
72 |
private HashMap originalValues=new HashMap();
|
|
73 |
private boolean loading = false;
|
|
70 |
protected boolean editing = false;
|
|
71 |
protected IFeatureAttributeDescriptor oldAttributeDescriptor;
|
|
72 |
protected boolean loading = false;
|
|
74 | 73 |
|
75 | 74 |
public DefaultAttributeDescriptor() { |
76 | 75 |
} |
... | ... | |
151 | 150 |
public void setName(String name) throws IsNotAttributeSettingException { |
152 | 151 |
if (!editing && !loading) |
153 | 152 |
throw new IsNotAttributeSettingException("setName"); |
154 |
if (editing) |
|
155 |
originalValues.put("name",this.name); |
|
153 |
// if (editing)
|
|
154 |
// originalValues.put("name",this.name);
|
|
156 | 155 |
this.name = name; |
157 | 156 |
} |
158 | 157 |
|
... | ... | |
166 | 165 |
public void setPrecision(int precision) throws IsNotAttributeSettingException { |
167 | 166 |
if (!editing && !loading) |
168 | 167 |
throw new IsNotAttributeSettingException("setPrecision"); |
169 |
if (editing) |
|
170 |
originalValues.put("precision",new Integer(this.precision)); |
|
168 |
// if (editing)
|
|
169 |
// originalValues.put("precision",new Integer(this.precision));
|
|
171 | 170 |
this.precision = precision; |
172 | 171 |
} |
173 | 172 |
public void setSize(int size) throws IsNotAttributeSettingException { |
174 | 173 |
if (!editing && !loading) |
175 | 174 |
throw new IsNotAttributeSettingException("setSize"); |
176 |
if (editing) |
|
177 |
originalValues.put("size",new Integer(this.size)); |
|
175 |
// if (editing)
|
|
176 |
// originalValues.put("size",new Integer(this.size));
|
|
178 | 177 |
this.size = size; |
179 | 178 |
} |
180 | 179 |
public void setType(String type) throws IsNotAttributeSettingException { |
181 | 180 |
if (!editing && !loading) |
182 | 181 |
throw new IsNotAttributeSettingException("setType"); |
183 |
if (editing) |
|
184 |
originalValues.put("type",this.type); |
|
182 |
// if (editing)
|
|
183 |
// originalValues.put("type",this.type);
|
|
185 | 184 |
this.type = type; |
186 | 185 |
} |
187 | 186 |
public String getSRS() { |
... | ... | |
190 | 189 |
public void setSRS(String srs) throws IsNotAttributeSettingException { |
191 | 190 |
if (!editing && !loading) |
192 | 191 |
throw new IsNotAttributeSettingException("setSRS"); |
193 |
if (editing) |
|
194 |
originalValues.put("srs",this.srs); |
|
192 |
// if (editing)
|
|
193 |
// originalValues.put("srs",this.srs);
|
|
195 | 194 |
this.srs=srs; |
196 | 195 |
} |
197 | 196 |
public int getGeometryType() { |
... | ... | |
200 | 199 |
public void setGeometryType(int type) throws IsNotAttributeSettingException{ |
201 | 200 |
if (!editing && !loading) |
202 | 201 |
throw new IsNotAttributeSettingException("setGeometryType"); |
203 |
if (editing) |
|
204 |
originalValues.put("geometryType",new Integer(this.geometryType)); |
|
202 |
// if (editing)
|
|
203 |
// originalValues.put("geometryType",new Integer(this.geometryType));
|
|
205 | 204 |
this.geometryType=type; |
206 | 205 |
} |
207 | 206 |
public Object getDefaultValue() { |
... | ... | |
281 | 280 |
} |
282 | 281 |
public void editing() { |
283 | 282 |
editing=true; |
284 |
|
|
283 |
oldAttributeDescriptor=this.cloneAttribute(); |
|
285 | 284 |
} |
286 | 285 |
public void cancelEditing() { |
287 | 286 |
editing=false; |
288 |
originalValues.clear();
|
|
287 |
oldAttributeDescriptor=null;
|
|
289 | 288 |
} |
290 |
public HashMap getOriginalValues() {
|
|
291 |
return (HashMap)originalValues.clone();
|
|
289 |
public IFeatureAttributeDescriptor getOldAttributeDescriptor() {
|
|
290 |
return oldAttributeDescriptor;
|
|
292 | 291 |
} |
293 |
|
|
294 |
|
|
295 | 292 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/IFeatureStore.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
public interface IFeatureStore extends IDataStore{ |
12 | 12 |
|
13 |
public IDataCollection getDataCollection(IFeatureType type, String filter, String order) throws ReadException, IsNotFeatureSettingException;
|
|
13 |
public IDataCollection getDataCollection(IFeatureType type, String filter, String order) throws ReadException; |
|
14 | 14 |
|
15 | 15 |
/** |
16 | 16 |
* Para la carga en background |
... | ... | |
18 | 18 |
public void getDataCollection(IFeatureType type, String filter, String order,IObserver observer); |
19 | 19 |
public void getDataCollection(IObserver observer); |
20 | 20 |
|
21 |
public IFeature getFeatureByID(IFeatureID id) throws ReadException, IsNotFeatureSettingException;
|
|
21 |
public IFeature getFeatureByID(IFeatureID id) throws ReadException; |
|
22 | 22 |
// public IFeature getFeatureByPosition(long position); |
23 | 23 |
|
24 | 24 |
|
25 | 25 |
public List getFeatureTypes(); |
26 | 26 |
public IFeature createFeature(IFeatureType type) throws IsNotFeatureSettingException; |
27 | 27 |
|
28 |
public IFeature createDefaultFeature(boolean defaultValues) throws IsNotFeatureSettingException;
|
|
28 |
public IFeature createDefaultFeature(boolean defaultValues); |
|
29 | 29 |
public IFeatureType getDefaultFeatureType(); |
30 | 30 |
|
31 | 31 |
public void update(IFeature feature); |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/IFeatureID.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
public interface IFeatureID { |
7 | 7 |
|
8 |
public IFeature getFeature(IFeatureType featureType) throws ReadException, NumberFormatException, IsNotFeatureSettingException;
|
|
8 |
public IFeature getFeature(IFeatureType featureType) throws ReadException; |
|
9 | 9 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/expansionadapter/AttributeManager.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
import java.util.ArrayList; |
46 | 46 |
import java.util.HashMap; |
47 |
import java.util.Iterator; |
|
47 | 48 |
|
48 | 49 |
import org.gvsig.data.vectorial.IFeatureAttributeDescriptor; |
49 | 50 |
import org.gvsig.data.vectorial.IFeatureType; |
... | ... | |
121 | 122 |
* @param feature DOCUMENT ME! |
122 | 123 |
* @param oldFeature DOCUMENT ME! |
123 | 124 |
*/ |
124 |
public void updateAttribute(IFeatureAttributeDescriptor attributeDescriptor, IFeatureAttributeDescriptor oldAttributeDescriptor) {
|
|
125 |
deletedAttributes.add(oldAttributeDescriptor.getName());
|
|
125 |
public void updateAttribute(IFeatureAttributeDescriptor attributeDescriptor) { |
|
126 |
deletedAttributes.add(attributeDescriptor.getName());
|
|
126 | 127 |
|
127 | 128 |
int num = expansionAdapter.updateObject(attributeDescriptor); |
128 | 129 |
|
... | ... | |
148 | 149 |
public IFeatureType getFeatureType(IFeatureType featureType) { |
149 | 150 |
IFeatureType ft=featureType.cloneFeatureType(); |
150 | 151 |
ft.clear(); |
151 |
for (int i=0;i<featureType.size();i++){ |
|
152 |
IFeatureAttributeDescriptor descriptor=(IFeatureAttributeDescriptor)featureType.get(i); |
|
152 |
Iterator iter=featureType.iterator(); |
|
153 |
while (iter.hasNext()) { |
|
154 |
IFeatureAttributeDescriptor descriptor= (IFeatureAttributeDescriptor) iter.next(); |
|
153 | 155 |
if (!deletedAttributes.contains(descriptor)){ |
154 | 156 |
ft.add(descriptor); |
155 | 157 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/IFeatureAttributeDescriptor.java | ||
---|---|---|
117 | 117 |
void editing(); |
118 | 118 |
void cancelEditing(); |
119 | 119 |
|
120 |
HashMap getOriginalValues();
|
|
120 |
IFeatureAttributeDescriptor getOldAttributeDescriptor();
|
|
121 | 121 |
} |
Also available in: Unified diff