mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-1127 fix filtering geometry (#714)
This commit is contained in:
+2
@@ -39,5 +39,7 @@ public class WebSQLConstants {
|
||||
public static final String ATTR_TEXT = "text";
|
||||
public static final String ATTR_BINARY = "binary";
|
||||
public static final String ATTR_DATA = "data";
|
||||
public static final String ATTR_SRID = "srid";
|
||||
public static final String ATTR_PROPERTIES = "properties";
|
||||
|
||||
}
|
||||
|
||||
+18
-3
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package io.cloudbeaver.service.sql;
|
||||
|
||||
import org.jkiss.dbeaver.model.gis.DBGeometry;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -36,13 +37,27 @@ public class WebSQLDataFilterConstraint {
|
||||
public WebSQLDataFilterConstraint(Map<String, Object> map) {
|
||||
this.attributePosition = CommonUtils.toInt(map.get("attributePosition"));
|
||||
this.orderPosition = map.containsKey("orderPosition") ?
|
||||
CommonUtils.toInt(map.get("orderPosition")) + 1 : // Use position + 1 because 0 means no ordering (because of legacy compatibility)
|
||||
null;
|
||||
CommonUtils.toInt(map.get("orderPosition")) + 1 : // Use position + 1 because 0 means no ordering (because of legacy compatibility)
|
||||
null;
|
||||
this.orderAsc = map.containsKey("orderAsc") ? CommonUtils.toBoolean(map.get("orderAsc")) : null;
|
||||
|
||||
this.criteria = CommonUtils.toString(map.get("criteria"), null);
|
||||
this.operator = CommonUtils.toString(map.get("operator"), null);
|
||||
this.value = CommonUtils.toString(map.get("value"), null);
|
||||
Object value = map.get("value");
|
||||
if (value instanceof Map) {
|
||||
Map mappedValue = (Map) value;
|
||||
//creates new geometry object if the type of the value is "geometry"
|
||||
if (WebSQLConstants.VALUE_TYPE_GEOMETRY.equals(mappedValue.get(WebSQLConstants.VALUE_TYPE_ATTR))) {
|
||||
this.value = new DBGeometry(
|
||||
mappedValue.get(WebSQLConstants.ATTR_TEXT),
|
||||
CommonUtils.toInt(mappedValue.get(WebSQLConstants.ATTR_SRID)),
|
||||
(Map<String, Object>) mappedValue.get(WebSQLConstants.ATTR_PROPERTIES));
|
||||
}
|
||||
|
||||
} else {
|
||||
this.value = CommonUtils.toString(value, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Integer getAttributePosition() {
|
||||
|
||||
Reference in New Issue
Block a user