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 / EditableFeatureType.java @ 45425

History | View | Annotate | Download (5.85 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 org.gvsig.fmap.dal.DataTypes;
27
import org.gvsig.json.SupportFromJson;
28
import org.gvsig.tools.evaluator.Evaluator;
29

    
30
/**
31
 * This interface represents a FeatureType in editable state. 
32
 * To edit a FeatureType you have to obtain its instance of 
33
 * EditableFeatureType and then perform editing operations on it.
34
 * 
35
 * Once you have completed the editing you can save the changes to the original 
36
 * FeatureType. This is the only way to edit a FeatureType.
37
 */
38
public interface EditableFeatureType extends FeatureType, SupportFromJson {
39

    
40
        /**
41
         * Sets the default geometry attribute name
42
         * 
43
         * @param name
44
         *                         string containing the default geometry attribute name
45
         */
46
        public void setDefaultGeometryAttributeName(String name);
47

    
48
        public void setDefaultGeometryType(int type, int subType);    
49

    
50
        /**
51
         * Removes an attribute from this EditableFeatureType, given
52
         * a reference to its descriptor.
53
         * 
54
         * @param attribute
55
         *                                 descriptor of the attribute to remove
56
         * 
57
         * @return
58
         *                 true if the attribute was removed successfully, false if not.
59
         */
60
        public boolean remove(EditableFeatureAttributeDescriptor attribute);
61

    
62
        /**
63
         * Removes an attribute given its name
64
         * 
65
         * @param name
66
         *                         string containing the name of the attribute to be removed
67
         * @return
68
         *                 
69
         */
70
        public Object remove(String name);
71

    
72
        /**
73
         * Removes an attribute given its index
74
         * 
75
         * @param index
76
         *                         position of the attribute to be removed
77
         * 
78
         * @return
79
         *                 
80
         */
81
        public Object remove(int index);
82
        
83
        public void removeAll();
84
        
85
        public void addAll(FeatureType other);
86

    
87
        /**
88
         * Adds an attribute to this EditableFeatureType. 
89
         * @param name
90
         *                         string containing the name of the attribute
91
         * @param type
92
         *                         data type of the attribute (one from {@link DataTypes})
93
         * 
94
         * @return a new EditableFeatureAttributeDescriptor
95
         */
96
        public EditableFeatureAttributeDescriptor add(String name, int type);
97

    
98
        public EditableFeatureAttributeDescriptor add(String name, String type);
99

    
100
        /**
101
         * Adds an attribute to this EditableFeatureType.
102
         *  
103
         * @param name
104
         *                         string containing the name of the attribute
105
         * 
106
         * @param type
107
         *                         data type of the attribute (one from {@link DataTypes})
108
         * 
109
         * @param size
110
         *                         size of the attribute.
111
         * 
112
         * @return a new EditableFeatureAttributeDescriptor
113
         */
114
        public EditableFeatureAttributeDescriptor add(String name, int type, int size);
115

    
116
        public EditableFeatureAttributeDescriptor add(String name, String type, int size);
117

    
118
        /**
119
         * Adds a calculated attribute to this EditableFeatureType.
120
         *  
121
         * @param name
122
         *                         string containing the name of the attribute
123
         * 
124
         * @param type
125
         *                         data type of the attribute (one from {@link DataTypes})
126
         * 
127
         * @param evaluator
128
         *                         an evaluator containing the desired expression
129
         * 
130
         * @return a new EditableFeatureAttributeDescriptor
131
         */        
132
        public EditableFeatureAttributeDescriptor add(String name, int type,
133
                        Evaluator evaluator);
134

    
135
        public EditableFeatureAttributeDescriptor add(String name, int type,
136
                        FeatureAttributeEmulator emulator);
137
        /**
138
         * Returns the associated FeatureType.
139
         *  
140
         * @return the associated FeatureType
141
         */
142
        public FeatureType getSource();
143

    
144
        /**
145
         * Returns a copy of the associated FeatureType.
146
         * 
147
         * @return associated FeatureType
148
         */
149
        public FeatureType getNotEditableCopy();
150
        
151
        /**
152
         * Returns a copy of this editable feature type.
153
         * 
154
         * @return the copy 
155
         */
156
        public EditableFeatureType getEditable();
157

    
158
        /**
159
         * Sets whether this EditableFeatureType has an OID.
160
         * An OID is a unique serializable reference to a feature
161
         * (a primary key of sorts that may or may not be defined 
162
         * by the store). If the store does not define this OID then
163
         * it will be generated by the feature reference itself.
164
         * 
165
         * Its main use is to provide a way to persist data associated 
166
         * to a feature by this OID.
167
         * 
168
         * @param hasOID true if it has an OID, or false if not.
169
         */
170
        public void setHasOID(boolean hasOID);
171
        
172
        /**
173
         * Sets the default time attribute name
174
     * 
175
     * @param name
176
     *          string containing the default time attribute name
177
         */
178
        public void setDefaultTimeAttributeName(String name);
179
        
180
        /**
181
         * Returns a {@link FeatureAttributeDescriptor} given the attribute name,
182
         * or null if an attribute with the given name does not exist.
183
         *
184
         * @param name
185
         *                         of the attribute
186
         *
187
         * @return
188
         *                 a {@link FeatureAttributeDescriptor}
189
         */
190
        public EditableFeatureAttributeDescriptor getEditableAttributeDescriptor(String name);
191

    
192
        /**
193
         * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
194
         *
195
         * @param index
196
         *                         of the attribute
197
         *
198
         * @return
199
         *                 a {@link FeatureAttributeDescriptor}
200
         */
201
        public EditableFeatureAttributeDescriptor getEditableAttributeDescriptor(int index);
202
        
203
        public EditableFeatureAttributeDescriptor addLike(FeatureAttributeDescriptor other);
204
}