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