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