DATACASS-100 - completed
This commit is contained in:
@@ -101,7 +101,6 @@ public class CqlTemplate extends CassandraAccessor implements CqlOperations {
|
||||
return q;
|
||||
}
|
||||
|
||||
// common options
|
||||
if (options.getConsistencyLevel() != null) {
|
||||
q.setConsistencyLevel(ConsistencyLevelResolver.resolve(options.getConsistencyLevel()));
|
||||
}
|
||||
@@ -109,37 +108,6 @@ public class CqlTemplate extends CassandraAccessor implements CqlOperations {
|
||||
q.setRetryPolicy(RetryPolicyResolver.resolve(options.getRetryPolicy()));
|
||||
}
|
||||
|
||||
Using ttl = options.getTtl() == null ? null : QueryBuilder.ttl(options.getTtl());
|
||||
Using timestamp = options.getTimestamp() == null ? null : QueryBuilder.timestamp(options.getTimestamp());
|
||||
|
||||
// options for specific query types
|
||||
|
||||
if (q instanceof Insert) {
|
||||
Insert i = (Insert) q;
|
||||
if (ttl != null) {
|
||||
i.using(ttl);
|
||||
}
|
||||
if (timestamp != null) {
|
||||
i.using(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (q instanceof Update) {
|
||||
Update u = ((Update) q);
|
||||
if (ttl != null) {
|
||||
u.using(ttl);
|
||||
}
|
||||
if (timestamp != null) {
|
||||
u.using(timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (q instanceof Delete) {
|
||||
Delete d = (Delete) q;
|
||||
if (timestamp != null) {
|
||||
d.using(timestamp);
|
||||
}
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ public class QueryOptions {
|
||||
|
||||
private ConsistencyLevel consistencyLevel;
|
||||
private RetryPolicy retryPolicy;
|
||||
private Integer ttl;
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* @return Returns the consistencyLevel.
|
||||
@@ -55,26 +53,4 @@ public class QueryOptions {
|
||||
public void setRetryPolicy(RetryPolicy retryPolicy) {
|
||||
this.retryPolicy = retryPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the ttl in seconds.
|
||||
*/
|
||||
public Integer getTtl() {
|
||||
return ttl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ttl The ttl in seconds to set.
|
||||
*/
|
||||
public void setTtl(Integer timeToLive) {
|
||||
this.ttl = timeToLive;
|
||||
}
|
||||
|
||||
public Long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,13 +613,6 @@ public class CassandraTemplate extends CqlTemplate implements CassandraOperation
|
||||
*/
|
||||
CqlTemplate.addQueryOptions(q, options);
|
||||
|
||||
/*
|
||||
* Add TTL to Insert object
|
||||
*/
|
||||
if (options != null && options.getTtl() != null) {
|
||||
q.using(QueryBuilder.ttl(options.getTtl()));
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
@@ -648,15 +641,7 @@ public class CassandraTemplate extends CqlTemplate implements CassandraOperation
|
||||
*/
|
||||
CqlTemplate.addQueryOptions(q, options);
|
||||
|
||||
/*
|
||||
* Add TTL to Insert object
|
||||
*/
|
||||
if (options != null && options.getTtl() != null) {
|
||||
q.using(QueryBuilder.ttl(options.getTtl()));
|
||||
}
|
||||
|
||||
return q;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user