Revision 37595 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java

View differences:

DefaultFeatureCommandsStack.java
1 1
package org.gvsig.fmap.dal.feature.impl.undo;
2 2

  
3 3
import org.gvsig.fmap.dal.exception.DataException;
4
import org.gvsig.fmap.dal.feature.*;
5
import org.gvsig.fmap.dal.feature.impl.*;
6
import org.gvsig.fmap.dal.feature.impl.undo.command.*;
4
import org.gvsig.fmap.dal.feature.Feature;
5
import org.gvsig.fmap.dal.feature.FeatureReference;
6
import org.gvsig.fmap.dal.feature.FeatureSelection;
7
import org.gvsig.fmap.dal.feature.FeatureType;
8
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection;
9
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
10
import org.gvsig.fmap.dal.feature.impl.FeatureManager;
11
import org.gvsig.fmap.dal.feature.impl.FeatureTypeManager;
12
import org.gvsig.fmap.dal.feature.impl.SpatialManager;
13
import org.gvsig.fmap.dal.feature.impl.undo.command.FTypeUpdateCommand;
14
import org.gvsig.fmap.dal.feature.impl.undo.command.FeatureDeleteCommand;
15
import org.gvsig.fmap.dal.feature.impl.undo.command.FeatureInsertCommand;
16
import org.gvsig.fmap.dal.feature.impl.undo.command.FeatureUpdateCommand;
17
import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandReverse;
18
import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSelect;
19
import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSelectAll;
20
import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSet;
7 21
import org.gvsig.tools.undo.command.impl.DefaultUndoRedoCommandStack;
8 22

  
9 23
/**
......
25 39
    private FeatureManager expansionManager;
26 40
    private SpatialManager spatialManager;
27 41
    private FeatureTypeManager featureTypeManager;
42
    private DefaultFeatureStore featureStore;
28 43

  
29
    public DefaultFeatureCommandsStack(FeatureManager expansionManager,
30
            SpatialManager spatialManager, FeatureTypeManager featureTypeManager) {
44
    public DefaultFeatureCommandsStack(DefaultFeatureStore featureStore,
45
        FeatureManager expansionManager, SpatialManager spatialManager, 
46
        FeatureTypeManager featureTypeManager) {
47
        this.featureStore = featureStore;
31 48
        this.expansionManager = expansionManager;
32 49
        this.spatialManager = spatialManager;
33 50
        this.featureTypeManager = featureTypeManager;
......
81 98
        add(command);
82 99
    }
83 100

  
84
    public void delete(Feature feature) {
85
        FeatureDeleteCommand command = new FeatureDeleteCommand(
86
                expansionManager, spatialManager, feature, "_featureDelete");
101
    public void delete(Feature feature) throws DataException {
102
        FeatureDeleteCommand command = new FeatureDeleteCommand(featureStore,
103
                feature, "_featureDelete");
87 104
        add(command);
88 105
        command.execute();
89 106
    }
90 107

  
91
//    public void delete(FeatureType featureType) {
92
//        FTypeDeleteCommand command = new FTypeDeleteCommand(
93
//                featureTypeManager, featureType, "_typeDelete");
94
//        add(command);
95
//        command.execute();
96
//    }
97

  
98
    public void insert(Feature feature) {
99
        FeatureInsertCommand command = new FeatureInsertCommand(
100
                expansionManager, spatialManager, feature, "_featureInsert");
108
    public void insert(Feature feature) throws DataException {
109
        FeatureInsertCommand command = new FeatureInsertCommand(featureStore,
110
                feature, "_featureInsert");
101 111
        add(command);
102 112
        command.execute();
103 113
    }
104 114

  
105
//    public void insert(FeatureType featureType) {
106
//        FTypeInsertCommand command = new FTypeInsertCommand(
107
//                featureTypeManager, featureType, "_typeInsert");
108
//        add(command);
109
//        command.execute();
110
//    }
111

  
112
    public void update(Feature feature, Feature oldFeature) {
113
        FeatureUpdateCommand command = new FeatureUpdateCommand(
114
                expansionManager, spatialManager, feature, oldFeature,
115
    public void update(Feature feature, Feature oldFeature) throws DataException {
116
        FeatureUpdateCommand command = new FeatureUpdateCommand(featureStore,
117
               feature, oldFeature,
115 118
                "_featureUpdate");
116 119
        add(command);
117 120
        command.execute();

Also available in: Unified diff