Search in sources :

Example 1 with ScanConsistency

use of org.springframework.data.couchbase.repository.ScanConsistency in project spring-data-couchbase by spring-projects.

the class CouchbaseRepositoryBase method buildQueryScanConsistency.

/**
 * Get the QueryScanConsistency from <br>
 * 1. The method annotation (method *could* be available from crudMethodMetadata)<br>
 * 2. The repository<br>
 * 3. The entity<br>
 * 4. otherwise null<br>
 * This can be overriden in the operation method by<br>
 * 1. Options.scanConsistency (?)<br>
 * AbstractCouchbaseQueryBase.applyAnnotatedConsistencyIfPresent() <br>
 * CouchbaseRepository get picked up? If I have the following, will the annotation be picked up?<br>
 * Only via crudMethodMetadata<br>
 * \@ScanConsistency(query=QueryScanConsistency.REQUEST_PLUS)<br>
 * List<T> findAll();<br>
 */
QueryScanConsistency buildQueryScanConsistency() {
    ScanConsistency sc = crudMethodMetadata.getScanConsistency();
    QueryScanConsistency fromMeta = sc != null ? sc.query() : null;
    QueryScanConsistency fromAnnotation = OptionsBuilder.annotationAttribute(ScanConsistency.class, "query", QueryScanConsistency.NOT_BOUNDED, new AnnotatedElement[] { getJavaType(), repositoryInterface });
    return OptionsBuilder.fromFirst(QueryScanConsistency.NOT_BOUNDED, fromMeta, fromAnnotation);
}
Also used : QueryScanConsistency(com.couchbase.client.java.query.QueryScanConsistency) ScanConsistency(org.springframework.data.couchbase.repository.ScanConsistency) QueryScanConsistency(com.couchbase.client.java.query.QueryScanConsistency)

Aggregations

QueryScanConsistency (com.couchbase.client.java.query.QueryScanConsistency)1 ScanConsistency (org.springframework.data.couchbase.repository.ScanConsistency)1