svn-gvsig-desktop / 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 / editing / memory / MemoryEditingManager.java @ 47034
History | View | Annotate | Download (4.36 KB)
1 |
|
---|---|
2 |
package org.gvsig.fmap.dal.feature.impl.editing.memory; |
3 |
|
4 |
import java.util.Iterator; |
5 |
import java.util.List; |
6 |
import org.gvsig.fmap.dal.exception.DataException; |
7 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
8 |
import org.gvsig.fmap.dal.feature.Feature; |
9 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
10 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
11 |
import org.gvsig.fmap.dal.feature.FeatureType; |
12 |
import org.gvsig.fmap.dal.feature.FeatureType.FeatureTypeChanged; |
13 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore; |
14 |
import org.gvsig.fmap.dal.feature.impl.EditingManager; |
15 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
16 |
import org.gvsig.fmap.geom.primitive.Envelope; |
17 |
|
18 |
|
19 |
public class MemoryEditingManager implements EditingManager { |
20 |
|
21 |
private final FeatureTypeManager featureTypeManager; |
22 |
private final FeatureManager featureManager; |
23 |
private final SpatialManager spatialManager; |
24 |
|
25 |
public MemoryEditingManager(DefaultFeatureStore store, Envelope envelope) throws DataException { |
26 |
this.featureManager = new FeatureManager(store); |
27 |
this.featureTypeManager = new FeatureTypeManager(store); |
28 |
this.spatialManager = new SpatialManager(store); |
29 |
} |
30 |
|
31 |
@Override
|
32 |
public void dispose() { |
33 |
this.featureTypeManager.dispose();
|
34 |
this.spatialManager.clear();
|
35 |
this.featureManager.clear();
|
36 |
} |
37 |
|
38 |
@Override
|
39 |
public void delete(Feature feature) { |
40 |
this.featureManager.delete(feature);
|
41 |
this.spatialManager.deleteFeature(feature);
|
42 |
} |
43 |
|
44 |
// @Override
|
45 |
// public void delete(FeatureReference featureReference) {
|
46 |
// // ????????
|
47 |
// this.featureManager.delete(featureReference);
|
48 |
//
|
49 |
// }
|
50 |
|
51 |
@Override
|
52 |
public void add(EditableFeature newFeature) { |
53 |
this.featureManager.add(newFeature);
|
54 |
this.spatialManager.insertFeature(newFeature);
|
55 |
} |
56 |
|
57 |
@Override
|
58 |
public int update(EditableFeature newFeature, Feature oldFeature) { |
59 |
int code = featureManager.update(newFeature, oldFeature);
|
60 |
spatialManager.updateFeature(newFeature, oldFeature); |
61 |
return code;
|
62 |
} |
63 |
|
64 |
@Override
|
65 |
public int update(FeatureType newFeatureType, FeatureType oldFeatureType) { |
66 |
int code = featureTypeManager.update(oldFeatureType, oldFeatureType);
|
67 |
return code;
|
68 |
} |
69 |
|
70 |
|
71 |
@Override
|
72 |
public boolean isSelectionCompromised() { |
73 |
return this.featureManager.isSelectionCompromised(); |
74 |
} |
75 |
|
76 |
@Override
|
77 |
public Iterator<FeatureReference> getDeletedFeatures() { |
78 |
return this.featureManager.getDeleted(); |
79 |
} |
80 |
|
81 |
@Override
|
82 |
public Iterator<FeatureProvider> getInsertedFeatures() { |
83 |
return this.featureManager.getInserted(); |
84 |
} |
85 |
|
86 |
@Override
|
87 |
public Iterator<FeatureProvider> getUpdatedFeatures() { |
88 |
return this.featureManager.getUpdated(); |
89 |
} |
90 |
|
91 |
@Override
|
92 |
public List<FeatureTypeChanged> getFeatureTypesChanged() throws DataException { |
93 |
return this.featureTypeManager.getFeatureTypesChanged(); |
94 |
} |
95 |
|
96 |
@Override
|
97 |
public FeatureType getFeatureType(String id) throws DataException { |
98 |
return this.featureTypeManager.getType(id); |
99 |
} |
100 |
|
101 |
@Override
|
102 |
public Feature getFeature(FeatureReference reference, FeatureStore store, FeatureType type) throws DataException { |
103 |
return this.featureManager.get(reference, store, type); |
104 |
} |
105 |
|
106 |
@Override
|
107 |
public void restore(FeatureReference featureReference) { |
108 |
this.featureManager.restore(featureReference);
|
109 |
} |
110 |
|
111 |
@Override
|
112 |
public void restore(FeatureReference featureReference, int code) { |
113 |
this.featureManager.restore(featureReference, code);
|
114 |
} |
115 |
|
116 |
@Override
|
117 |
public void restore(String featureTypeId) { |
118 |
this.featureTypeManager.restore(featureTypeId);
|
119 |
} |
120 |
|
121 |
@Override
|
122 |
public void restore(String featureTypeId, int code) { |
123 |
this.featureTypeManager.restore(featureTypeId, code);
|
124 |
} |
125 |
|
126 |
@Override
|
127 |
public boolean isDeleted(Feature feature) { |
128 |
return this.featureManager.isDeleted(feature); |
129 |
} |
130 |
|
131 |
@Override
|
132 |
public boolean isDeleted(FeatureReference featureReference) { |
133 |
return this.featureManager.isDeleted(featureReference); |
134 |
} |
135 |
|
136 |
@Override
|
137 |
public boolean isDeleted(FeatureType type) { |
138 |
return this.featureTypeManager.isDeleted(type); |
139 |
} |
140 |
|
141 |
@Override
|
142 |
public boolean isDeleted(String featureTypeId) { |
143 |
return this.featureTypeManager.isDeleted(featureTypeId); |
144 |
} |
145 |
|
146 |
} |