Revision 45739 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureUpdateCommand.java
FeatureUpdateCommand.java | ||
---|---|---|
29 | 29 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore; |
30 | 30 |
import org.gvsig.tools.undo.UndoException; |
31 | 31 |
|
32 |
|
|
33 | 32 |
/** |
34 |
* DOCUMENT ME! |
|
35 | 33 |
* |
36 |
* @author Vicente Caballero Navarro
|
|
34 |
* @author gvSIG Team
|
|
37 | 35 |
*/ |
38 | 36 |
public class FeatureUpdateCommand extends AbstractFeatureCommand { |
39 |
private Feature oldFeature; |
|
40 | 37 |
|
41 |
public FeatureUpdateCommand(DefaultFeatureStore featureStore, |
|
42 |
Feature feature, Feature oldFeature, String description) { |
|
38 |
private final Feature oldFeature; |
|
39 |
|
|
40 |
public FeatureUpdateCommand(DefaultFeatureStore featureStore, |
|
41 |
EditableFeature feature, Feature oldFeature, String description) { |
|
43 | 42 |
super(featureStore, feature, description); |
44 | 43 |
this.oldFeature = oldFeature; |
45 | 44 |
} |
46 | 45 |
|
46 |
@Override |
|
47 |
public EditableFeature getFeature() { |
|
48 |
return (EditableFeature) this.feature; |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
47 | 52 |
public void undo() throws UndoException { |
48 | 53 |
try { |
49 |
featureStore.doUpdate(oldFeature.getEditable(),
|
|
50 |
((EditableFeature)feature).getNotEditableCopy());
|
|
54 |
featureStore.doUpdate(oldFeature.getEditable(), |
|
55 |
getFeature().getNotEditableCopy());
|
|
51 | 56 |
} catch (DataException e) { |
52 | 57 |
throw new UndoException(this, e); |
53 | 58 |
} |
54 | 59 |
} |
55 | 60 |
|
61 |
@Override |
|
56 | 62 |
public int getType() { |
57 | 63 |
return UPDATE; |
58 | 64 |
} |
59 |
|
|
65 |
|
|
66 |
@Override |
|
60 | 67 |
public void execute() throws DataException { |
61 |
featureStore.doUpdate((EditableFeature)feature, oldFeature);
|
|
68 |
featureStore.doUpdate(getFeature(), oldFeature);
|
|
62 | 69 |
} |
63 | 70 |
|
64 |
public Feature getOldFeature() {
|
|
65 |
return oldFeature;
|
|
66 |
}
|
|
71 |
public Feature getOldFeature() {
|
|
72 |
return oldFeature;
|
|
73 |
}
|
|
67 | 74 |
} |
Also available in: Unified diff