Support to Display Flag and CQL
This commit is contained in:
parent
6d67280f7c
commit
8b25642459
|
@ -15,6 +15,10 @@ public interface PostgisDBManagerI {
|
||||||
void create(PostgisTable toCreate) throws SQLException;
|
void create(PostgisTable toCreate) throws SQLException;
|
||||||
PreparedStatement prepareInsertStatement(PostgisTable target, boolean createTable, boolean geometryAsText)
|
PreparedStatement prepareInsertStatement(PostgisTable target, boolean createTable, boolean geometryAsText)
|
||||||
throws SQLException;
|
throws SQLException;
|
||||||
|
|
||||||
|
PreparedStatement prepareStatement(String stmt);
|
||||||
|
|
||||||
|
|
||||||
void deleteTable(String tableName) throws SQLException;
|
void deleteTable(String tableName) throws SQLException;
|
||||||
void truncate(String tableName) throws SQLException;
|
void truncate(String tableName) throws SQLException;
|
||||||
int deleteByFieldValue(PostgisTable target, PostgisTable.Field field, Object value) throws SQLException;
|
int deleteByFieldValue(PostgisTable target, PostgisTable.Field field, Object value) throws SQLException;
|
||||||
|
|
|
@ -123,4 +123,23 @@ public class PostgisIndexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int updateIsVisible(Boolean value, List<String> ids) throws SDIInteractionException {
|
||||||
|
log.info("Updating {}={} in index {} for projectIds {}",DBConstants.Defaults.DISPLAYED, value, table.getTablename(),ids);
|
||||||
|
try {
|
||||||
|
PreparedStatement ps = dbManager.prepareStatement("Update "+table.getTablename()+" SET "+DBConstants.Defaults.DISPLAYED+" = ? WHERE "+DBConstants.Defaults.PROJECT_ID+" = ?");
|
||||||
|
ps.setBoolean(1,value);
|
||||||
|
int count = 0;
|
||||||
|
for(String s : ids){
|
||||||
|
log.debug("");
|
||||||
|
ps.setString(2,s);
|
||||||
|
count += ps.executeUpdate();
|
||||||
|
}
|
||||||
|
log.info("Updated {} elements out of requested {} ids in table ",count,ids.size(),table.getTablename());
|
||||||
|
return count;
|
||||||
|
}catch (Throwable t ){
|
||||||
|
log.error("Unable to update {}={} in index {} for projectIds {}",DBConstants.Defaults.DISPLAYED, value, table.getTablename(),ids,t);
|
||||||
|
throw new SDIInteractionException("Unable to delete record in postgis index "+table.getTablename(),t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,8 +237,18 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//TODO SUPPORT HIDE AND DISPLAY
|
||||||
|
if(requestArguments.containsKey("_toHideIds")){
|
||||||
|
List<String> ids = requestArguments.getList("_toHideIds",String.class);
|
||||||
|
log.info("Requested to hide centroids {} ",ids);
|
||||||
|
indexer.updateIsVisible(false,ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(requestArguments.containsKey("_toDisplayIds")){
|
||||||
|
List<String> ids = requestArguments.getList("_toDisplayIds",String.class);
|
||||||
|
log.info("Requested to hide centroids {} ",ids);
|
||||||
|
indexer.updateIsVisible(true,ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue