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

History | View | Annotate | Download (5.43 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
        /**
83
         * Adds an attribute to this EditableFeatureType. 
84
         * @param name
85
         *                         string containing the name of the attribute
86
         * @param type
87
         *                         data type of the attribute (one from {@link DataTypes})
88
         * 
89
         * @return a new EditableFeatureAttributeDescriptor
90
         */
91
        public EditableFeatureAttributeDescriptor add(String name, int type);
92

    
93
        public EditableFeatureAttributeDescriptor add(String name, String type);
94

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

    
111
        public EditableFeatureAttributeDescriptor add(String name, String type, int size);
112

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

    
130
        public EditableFeatureAttributeDescriptor add(String name, int type,
131
                        FeatureAttributeEmulator emulator);
132
        /**
133
         * Returns the associated FeatureType.
134
         *  
135
         * @return the associated FeatureType
136
         */
137
        public FeatureType getSource();
138

    
139
        /**
140
         * Returns a copy of the associated FeatureType.
141
         * 
142
         * @return associated FeatureType
143
         */
144
        public FeatureType getNotEditableCopy();
145

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

    
180
        /**
181
         * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
182
         *
183
         * @param index
184
         *                         of the attribute
185
         *
186
         * @return
187
         *                 a {@link FeatureAttributeDescriptor}
188
         */
189
        public EditableFeatureAttributeDescriptor getEditableAttributeDescriptor(int index);
190
}