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 / ExpressionBuilder.java @ 44023
History | View | Annotate | Download (11.1 KB)
1 | 43020 | jjdelcerro | package org.gvsig.fmap.dal; |
---|---|---|---|
2 | |||
3 | import java.util.List; |
||
4 | import org.cresques.cts.IProjection; |
||
5 | 43739 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
6 | import org.gvsig.fmap.dal.feature.FeatureStore; |
||
7 | 43020 | jjdelcerro | import org.gvsig.fmap.geom.Geometry; |
8 | 43034 | jjdelcerro | import org.gvsig.fmap.geom.primitive.Envelope; |
9 | 43020 | jjdelcerro | |
10 | public interface ExpressionBuilder { |
||
11 | |||
12 | public enum GeometrySupportType { |
||
13 | WKT, |
||
14 | WKB, |
||
15 | 43358 | jjdelcerro | EWKB, |
16 | NATIVE |
||
17 | 43020 | jjdelcerro | } |
18 | |||
19 | public enum ParameterType { |
||
20 | Variable, |
||
21 | Constant, |
||
22 | Geometry |
||
23 | } |
||
24 | |||
25 | public interface VisitorFilter { |
||
26 | boolean accept(Visitable visitable);
|
||
27 | } |
||
28 | |||
29 | public interface Visitor { |
||
30 | public void visit(Visitable value); |
||
31 | } |
||
32 | |||
33 | public interface Visitable { |
||
34 | public void accept(Visitor visitor, VisitorFilter filter); |
||
35 | } |
||
36 | |||
37 | public interface Config { |
||
38 | public final static String has_spatial_functions = "has_spatial_functions"; |
||
39 | 43355 | jjdelcerro | public final static String support_schemas = "support_schemas"; |
40 | 43020 | jjdelcerro | public final static String quote_for_identifiers = "quote_for_identifiers"; |
41 | public final static String quote_for_strings = "quote_for_strings"; |
||
42 | public final static String geometry_type_support = "geometry_type_support"; |
||
43 | public final static String constant_true = "constant_true"; |
||
44 | public final static String constant_false = "constant_false"; |
||
45 | public final static String group = "group"; |
||
46 | public final static String attribute_crs = "crs"; |
||
47 | |||
48 | public final static String Find_SRID = "Find_SRID"; |
||
49 | public final static String ST_SRID = "ST_SRID"; |
||
50 | public final static String ST_AsText = "ST_AsText"; |
||
51 | public final static String ST_AsBinary = "ST_AsBinary"; |
||
52 | public final static String ST_AsEWKB = "ST_AsEWKB"; |
||
53 | public final static String ST_Contains = "ST_Contains"; |
||
54 | public final static String ST_Crosses = "ST_Crosses"; |
||
55 | public final static String ST_Disjoint = "ST_Disjoint"; |
||
56 | 43034 | jjdelcerro | public final static String ST_Equals = "ST_Equals"; |
57 | 43020 | jjdelcerro | public final static String ST_IsClosed = "ST_IsClosed"; |
58 | public final static String ST_Overlaps = "ST_Overlaps"; |
||
59 | public final static String ST_Touches = "ST_Touches"; |
||
60 | public final static String ST_Within = "ST_Within"; |
||
61 | public final static String ST_Intersects = "ST_Intersects"; |
||
62 | public final static String ST_Envelope = "ST_Envelope"; |
||
63 | public final static String ST_GeomFromText = "ST_GeomFromText"; |
||
64 | public final static String ST_GeomFromWKB = "ST_GeomFromWKB"; |
||
65 | public final static String ST_GeomFromEWKB = "ST_GeomFromEWKB"; |
||
66 | 43355 | jjdelcerro | public final static String ST_Simplify = "ST_Simplify"; |
67 | 43020 | jjdelcerro | public final static String lcase = "lcase"; |
68 | public final static String ucase = "ucase"; |
||
69 | public final static String isNull = "isNull"; |
||
70 | public final static String notIsNull = "notIsNull"; |
||
71 | public final static String operator_not = "operator_not"; |
||
72 | |||
73 | public final static String operator_AND = "operator_AND"; |
||
74 | public final static String operator_OR = "operator_OR"; |
||
75 | public final static String operator_EQ = "operator_EQ"; |
||
76 | public final static String operator_NE = "operator_NE"; |
||
77 | public final static String operator_GT = "operator_GT"; |
||
78 | public final static String operator_GE = "operator_GE"; |
||
79 | public final static String operator_LT = "operator_LT"; |
||
80 | public final static String operator_LE = "operator_LE"; |
||
81 | public final static String operator_LIKE = "operator_LIKE"; |
||
82 | public final static String operator_ILIKE = "operator_ILIKE"; |
||
83 | |||
84 | public final static String operator_add = "operator_add"; |
||
85 | public final static String operator_subst = "operator_subst"; |
||
86 | public final static String operator_mult = "operator_mult"; |
||
87 | public final static String operator_div = "operator_div"; |
||
88 | public final static String operator_concat = "operator_concat"; |
||
89 | |||
90 | |||
91 | public GeometrySupportType getGeometryTypeSupport();
|
||
92 | public boolean has_spatial_functions(); |
||
93 | public boolean has_functionality(String functionality); |
||
94 | public void remove_functionality(String functionality); |
||
95 | |||
96 | public boolean getBoolean(String name); |
||
97 | public String getString(String name); |
||
98 | public Object get(String name); |
||
99 | public void set(String name, Object value); |
||
100 | } |
||
101 | |||
102 | public interface Value extends Visitable { |
||
103 | |||
104 | } |
||
105 | |||
106 | public interface Group extends Value { |
||
107 | public Value getValue();
|
||
108 | } |
||
109 | |||
110 | public interface Constant extends Value { |
||
111 | public Object getValue(); |
||
112 | } |
||
113 | |||
114 | public interface Custom extends Value { |
||
115 | public Object getValue(); |
||
116 | public Custom add(Variable variable);
|
||
117 | public Custom add(Parameter parameter);
|
||
118 | } |
||
119 | |||
120 | public interface GeometryValue extends Value { |
||
121 | public Geometry getGeometry();
|
||
122 | public IProjection getSRS();
|
||
123 | } |
||
124 | |||
125 | 43739 | jjdelcerro | public interface ColumnDescriptor { |
126 | public String getName(); |
||
127 | public int getType(); |
||
128 | public int getSize(); |
||
129 | public int getPrecision(); |
||
130 | public boolean isPrimaryKey(); |
||
131 | public boolean isIndexed(); |
||
132 | public boolean isAutomatic(); |
||
133 | boolean allowNulls();
|
||
134 | public Object getDefaultValue(); |
||
135 | public int getGeometryType(); |
||
136 | public int getGeometrySubtype(); |
||
137 | public Object getGeometrySRSId(); |
||
138 | public boolean isGeometry(); |
||
139 | |||
140 | public DataStoreParameters getStoreParameters();
|
||
141 | |||
142 | public void setName(String name); |
||
143 | public void setType(int type); |
||
144 | public void setSize(int size); |
||
145 | public void setPrecision(int precision); |
||
146 | public void setIsPrimaryKey(boolean isPk); |
||
147 | public void setIsAutomatic(boolean isAutomatic); |
||
148 | public void setAllowNulls(boolean allowNulls); |
||
149 | public void setDefaultValue(Object defaultValue); |
||
150 | public void setGeometryType(int geom_type); |
||
151 | public void setGeometrySubtype(int geom_subtype); |
||
152 | public void setGeometrySRSId(Object geom_srsid); |
||
153 | } |
||
154 | |||
155 | 43020 | jjdelcerro | public interface Variable extends Value, Comparable<Variable> { |
156 | public String getName(); |
||
157 | 43739 | jjdelcerro | public ColumnDescriptor getDescriptor();
|
158 | 43020 | jjdelcerro | } |
159 | |||
160 | public interface Parameter extends Value { |
||
161 | public Parameter as_constant();
|
||
162 | public Parameter as_variable();
|
||
163 | 43093 | jjdelcerro | public Parameter as_geometry_variable();
|
164 | 43020 | jjdelcerro | public Parameter srs(Value srs);
|
165 | public Parameter srs(IProjection srs);
|
||
166 | public String getName(); |
||
167 | public Object getValue(); |
||
168 | 43093 | jjdelcerro | public Parameter value(Object value); |
169 | public Parameter name(String value); |
||
170 | 43020 | jjdelcerro | public ParameterType getType();
|
171 | public Value getSRS();
|
||
172 | public boolean is_constant(); |
||
173 | public boolean is_variable(); |
||
174 | public boolean is_geometry_variable(); |
||
175 | } |
||
176 | 43093 | jjdelcerro | |
177 | public interface Parameters extends List<Parameter> { |
||
178 | public Parameter get(String name); |
||
179 | } |
||
180 | 43020 | jjdelcerro | |
181 | public interface Function extends Value { |
||
182 | public String getName(); |
||
183 | public List<Value> parameters(); |
||
184 | public Function parameter(Value parameter);
|
||
185 | } |
||
186 | |||
187 | public interface BinaryOperator extends Value { |
||
188 | public String getName(); |
||
189 | public Value getLeft();
|
||
190 | public Value getRight();
|
||
191 | public BinaryOperator setLeft(Value operand);
|
||
192 | public BinaryOperator setRight(Value operand);
|
||
193 | } |
||
194 | |||
195 | public void accept(Visitor visitor, VisitorFilter filter); |
||
196 | |||
197 | public List<Variable> getVariables(); |
||
198 | |||
199 | 43093 | jjdelcerro | public Parameters getParameters();
|
200 | 43020 | jjdelcerro | |
201 | public boolean has_spatial_functions(); |
||
202 | |||
203 | public GeometrySupportType geometry_support_type();
|
||
204 | |||
205 | public String identifier(String name); |
||
206 | |||
207 | public String bytearray(byte[] data); |
||
208 | |||
209 | public String string(String s); |
||
210 | |||
211 | 43687 | jjdelcerro | public Object getSRSId(IProjection projection); |
212 | 43020 | jjdelcerro | |
213 | public Config getConfig();
|
||
214 | |||
215 | public Value getValue();
|
||
216 | |||
217 | public ExpressionBuilder setValue(Value value);
|
||
218 | |||
219 | public Variable variable(String name); |
||
220 | |||
221 | public Variable column(String name); // Alias for variable(name) |
||
222 | 43739 | jjdelcerro | public Variable column(FeatureAttributeDescriptor fad);
|
223 | 43020 | jjdelcerro | |
224 | 43093 | jjdelcerro | public Parameter parameter(String name); |
225 | 43020 | jjdelcerro | |
226 | 43093 | jjdelcerro | public Parameter parameter();
|
227 | |||
228 | 43020 | jjdelcerro | public Constant constant(Object value); |
229 | |||
230 | public Group group(Value group); |
||
231 | |||
232 | public GeometryValue geometry(Geometry geom, IProjection projection);
|
||
233 | |||
234 | 43034 | jjdelcerro | public GeometryValue envelope(Envelope envelope, IProjection projection);
|
235 | |||
236 | 43020 | jjdelcerro | public Custom custom(Object value); |
237 | |||
238 | public Constant srs(IProjection projection);
|
||
239 | |||
240 | public Function getAsGeometry(Value value);
|
||
241 | |||
242 | |||
243 | public Function not(Value value);
|
||
244 | |||
245 | public Function notIsNull(Value value);
|
||
246 | |||
247 | public Function isNull(Value value);
|
||
248 | |||
249 | public Function Find_SRID(Value schema, Value table, Value column);
|
||
250 | 43034 | jjdelcerro | |
251 | 43020 | jjdelcerro | public Function ST_SRID(Value geom);
|
252 | |||
253 | public Function ST_AsText(Value geom);
|
||
254 | |||
255 | public Function ST_AsBinary(Value geom);
|
||
256 | |||
257 | public Function ST_AsEWKB(Value geom);
|
||
258 | |||
259 | public Function ST_Envelope(Value geom);
|
||
260 | |||
261 | public Function ST_GeomFromText(Value geom, Value crs);
|
||
262 | |||
263 | public Function ST_GeomFromWKB(Value geom, Value crs);
|
||
264 | |||
265 | public Function ST_GeomFromEWKB(Value geom, Value crs);
|
||
266 | |||
267 | 43355 | jjdelcerro | public Function ST_Simplify(Value geom, Value tolerance);
|
268 | |||
269 | 43034 | jjdelcerro | public Function ST_Equals(Value geom1, Value geom2);
|
270 | |||
271 | 43020 | jjdelcerro | public Function ST_Intersects(Value geom1, Value geom2);
|
272 | |||
273 | public Function ST_Contains(Value geom1, Value geom2);
|
||
274 | |||
275 | 43034 | jjdelcerro | public Function ST_Disjoint(Value geom1, Value geom2);
|
276 | |||
277 | 43020 | jjdelcerro | public Function ST_Crosses(Value geom1, Value geom2);
|
278 | |||
279 | public Function ST_IsClosed(Value geom1);
|
||
280 | |||
281 | public Function ST_Overlaps(Value geom1, Value geom2);
|
||
282 | |||
283 | public Function ST_Touches(Value geom1, Value geom2);
|
||
284 | |||
285 | public Function ST_Within(Value geom1, Value geom2);
|
||
286 | |||
287 | public Function lcase(Value s);
|
||
288 | |||
289 | public Function ucase(Value s);
|
||
290 | |||
291 | public BinaryOperator and(Value op1, Value op2);
|
||
292 | |||
293 | public BinaryOperator or(Value op1, Value op2);
|
||
294 | |||
295 | public BinaryOperator eq(Value op1, Value op2);
|
||
296 | |||
297 | public BinaryOperator ne(Value op1, Value op2);
|
||
298 | |||
299 | public BinaryOperator gt(Value op1, Value op2);
|
||
300 | |||
301 | public BinaryOperator ge(Value op1, Value op2);
|
||
302 | |||
303 | public BinaryOperator lt(Value op1, Value op2);
|
||
304 | |||
305 | public BinaryOperator le(Value op1, Value op2);
|
||
306 | |||
307 | public BinaryOperator like(Value op1, Value op2);
|
||
308 | |||
309 | public BinaryOperator ilike(Value op1, Value op2);
|
||
310 | |||
311 | public BinaryOperator add(Value op1, Value op2);
|
||
312 | |||
313 | public BinaryOperator subst(Value op1, Value op2);
|
||
314 | |||
315 | public BinaryOperator mult(Value op1, Value op2);
|
||
316 | |||
317 | public BinaryOperator div(Value op1, Value op2);
|
||
318 | |||
319 | public BinaryOperator concat(Value op1, Value op2);
|
||
320 | |||
321 | public ExpressionBuilder set(Value value);
|
||
322 | |||
323 | public ExpressionBuilder and(Value value);
|
||
324 | |||
325 | public ExpressionBuilder or(Value value);
|
||
326 | |||
327 | public ExpressionBuilder createExpressionBuilder();
|
||
328 | } |