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 @ 46723
History | View | Annotate | Download (6.12 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
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 | 40435 | jjdelcerro | package org.gvsig.fmap.dal.feature; |
25 | |||
26 | import org.gvsig.fmap.dal.DataTypes; |
||
27 | 45425 | jjdelcerro | import org.gvsig.json.SupportFromJson; |
28 | 40435 | jjdelcerro | import org.gvsig.tools.evaluator.Evaluator; |
29 | |||
30 | /**
|
||
31 | * This interface represents a FeatureType in editable state.
|
||
32 | * To edit a FeatureType you have to obtain its instance of
|
||
33 | * EditableFeatureType and then perform editing operations on it.
|
||
34 | *
|
||
35 | * Once you have completed the editing you can save the changes to the original
|
||
36 | * FeatureType. This is the only way to edit a FeatureType.
|
||
37 | */
|
||
38 | 45425 | jjdelcerro | public interface EditableFeatureType extends FeatureType, SupportFromJson { |
39 | 40435 | jjdelcerro | |
40 | /**
|
||
41 | * Sets the default geometry attribute name
|
||
42 | *
|
||
43 | * @param name
|
||
44 | * string containing the default geometry attribute name
|
||
45 | */
|
||
46 | public void setDefaultGeometryAttributeName(String name); |
||
47 | |||
48 | 43074 | jjdelcerro | public void setDefaultGeometryType(int type, int subType); |
49 | |||
50 | 40435 | jjdelcerro | /**
|
51 | * Removes an attribute from this EditableFeatureType, given
|
||
52 | * a reference to its descriptor.
|
||
53 | *
|
||
54 | * @param attribute
|
||
55 | * descriptor of the attribute to remove
|
||
56 | *
|
||
57 | * @return
|
||
58 | * true if the attribute was removed successfully, false if not.
|
||
59 | */
|
||
60 | public boolean remove(EditableFeatureAttributeDescriptor attribute); |
||
61 | |||
62 | /**
|
||
63 | * Removes an attribute given its name
|
||
64 | *
|
||
65 | * @param name
|
||
66 | * string containing the name of the attribute to be removed
|
||
67 | * @return
|
||
68 | *
|
||
69 | */
|
||
70 | public Object remove(String name); |
||
71 | |||
72 | /**
|
||
73 | * Removes an attribute given its index
|
||
74 | *
|
||
75 | * @param index
|
||
76 | * position of the attribute to be removed
|
||
77 | *
|
||
78 | * @return
|
||
79 | *
|
||
80 | */
|
||
81 | public Object remove(int index); |
||
82 | 44505 | jjdelcerro | |
83 | public void removeAll(); |
||
84 | |||
85 | public void addAll(FeatureType other); |
||
86 | 40435 | jjdelcerro | |
87 | /**
|
||
88 | * Adds an attribute to this EditableFeatureType.
|
||
89 | * @param name
|
||
90 | * string containing the name of the attribute
|
||
91 | * @param type
|
||
92 | * data type of the attribute (one from {@link DataTypes})
|
||
93 | *
|
||
94 | * @return a new EditableFeatureAttributeDescriptor
|
||
95 | */
|
||
96 | public EditableFeatureAttributeDescriptor add(String name, int type); |
||
97 | |||
98 | 42293 | jjdelcerro | public EditableFeatureAttributeDescriptor add(String name, String type); |
99 | |||
100 | 40435 | jjdelcerro | /**
|
101 | * Adds an attribute to this EditableFeatureType.
|
||
102 | *
|
||
103 | * @param name
|
||
104 | * string containing the name of the attribute
|
||
105 | *
|
||
106 | * @param type
|
||
107 | * data type of the attribute (one from {@link DataTypes})
|
||
108 | *
|
||
109 | * @param size
|
||
110 | * size of the attribute.
|
||
111 | *
|
||
112 | * @return a new EditableFeatureAttributeDescriptor
|
||
113 | */
|
||
114 | 42293 | jjdelcerro | public EditableFeatureAttributeDescriptor add(String name, int type, int size); |
115 | 40435 | jjdelcerro | |
116 | 42293 | jjdelcerro | public EditableFeatureAttributeDescriptor add(String name, String type, int size); |
117 | |||
118 | 40435 | jjdelcerro | /**
|
119 | * Adds a calculated attribute to this EditableFeatureType.
|
||
120 | *
|
||
121 | * @param name
|
||
122 | * string containing the name of the attribute
|
||
123 | *
|
||
124 | * @param type
|
||
125 | * data type of the attribute (one from {@link DataTypes})
|
||
126 | *
|
||
127 | * @param evaluator
|
||
128 | * an evaluator containing the desired expression
|
||
129 | *
|
||
130 | * @return a new EditableFeatureAttributeDescriptor
|
||
131 | */
|
||
132 | public EditableFeatureAttributeDescriptor add(String name, int type, |
||
133 | Evaluator evaluator); |
||
134 | |||
135 | 41335 | jjdelcerro | public EditableFeatureAttributeDescriptor add(String name, int type, |
136 | FeatureAttributeEmulator emulator); |
||
137 | 40435 | jjdelcerro | /**
|
138 | * Returns the associated FeatureType.
|
||
139 | *
|
||
140 | * @return the associated FeatureType
|
||
141 | */
|
||
142 | public FeatureType getSource();
|
||
143 | |||
144 | /**
|
||
145 | * Returns a copy of the associated FeatureType.
|
||
146 | *
|
||
147 | * @return associated FeatureType
|
||
148 | */
|
||
149 | public FeatureType getNotEditableCopy();
|
||
150 | 44669 | jjdelcerro | |
151 | /**
|
||
152 | * Returns a copy of this editable feature type.
|
||
153 | *
|
||
154 | * @return the copy
|
||
155 | */
|
||
156 | 45739 | jjdelcerro | @Override
|
157 | 44669 | jjdelcerro | public EditableFeatureType getEditable();
|
158 | 40435 | jjdelcerro | |
159 | /**
|
||
160 | * Sets whether this EditableFeatureType has an OID.
|
||
161 | * An OID is a unique serializable reference to a feature
|
||
162 | * (a primary key of sorts that may or may not be defined
|
||
163 | * by the store). If the store does not define this OID then
|
||
164 | * it will be generated by the feature reference itself.
|
||
165 | *
|
||
166 | * Its main use is to provide a way to persist data associated
|
||
167 | * to a feature by this OID.
|
||
168 | *
|
||
169 | * @param hasOID true if it has an OID, or false if not.
|
||
170 | */
|
||
171 | public void setHasOID(boolean hasOID); |
||
172 | |||
173 | /**
|
||
174 | * Sets the default time attribute name
|
||
175 | *
|
||
176 | * @param name
|
||
177 | * string containing the default time attribute name
|
||
178 | */
|
||
179 | public void setDefaultTimeAttributeName(String name); |
||
180 | 41272 | jjdelcerro | |
181 | /**
|
||
182 | * Returns a {@link FeatureAttributeDescriptor} given the attribute name,
|
||
183 | * or null if an attribute with the given name does not exist.
|
||
184 | *
|
||
185 | * @param name
|
||
186 | * of the attribute
|
||
187 | *
|
||
188 | * @return
|
||
189 | * a {@link FeatureAttributeDescriptor}
|
||
190 | */
|
||
191 | public EditableFeatureAttributeDescriptor getEditableAttributeDescriptor(String name); |
||
192 | |||
193 | /**
|
||
194 | * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
|
||
195 | *
|
||
196 | * @param index
|
||
197 | * of the attribute
|
||
198 | *
|
||
199 | * @return
|
||
200 | * a {@link FeatureAttributeDescriptor}
|
||
201 | */
|
||
202 | public EditableFeatureAttributeDescriptor getEditableAttributeDescriptor(int index); |
||
203 | 44801 | omartinez | |
204 | public EditableFeatureAttributeDescriptor addLike(FeatureAttributeDescriptor other);
|
||
205 | 45739 | jjdelcerro | |
206 | public void setCheckFeaturesAtFinishEditing(boolean check); |
||
207 | |||
208 | public void setCheckFeaturesAtInsert(boolean check); |
||
209 | 45784 | jjdelcerro | |
210 | public void set(String name, String value); |
||
211 | 46723 | fdiaz | |
212 | public void forceStrongChanges(); |
||
213 | |||
214 | 40435 | jjdelcerro | } |