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

History | View | Annotate | Download (5.36 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
        /**
48
         * Removes an attribute from this EditableFeatureType, given
49
         * a reference to its descriptor.
50
         * 
51
         * @param attribute
52
         *                                 descriptor of the attribute to remove
53
         * 
54
         * @return
55
         *                 true if the attribute was removed successfully, false if not.
56
         */
57
        public boolean remove(EditableFeatureAttributeDescriptor attribute);
58

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

    
69
        /**
70
         * Removes an attribute given its index
71
         * 
72
         * @param index
73
         *                         position of the attribute to be removed
74
         * 
75
         * @return
76
         *                 
77
         */
78
        public Object remove(int index);
79

    
80
        /**
81
         * Adds an attribute to this EditableFeatureType. 
82
         * @param name
83
         *                         string containing the name of the attribute
84
         * @param type
85
         *                         data type of the attribute (one from {@link DataTypes})
86
         * 
87
         * @return a new EditableFeatureAttributeDescriptor
88
         */
89
        public EditableFeatureAttributeDescriptor add(String name, int type);
90

    
91
        public EditableFeatureAttributeDescriptor add(String name, String type);
92

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

    
109
        public EditableFeatureAttributeDescriptor add(String name, String type, int size);
110

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

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

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

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

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