use of me.prettyprint.cassandra.model.CqlQuery in project sling by apache.
the class CassandraResourceProvider method deleteResource.
private boolean deleteResource(ResourceResolver resourceResolver, String path) throws PersistenceException {
try {
String key = getrowID(path);
if (key == null) {
return false;
}
String _cf = CassandraResourceProviderUtil.getColumnFamilySector(path);
createColumnFamily(_cf, this.getKeyspace(), new StringSerializer());
StringSerializer se = new StringSerializer();
CqlQuery<String, String, String> cqlQuery = new CqlQuery<String, String, String>(keyspace, se, se, se);
String query = "delete FROM " + _cf + " where KEY = '" + key + "';";
cqlQuery.setQuery(query);
QueryResult<CqlRows<String, String, String>> result = cqlQuery.execute();
} catch (NoSuchAlgorithmException e) {
throw new PersistenceException(e.getMessage());
} catch (UnsupportedEncodingException e) {
throw new PersistenceException(e.getMessage());
}
return true;
}
Aggregations