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-2023 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.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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.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;
/**
* Custom query creator to create Cassandra criteria.
*
* @author Matthew Adams
* @author Mark Paluch
* @author John Blum
*/
class CassandraQueryCreator extends AbstractQueryCreator {
private static final Log LOG = LogFactory.getLog(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;
}
@Override
protected Filter create(Part part, Iterator