Revision 37595 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureInsertCommand.java
FeatureInsertCommand.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
package org.gvsig.fmap.dal.feature.impl.undo.command; |
44 | 44 |
|
45 |
import org.gvsig.fmap.dal.exception.DataException; |
|
46 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
45 | 47 |
import org.gvsig.fmap.dal.feature.Feature; |
46 |
import org.gvsig.fmap.dal.feature.impl.FeatureManager; |
|
47 |
import org.gvsig.fmap.dal.feature.impl.SpatialManager; |
|
48 |
import org.gvsig.tools.undo.RedoException; |
|
48 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore; |
|
49 | 49 |
import org.gvsig.tools.undo.UndoException; |
50 | 50 |
|
51 | 51 |
|
... | ... | |
56 | 56 |
*/ |
57 | 57 |
public class FeatureInsertCommand extends AbstractFeatureCommand { |
58 | 58 |
|
59 |
public FeatureInsertCommand(FeatureManager expansionManager, |
|
60 |
SpatialManager spatialManager,Feature feature, |
|
61 |
String description) { |
|
62 |
super(expansionManager, spatialManager, feature, description); |
|
59 |
public FeatureInsertCommand(DefaultFeatureStore featureStore, |
|
60 |
Feature feature, String description) { |
|
61 |
super(featureStore, feature, description); |
|
63 | 62 |
} |
64 | 63 |
|
65 | 64 |
public void undo() throws UndoException { |
66 |
expansionManager.delete(feature.getReference()); |
|
67 |
spatialManager.deleteFeature(feature); |
|
65 |
try { |
|
66 |
featureStore.doDelete(((EditableFeature)feature).getNotEditableCopy()); |
|
67 |
} catch (DataException e) { |
|
68 |
throw new UndoException(this, e); |
|
69 |
} |
|
68 | 70 |
} |
69 | 71 |
|
70 |
public void redo() throws RedoException { |
|
71 |
execute(); |
|
72 |
} |
|
73 |
|
|
74 | 72 |
public int getType() { |
75 | 73 |
return INSERT; |
76 | 74 |
} |
77 | 75 |
|
78 |
/* (non-Javadoc) |
|
79 |
* @see org.gvsig.fmap.dal.commands.Command#execute() |
|
80 |
*/ |
|
81 |
public void execute() { |
|
82 |
expansionManager.add(feature); |
|
83 |
spatialManager.insertFeature(feature); |
|
76 |
public void execute() throws DataException { |
|
77 |
featureStore.doInsert((EditableFeature)feature); |
|
84 | 78 |
} |
85 | 79 |
} |
Also available in: Unified diff