@@ -144,6 +144,19 @@ |
} |
} |
|
+ public void updateGeometrySRID(Layer lyr, int SRID) throws ServiceException { |
+ try { |
+ Statement stmt = conn.createStatement(); |
+ String sql = "SELECT UpdateGeometrySRID('" + |
+ lyr.schema + "', '" + lyr.table + "', 'the_geom', " + |
+ SRID + ")"; |
+ LOG.log(Level.INFO, sql); |
+ stmt.execute(sql); |
+ } catch (SQLException ex) { |
+ throw new ServiceException(ex); |
+ } |
+ } |
+ |
@Override |
public int deleteTable(String tableName) throws ServiceException { |
try { |
@@ -206,9 +219,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -233,9 +249,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -259,9 +278,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -286,9 +308,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -314,9 +339,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -338,9 +366,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -364,9 +395,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -390,9 +424,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |
@@ -418,9 +455,12 @@ |
LOG.log(Level.INFO, sql); |
stmt.executeUpdate(sql); |
|
+ Layer res = new Layer(Constants.DEFAULT_SCHEMA, table, this); |
+ updateGeometrySRID(res, GeoJSONParser.getSRIDInt(Constants.DEFAULT_CRS)); |
+ |
stmt.close(); |
- return new Layer(Constants.DEFAULT_SCHEMA, table, this); |
- } catch (SQLException ex) { |
+ return res; |
+ } catch (SQLException|JSONException ex) { |
throw new csip.ServiceException(ex); |
} |
} |