Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / feature / EditableFeature.java @ 47595

History | View | Annotate | Download (9.33 KB)

1
/**
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
package org.gvsig.fmap.dal.feature;
25

    
26
import java.math.BigDecimal;
27
import java.util.Date;
28
import java.util.function.Function;
29
import java.util.function.Predicate;
30
import javax.json.JsonObject;
31
import org.gvsig.fmap.dal.exception.DataException;
32

    
33
import org.gvsig.fmap.geom.Geometry;
34
import org.gvsig.timesupport.Instant;
35
import org.gvsig.timesupport.Interval;
36
import org.gvsig.tools.util.Invocable;
37

    
38
/**
39
 * This interface represents a Feature in editable state. To edit a Feature
40
 * you have to obtain its instance of EditableFeature and then perform editing
41
 * operations on it. Once you have completed the editing you can save the changes
42
 * to the original Feature. This is the only way to edit a Feature.
43
 */
44
public interface EditableFeature extends Feature {
45
        public boolean isUpdatable();
46

    
47
        public void setUpdatable(boolean updatable);
48

    
49
        /**
50
         * Sets the value of an attribute given its name
51
         * @param name
52
         *                         attribute's name
53
         * @param value
54
         *                  value to set
55
         */
56
        public void set(String name, Object value);
57

    
58
        /**
59
         * Sets the value of an attribute given its index
60
         * @param index
61
         *                         attribute's index
62
         * @param value
63
         *                  value to set
64
         */
65
        public void set(int index, Object value);
66

    
67
        /**
68
         * Sets the value of an attribute of type integer, given its name
69
         * @param name
70
         *                         attribute's name
71
         * @param value
72
         *                  value to set
73
         */
74
        public void setInt(String name, int value);
75

    
76
        /**
77
         * Sets the value of an attribute of type integer, given its index
78
         * @param index
79
         *                         attribute's index
80
         * @param value
81
         *                  value to set
82
         */
83
        public void setInt(int index, int value);
84

    
85
        /**
86
         * Sets the value of an attribute of type boolean, given its name
87
         * @param name
88
         *                         attribute's name
89
         * @param value
90
         *                  value to set
91
         */
92
        public void setBoolean(String name, boolean value);
93

    
94
        /**
95
         * Sets the value of an attribute of type boolean, given its index
96
         * @param index
97
         *                         attribute's index
98
         * @param value
99
         *                  value to set
100
         */
101
        public void setBoolean(int index, boolean value);
102

    
103
        /**
104
         * Sets the value of an attribute of type long, given its name
105
         * @param name
106
         *                         attribute's name
107
         * @param value
108
         *                  value to set
109
         */
110
        public void setLong(String name, long value);
111

    
112
        /**
113
         * Sets the value of an attribute of type long, given its index
114
         * @param index
115
         *                         attribute's index
116
         * @param value
117
         *                  value to set
118
         */
119
        public void setLong(int index, long value);
120

    
121
        /**
122
         * Sets the value of an attribute of type float, given its name
123
         * @param name
124
         *                         attribute's name
125
         * @param value
126
         *                  value to set
127
         */
128
        public void setFloat(String name, float value);
129

    
130
        /**
131
         * Sets the value of an attribute of type float, given its index
132
         * @param index
133
         *                         attribute's index
134
         * @param value
135
         *                  value to set
136
         */
137
        public void setFloat(int index, float value);
138

    
139
        /**
140
         * Sets the value of an attribute of type double, given its name
141
         * @param name
142
         *                         attribute's name
143
         * @param value
144
         *                  value to set
145
         */
146
        public void setDouble(String name, double value);
147

    
148
        /**
149
         * Sets the value of an attribute of type double, given its index
150
         * @param index
151
         *                         attribute's index
152
         * @param value
153
         *                  value to set
154
         */
155
        public void setDouble(int index, double value);
156

    
157
        /**
158
         * Sets the value of an attribute of type BigDecimal, given its name
159
         * @param name
160
         *                         attribute's name
161
         * @param value
162
         *                  value to set
163
         */
164
        public void setDecimal(String name, BigDecimal value);
165

    
166
        /**
167
         * Sets the value of an attribute of type BigDecimal, given its index
168
         * @param index
169
         *                         attribute's index
170
         * @param value
171
         *                  value to set
172
         */
173
        public void setDecimal(int index, BigDecimal value);
174

    
175
        /**
176
         * Sets the value of an attribute of type date, given its name
177
         * @param name
178
         *                         attribute's name
179
         * @param value
180
         *                  value to set
181
         */
182
        public void setDate(String name, Date value);
183

    
184
        /**
185
         * Sets the value of an attribute of type date, given its index
186
         * @param index
187
         *                         attribute's index
188
         * @param value
189
         *                  value to set
190
         */
191
        public void setDate(int index, Date value);
192

    
193
        /**
194
         * Sets the value of an attribute of type string, given its name
195
         * @param name
196
         *                         attribute's name
197
         * @param value
198
         *                  value to set
199
         */
200
        public void setString(String name, String value);
201

    
202
        /**
203
         * Sets the value of an attribute of type string, given its index
204
         * @param index
205
         *                         attribute's index
206
         * @param value
207
         *                  value to set
208
         */
209
        public void setString(int index, String value);
210

    
211
        /**
212
         * Sets the value of an attribute of type byte, given its name
213
         * @param name
214
         *                         attribute's name
215
         * @param value
216
         *                  value to set
217
         */
218
        public void setByte(String name, byte value);
219

    
220
        /**
221
         * Sets the value of an attribute of type byte, given its index
222
         * @param index
223
         *                         attribute's index
224
         * @param value
225
         *                  value to set
226
         */
227
        public void setByte(int index, byte value);
228

    
229
        /**
230
         * Sets the value of an attribute of type geometry, given its name
231
         * @param name
232
         *                         attribute's name
233
         * @param value
234
         *                  value to set
235
         */
236
        public void setGeometry(String name, Geometry value);
237

    
238
        /**
239
         * Sets the value of an attribute of type geometry, given its index
240
         * @param index
241
         *                         attribute's index
242
         * @param value
243
         *                  value to set
244
         */
245
        public void setGeometry(int index, Geometry value);
246

    
247
        /**
248
         * Sets the value of an attribute of type array, given its name
249
         * @param name
250
         *                         attribute's name
251
         * @param value
252
         *                  value to set
253
         */
254
        public void setArray(String name, Object[] value);
255

    
256
        /**
257
         * Sets the value of an attribute of type array, given its index
258
         * @param index
259
         *                         attribute's index
260
         * @param value
261
         *                  value to set
262
         */
263
        public void setArray(int index, Object[] value);
264

    
265
        /**
266
         * Sets the value of an attribute of type feature, given its name
267
         * @param name
268
         *                         attribute's name
269
         * @param value
270
         *                  value to set
271
         */
272
        public void setFeature(String name, Feature value);
273

    
274
        /**
275
         * Sets the value of an attribute of type feature, given its index
276
         * @param index
277
         *                         attribute's index
278
         * @param value
279
         *                  value to set
280
         */
281
        public void setFeature(int index, Feature value);
282

    
283
        /**
284
         * Returns the Feature from which this EditableFeature was created
285
         *
286
         * @return Feature from which this EditableFeature was created
287
         */
288
        public Feature getSource();
289

    
290
        /**
291
         * Returns a non editable copy of the Feature.
292
         *
293
         * @return non editable copy of the Feature.
294
         */
295
        public Feature getNotEditableCopy();
296

    
297
        /**
298
         * Sets de value of the default geometry attribute.
299
         *
300
         * @param value geometry to set.
301
         */
302
        public void setDefaultGeometry(Geometry value);
303
        
304
        /**
305
         * Copies the values of all attributes from the source feature to this feature
306
         * 
307
         * @param source
308
         *                         source feature from which the values will be copied.
309
         */
310
        public void copyFrom(Feature source);        
311
        
312
        public void copyFrom(Feature values, Predicate<FeatureAttributeDescriptor> copy);
313
        
314
        public void copyFrom(Feature source, Predicate<FeatureAttributeDescriptor> copy, Invocable onerror);
315
        
316
        public void copyFrom(JsonObject source);        
317
        
318
        /**
319
         * Copy the "JSon" values to the feature by name.
320
         * If filter return true, value for the attribute are copied.
321
         * @param values
322
         * @param filter 
323
         */
324
        public void copyFrom(JsonObject values, Predicate<FeatureAttributeDescriptor> filter);
325
        
326
        /**
327
     * Sets the value of an attribute of type instant, given its name
328
     * @param name
329
     *          attribute's name
330
     * @param value
331
     *          value to set
332
     */
333
        public void setInstant(String name, Instant value);
334

    
335
        /**
336
     * Sets the value of an attribute of type instant, given its index
337
     * @param index
338
     *          attribute's index
339
     * @param value
340
     *          value to set
341
     */
342
        public void setInstant(int index, Instant value);  
343

    
344
        /**
345
     * Sets the value of an attribute of type interval, given its name
346
     * @param name
347
     *          attribute's name
348
     * @param value
349
     *          value to set
350
     */
351
        public void setInterval(String name, Interval value);
352

    
353
        /**
354
     * Sets the value of an attribute of type interval, given its index
355
     * @param index
356
     *          attribute's index
357
     * @param value
358
     *          value to set
359
     */
360
        public void setInterval(int index, Interval value); 
361
        
362
    public boolean canSetValue(String name);
363
    
364
    public boolean canSetValue(FeatureAttributeDescriptor attr,Predicate<FeatureAttributeDescriptor> filter);
365
    
366
    public Feature getOriginal();
367
}