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

History | View | Annotate | Download (4.47 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
        /**
92
         * Adds an attribute to this EditableFeatureType.
93
         *  
94
         * @param name
95
         *                         string containing the name of the attribute
96
         * 
97
         * @param type
98
         *                         data type of the attribute (one from {@link DataTypes})
99
         * 
100
         * @param size
101
         *                         size of the attribute.
102
         * 
103
         * @return a new EditableFeatureAttributeDescriptor
104
         */
105
        public EditableFeatureAttributeDescriptor add(String name, int type,
106
                        int size);
107

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

    
125
        /**
126
         * Returns the associated FeatureType.
127
         *  
128
         * @return the associated FeatureType
129
         */
130
        public FeatureType getSource();
131

    
132
        /**
133
         * Returns a copy of the associated FeatureType.
134
         * 
135
         * @return associated FeatureType
136
         */
137
        public FeatureType getNotEditableCopy();
138

    
139
        /**
140
         * Sets whether this EditableFeatureType has an OID.
141
         * An OID is a unique serializable reference to a feature
142
         * (a primary key of sorts that may or may not be defined 
143
         * by the store). If the store does not define this OID then
144
         * it will be generated by the feature reference itself.
145
         * 
146
         * Its main use is to provide a way to persist data associated 
147
         * to a feature by this OID.
148
         * 
149
         * @param hasOID true if it has an OID, or false if not.
150
         */
151
        public void setHasOID(boolean hasOID);
152
        
153
        /**
154
         * Sets the default time attribute name
155
     * 
156
     * @param name
157
     *          string containing the default time attribute name
158
         */
159
        public void setDefaultTimeAttributeName(String name);
160
}