}
if (resource != null && resource.isActive())
{
Response response = ((Transaction) connection).zrange(destStore, 0, -1);
// ((Transaction) connection).exec();
((RedisTransaction) resource).onExecute(((Transaction) connection));
rowKeys = (Set<String>) response.get();
// connection = reInitialize(connection, rowKeys);
//
// ((Transaction) connection).del(destStore);
}
else
{
rowKeys = ((Jedis) connection).zrange(destStore, 0, -1);
((Jedis) connection).del(destStore);
}
// delete intermediate store after find.
//
// means it is a query over sorted set.
}
else if (queryParameter.isByRange())
{
// means query over a single sorted set with range
Map<String, Double> minimum = queryParameter.getMin();
Map<String, Double> maximum = queryParameter.getMax();
String column = minimum.keySet().iterator().next();
if (resource != null && resource.isActive())
{
Response response = ((Transaction) connection)
.zrangeByScore(getHashKey(entityMetadata.getTableName(), column), minimum.get(column),
maximum.get(column));
// ((Transaction) connection).exec();
((RedisTransaction) resource).onExecute(((Transaction) connection));
rowKeys = (Set<String>) response.get();
// connection = reInitialize(connection, rowKeys);
}
else
{
rowKeys = ((Jedis) connection).zrangeByScore(getHashKey(entityMetadata.getTableName(), column),
minimum.get(column), maximum.get(column));
}
}
else if (queryParameter.isById())
{
Map<String, Object> fieldSets = queryParameter.getFields();
results = findAllColumns(entityClazz, (byte[][]) (queryParameter.getColumns() != null ? queryParameter
.getColumns().toArray() : null), fieldSets.values().toArray());
return results;
}
else if (queryParameter.getFields() != null)
{
Set<String> columns = queryParameter.getFields().keySet();
for (String column : columns)
{
// ideally it will always be 1 value in map, else it will go
// it queryParameter.getClause() will not be null!
Double value = getDouble(PropertyAccessorHelper.getString(queryParameter.getFields().get(column)));
if (resource != null && resource.isActive())
{
Response response = ((Transaction) connection).zrangeByScore(
getHashKey(entityMetadata.getTableName(), column), value, value);
// ((Transaction) connection).exec();
((RedisTransaction) resource).onExecute(((Transaction) connection));
rowKeys = (Set<String>) response.get();
// connection = reInitialize(connection, rowKeys);
}
else
{
rowKeys = ((Jedis) connection).zrangeByScore(getHashKey(entityMetadata.getTableName(), column),
value, value);
}
}
}
else
{
if (resource != null && resource.isActive())
{
Response response = ((Transaction) connection).zrange(
getHashKey(entityMetadata.getTableName(),
((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName()), 0, -1);
// resource.onCommit()
// ((Transaction) connection).exec();
((RedisTransaction) resource).onExecute(((Transaction) connection));
rowKeys = new HashSet<String>((Collection<? extends String>) response.get());
}
else
{
rowKeys = new HashSet<String>(((Jedis) connection).zrange(
getHashKey(entityMetadata.getTableName(),