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

History | View | Annotate | Download (3.53 KB)

1
package org.gvsig.fmap.dal.feature;
2

    
3
import org.gvsig.fmap.dal.DataTypes;
4
import org.gvsig.tools.evaluator.Evaluator;
5

    
6
/**
7
 * This interface represents a FeatureType in editable state. 
8
 * To edit a FeatureType you have to obtain its instance of 
9
 * EditableFeatureType and then perform editing operations on it.
10
 * 
11
 * Once you have completed the editing you can save the changes to the original 
12
 * FeatureType. This is the only way to edit a FeatureType.
13
 */
14
public interface EditableFeatureType extends FeatureType {
15

    
16
        /**
17
         * Sets the default geometry attribute name
18
         * 
19
         * @param name
20
         *                         string containing the default geometry attribute name
21
         */
22
        public void setDefaultGeometryAttributeName(String name);
23

    
24
        /**
25
         * Removes an attribute from this EditableFeatureType, given
26
         * a reference to its descriptor.
27
         * 
28
         * @param attribute
29
         *                                 descriptor of the attribute to remove
30
         * 
31
         * @return
32
         *                 true if the attribute was removed successfully, false if not.
33
         */
34
        public boolean remove(EditableFeatureAttributeDescriptor attribute);
35

    
36
        /**
37
         * Removes an attribute given its name
38
         * 
39
         * @param name
40
         *                         string containing the name of the attribute to be removed
41
         * @return
42
         *                 
43
         */
44
        public Object remove(String name);
45

    
46
        /**
47
         * Removes an attribute given its index
48
         * 
49
         * @param index
50
         *                         position of the attribute to be removed
51
         * 
52
         * @return
53
         *                 
54
         */
55
        public Object remove(int index);
56

    
57
        /**
58
         * Adds an attribute to this EditableFeatureType. 
59
         * @param name
60
         *                         string containing the name of the attribute
61
         * @param type
62
         *                         data type of the attribute (one from {@link DataTypes})
63
         * 
64
         * @return a new EditableFeatureAttributeDescriptor
65
         */
66
        public EditableFeatureAttributeDescriptor add(String name, int type);
67

    
68
        /**
69
         * Adds an attribute to this EditableFeatureType.
70
         *  
71
         * @param name
72
         *                         string containing the name of the attribute
73
         * 
74
         * @param type
75
         *                         data type of the attribute (one from {@link DataTypes})
76
         * 
77
         * @param size
78
         *                         size of the attribute.
79
         * 
80
         * @return a new EditableFeatureAttributeDescriptor
81
         */
82
        public EditableFeatureAttributeDescriptor add(String name, int type,
83
                        int size);
84

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

    
102
        /**
103
         * Returns the associated FeatureType.
104
         *  
105
         * @return the associated FeatureType
106
         */
107
        public FeatureType getSource();
108

    
109
        /**
110
         * Returns a copy of the associated FeatureType.
111
         * 
112
         * @return associated FeatureType
113
         */
114
        public FeatureType getNotEditableCopy();
115

    
116
        /**
117
         * Sets whether this EditableFeatureType has an OID.
118
         * An OID is a unique serializable reference to a feature
119
         * (a primary key of sorts that may or may not be defined 
120
         * by the store). If the store does not define this OID then
121
         * it will be generated by the feature reference itself.
122
         * 
123
         * Its main use is to provide a way to persist data associated 
124
         * to a feature by this OID.
125
         * 
126
         * @param hasOID true if it has an OID, or false if not.
127
         */
128
        public void setHasOID(boolean hasOID);
129
        
130
        /**
131
         * Sets the default time attribute name
132
     * 
133
     * @param name
134
     *          string containing the default time attribute name
135
         */
136
        public void setDefaultTimeAttributeName(String name);
137
}