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 @ 44505

History | View | Annotate | Download (5.52 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.tools.evaluator.Evaluator;
28

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

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

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

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

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

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

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

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

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

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

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

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

    
143
        /**
144
         * Returns a copy of the associated FeatureType.
145
         * 
146
         * @return associated FeatureType
147
         */
148
        public FeatureType getNotEditableCopy();
149

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

    
184
        /**
185
         * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
186
         *
187
         * @param index
188
         *                         of the attribute
189
         *
190
         * @return
191
         *                 a {@link FeatureAttributeDescriptor}
192
         */
193
        public EditableFeatureAttributeDescriptor getEditableAttributeDescriptor(int index);
194
}