metadata.remove(PublicMetadata.TITLE);
String minStr = metadata.remove(PublicMetadata.MIN);
String maxStr = metadata.remove(PublicMetadata.MAX);
String paramsStr = metadata.remove(PrivateMetadata.SQLPARAMS);
DataConfig dataConfig = getDataConfig();
Collection<Integer> ids = dataConfig.searchPublicMetadata(metadata, null);
// attempt recovery for backwards compatibility
if (ids.size() == 0)
{
if (metadata.containsKey(DATATABLE) && metadata.containsKey(NAME))
{
// try to find columns sqlTable==dataTable and sqlColumn=name
Map<String,String> privateMetadata = new HashMap<String,String>();
String sqlTable = metadata.get(DATATABLE);
String sqlColumn = metadata.get(NAME);
for (int i = 0; i < 2; i++)
{
if (i == 1)
sqlTable = sqlTable.toLowerCase();
privateMetadata.put(PrivateMetadata.SQLTABLE, sqlTable);
privateMetadata.put(PrivateMetadata.SQLCOLUMN, sqlColumn);
ids = dataConfig.searchPrivateMetadata(privateMetadata, null);
if (ids.size() > 0)
break;
}
}
else if (metadata.containsKey(NAME)
&& Strings.equal(metadata.get(PublicMetadata.DATATYPE), DataType.GEOMETRY))
{
metadata.put(PublicMetadata.TITLE, metadata.remove(NAME));
ids = dataConfig.searchPublicMetadata(metadata, null);
}
if (ids.size() == 0)
throw new RemoteException("No column matches metadata query: " + metadata);
}