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 / DefaultFeatureStoreNotification.java @ 45023
History | View | Annotate | Download (6.33 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright (C) 2007-2013 gvSIG Association.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 3
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 40435 | jjdelcerro | package org.gvsig.fmap.dal.feature.impl; |
25 | |||
26 | 44871 | jjdelcerro | import java.util.Iterator; |
27 | 40435 | jjdelcerro | import org.gvsig.fmap.dal.DataSet; |
28 | import org.gvsig.fmap.dal.DataStore; |
||
29 | import org.gvsig.fmap.dal.feature.EditableFeatureType; |
||
30 | import org.gvsig.fmap.dal.feature.Feature; |
||
31 | import org.gvsig.fmap.dal.feature.FeatureIndex; |
||
32 | 44871 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureReference; |
33 | 40435 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureStoreNotification; |
34 | 44871 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureType; |
35 | import org.gvsig.fmap.dal.feature.FeatureType.FeatureTypeChanged; |
||
36 | import org.gvsig.tools.observer.BaseNotification; |
||
37 | 40435 | jjdelcerro | import org.gvsig.tools.undo.command.Command; |
38 | |||
39 | 44871 | jjdelcerro | public class DefaultFeatureStoreNotification |
40 | extends BaseNotification
|
||
41 | implements FeatureStoreNotification {
|
||
42 | 40435 | jjdelcerro | |
43 | 44871 | jjdelcerro | private static final int VALUE_SOURCE = 0; |
44 | private static final int VALUE_FEATURE = 1; |
||
45 | private static final int VALUE_COLLECTION_RESULT = 2; |
||
46 | private static final int VALUE_LOAD_COLLECTION_SUCCESSFULLY = 3; |
||
47 | private static final int VALUE_EXCEPTION_LOADING = 4; |
||
48 | private static final int VALUE_COMMAND = 5; |
||
49 | private static final int VALUE_FEATURE_INDEX = 6; |
||
50 | private static final int VALUE_FEATURETYPE = 7; |
||
51 | private static final int VALUE_CHANGEDS_FEATURETYPES = 8; |
||
52 | private static final int VALUE_UPDATEDS_FEATURES = 9; |
||
53 | private static final int VALUE_INSERTEDS_FEATURES = 10; |
||
54 | private static final int VALUE_DELETEDS_FEATURES = 11; |
||
55 | private static final int VALUE_IS_SELECTION_COMPROMISED = 12; |
||
56 | 40435 | jjdelcerro | |
57 | 44871 | jjdelcerro | private static final int VALUES_COUNT = 13; |
58 | 40435 | jjdelcerro | |
59 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(String type) { |
60 | super(type, VALUES_COUNT);
|
||
61 | this.setValue(VALUE_LOAD_COLLECTION_SUCCESSFULLY, false); |
||
62 | this.setValue(VALUE_IS_SELECTION_COMPROMISED, false); |
||
63 | } |
||
64 | 40435 | jjdelcerro | |
65 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(DataStore source, String type) { |
66 | this(type);
|
||
67 | this.setValue(VALUE_SOURCE, source);
|
||
68 | } |
||
69 | 40435 | jjdelcerro | |
70 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(DataStore source, String type, Feature feature) { |
71 | this(source, type);
|
||
72 | this.setValue(VALUE_FEATURE, feature);
|
||
73 | } |
||
74 | 40435 | jjdelcerro | |
75 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(DataStore source, String type, Command command) { |
76 | this(source, type);
|
||
77 | this.setValue(VALUE_SOURCE, source);
|
||
78 | this.setValue(VALUE_COMMAND, command);
|
||
79 | } |
||
80 | 40435 | jjdelcerro | |
81 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(DataStore source, String type, Exception exception) { |
82 | this(source, type);
|
||
83 | this.setValue(VALUE_LOAD_COLLECTION_SUCCESSFULLY, false); |
||
84 | this.setValue(VALUE_EXCEPTION_LOADING, exception);
|
||
85 | } |
||
86 | 40435 | jjdelcerro | |
87 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(DataStore source, String type, DataSet collection) { |
88 | this(source, type);
|
||
89 | this.setValue(VALUE_LOAD_COLLECTION_SUCCESSFULLY, true); |
||
90 | this.setValue(VALUE_COLLECTION_RESULT, collection);
|
||
91 | } |
||
92 | 40435 | jjdelcerro | |
93 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(DataStore source, String type, |
94 | EditableFeatureType featureType) { |
||
95 | this(source, type);
|
||
96 | this.setValue(VALUE_FEATURETYPE, featureType);
|
||
97 | } |
||
98 | 40435 | jjdelcerro | |
99 | 44871 | jjdelcerro | public DefaultFeatureStoreNotification(DataStore source, String type, FeatureIndex index) { |
100 | this(source, type);
|
||
101 | this.setValue(VALUE_FEATURE_INDEX, index);
|
||
102 | } |
||
103 | 40435 | jjdelcerro | |
104 | 44871 | jjdelcerro | DefaultFeatureStoreNotification(DataStore source, String type,
|
105 | Iterator<FeatureReference> deleteds,
|
||
106 | Iterator<Feature> inserteds,
|
||
107 | Iterator<Feature> updateds,
|
||
108 | Iterator<FeatureType.FeatureTypeChanged> featureTypesChanged,
|
||
109 | boolean isSelectionCompromised)
|
||
110 | { |
||
111 | this(source, type);
|
||
112 | this.setValue(VALUE_DELETEDS_FEATURES, deleteds);
|
||
113 | this.setValue(VALUE_INSERTEDS_FEATURES, inserteds);
|
||
114 | this.setValue(VALUE_UPDATEDS_FEATURES, updateds);
|
||
115 | this.setValue(VALUE_CHANGEDS_FEATURETYPES, featureTypesChanged);
|
||
116 | this.setValue(VALUE_IS_SELECTION_COMPROMISED, isSelectionCompromised);
|
||
117 | } |
||
118 | 40435 | jjdelcerro | |
119 | 44871 | jjdelcerro | @Override
|
120 | public Feature getFeature() {
|
||
121 | return (Feature) this.getValue(VALUE_FEATURE); |
||
122 | } |
||
123 | 40435 | jjdelcerro | |
124 | 44871 | jjdelcerro | @Override
|
125 | public EditableFeatureType getFeatureType() {
|
||
126 | return (EditableFeatureType) this.getValue(VALUE_FEATURETYPE); |
||
127 | } |
||
128 | 40435 | jjdelcerro | |
129 | 44871 | jjdelcerro | @Override
|
130 | public DataSet getCollectionResult() {
|
||
131 | return (DataSet) this.getValue(VALUE_COLLECTION_RESULT); |
||
132 | } |
||
133 | 40435 | jjdelcerro | |
134 | 44871 | jjdelcerro | @Override
|
135 | public Exception getExceptionLoading() { |
||
136 | return (Exception) this.getValue(VALUE_EXCEPTION_LOADING); |
||
137 | } |
||
138 | 40435 | jjdelcerro | |
139 | 44871 | jjdelcerro | @Override
|
140 | public boolean loadSucefully() { |
||
141 | return (boolean) this.getValue(VALUE_LOAD_COLLECTION_SUCCESSFULLY); |
||
142 | } |
||
143 | 40435 | jjdelcerro | |
144 | 44871 | jjdelcerro | @Override
|
145 | public Command getCommand() {
|
||
146 | return (Command) this.getValue(VALUE_COMMAND); |
||
147 | } |
||
148 | |||
149 | @Override
|
||
150 | public DataStore getSource() {
|
||
151 | return (DataStore) this.getValue(VALUE_SOURCE); |
||
152 | } |
||
153 | |||
154 | public FeatureIndex getIndex() {
|
||
155 | return (FeatureIndex) this.getValue(VALUE_FEATURE_INDEX); |
||
156 | } |
||
157 | |||
158 | @Override
|
||
159 | public boolean isSelectionCompromised() { |
||
160 | return (boolean) this.getValue(VALUE_IS_SELECTION_COMPROMISED); |
||
161 | } |
||
162 | |||
163 | @Override
|
||
164 | public Iterator<FeatureReference> getDeletedsFeatures() { |
||
165 | return (Iterator<FeatureReference>) this.getValue(VALUE_DELETEDS_FEATURES); |
||
166 | } |
||
167 | |||
168 | @Override
|
||
169 | public Iterator<Feature> getInsertedsFeatures() { |
||
170 | return (Iterator<Feature>) this.getValue(VALUE_INSERTEDS_FEATURES); |
||
171 | } |
||
172 | |||
173 | @Override
|
||
174 | public Iterator<Feature> getUpdatedsFeatures() { |
||
175 | return (Iterator<Feature>) this.getValue(VALUE_UPDATEDS_FEATURES); |
||
176 | } |
||
177 | |||
178 | @Override
|
||
179 | public Iterator<FeatureTypeChanged> getChangedsFeatureTypes() { |
||
180 | return (Iterator<FeatureTypeChanged>) this.getValue(VALUE_CHANGEDS_FEATURETYPES); |
||
181 | } |
||
182 | |||
183 | |||
184 | 40435 | jjdelcerro | } |