Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2010-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.cassandra.repository.query;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
import org.springframework.data.cassandra.core.query.Criteria;
import org.springframework.data.cassandra.core.query.CriteriaDefinition;
import org.springframework.data.cassandra.core.query.Filter;
import org.springframework.data.cassandra.core.query.Query;
import org.springframework.data.cassandra.repository.query.ConvertingParameterAccessor.PotentiallyConvertingIterator;
import org.springframework.data.domain.Range;
import org.springframework.data.domain.Sort;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.repository.query.parser.AbstractQueryCreator;
import org.springframework.data.repository.query.parser.Part;
import org.springframework.data.repository.query.parser.Part.Type;
import org.springframework.data.repository.query.parser.PartTree;
import org.springframework.util.Assert;
import com.datastax.driver.core.querybuilder.Clause;
/**
* Custom query creator to create Cassandra criteria.
*
* @author Matthew Adams
* @author Mark Paluch
* @author John Blum
*/
class CassandraQueryCreator extends AbstractQueryCreator {
private static final Logger LOG = LoggerFactory.getLogger(CassandraQueryCreator.class);
private final MappingContext mappingContext;
private final QueryBuilder queryBuilder = new QueryBuilder();
/**
* Create a new {@link CassandraQueryCreator} from the given {@link PartTree}, {@link ConvertingParameterAccessor} and
* {@link MappingContext}.
*
* @param tree must not be {@literal null}.
* @param parameterAccessor must not be {@literal null}.
* @param mappingContext must not be {@literal null}.
*/
public CassandraQueryCreator(PartTree tree, CassandraParameterAccessor parameterAccessor,
MappingContext mappingContext) {
super(tree, parameterAccessor);
Assert.notNull(mappingContext, "CassandraMappingContext must not be null");
this.mappingContext = mappingContext;
}
/**
* Returns the {@link MappingContext} used by this template to access mapping meta-data used to store (map) object to
* Cassandra tables.
*
* @return the {@link MappingContext} used by this template.
* @see CassandraMappingContext
*/
protected MappingContext getMappingContext() {
return this.mappingContext;
}
/**
* Returns the {@link QueryBuilder} used to construct Cassandra CQL queries.
*
* @return the {@link QueryBuilder} used to construct Cassandra CQL queries.
*/
protected QueryBuilder getQueryBuilder() {
return this.queryBuilder;
}
/* (non-Javadoc)
* @see org.springframework.data.repository.query.parser.AbstractQueryCreator#create(org.springframework.data.repository.query.parser.Part, java.util.Iterator)
*/
@Override
protected Filter create(Part part, Iterator