public class GeojsonPGHelper extends Object
| Constructor and Description |
|---|
GeojsonPGHelper(String table,
String idColumn,
String geomColumn,
int srid)
Creates a new helper to insert, update and/or delete database rows from
GeoJSON objects.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete(net.sf.json.JSONObject geojson)
It deletes the given object from the database.
|
String |
getTable() |
void |
insert(net.sf.json.JSONObject geojson)
Inserts the given object in the database.
|
void |
setConnection(Connection connection)
Sets the connection to use before calling
insert(JSONObject), update(JSONObject) and/or
delete(JSONObject). |
void |
update(net.sf.json.JSONObject geojson)
Updates the given object in the database.
|
public GeojsonPGHelper(String table, String idColumn, String geomColumn, int srid)
table - The table to use for inserts, updates and deletes.idColumn - The name of the primary key column. The helper does not
support primary keys with more than one column.geomColumn - The name of the geometry column. The helper does not support
more than one geometry column.srid - The SRID for the geometries.public void setConnection(Connection connection)
insert(JSONObject), update(JSONObject) and/or
delete(JSONObject).connection - The connection to use when inserting/updating/deleting
objects.public void insert(net.sf.json.JSONObject geojson)
throws SQLException,
IOException
geojson - The object to insert.SQLException - if the object cannot be updated.IOException - if the geometry contained in the GeoJSON cannot be translated
into WKT.NullPointerException - if the connection has not been previously configured by
calling setConnection(Connection).public void update(net.sf.json.JSONObject geojson)
throws SQLException,
IOException
idField
property is used for the WHERE clause to update only the
specific object.geojson - The object to update.SQLException - if the object cannot be updated.IOException - if the geometry contained in the GeoJSON cannot be translated
into WKT or the GeoJSON object does not have a
idColumn property.NullPointerException - if the connection has not been previously configured by
calling setConnection(Connection).public void delete(net.sf.json.JSONObject geojson)
throws SQLException,
IOException
geojson - The GeoJSON object to delete. Only the idField
(see GeojsonPGHelper(String, String, String, int))
property is used.SQLException - if the object cannot be deleted.IOException - if the GeoJSON object does not have an idColumn
property.NullPointerException - if the connection has not been previously configured by
calling setConnection(Connection).public String getTable()
Copyright © 2018. All rights reserved.