DATACASS-448 - Relocate CQL, mapping and convert packages.
We relocated packages of the former Spring CQL module and mapping/convert packages of the Spring Data Cassandra module: org.springframework.cassandra -> org.springframework.data.cql org.springframework.cassandra.core.cql.generator -> org.springframework.data.cql.core.generator org.springframework.cassandra.core.cql -> org.springframework.data.cql.core org.springframework.data.cassandra.convert -> org.springframework.data.cassandra.core.convert org.springframework.data.cassandra.mapping -> org.springframework.data.cassandra.core.mapping
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* CQL specific converters.
|
||||
*/
|
||||
package org.springframework.cassandra.core.converter;
|
||||
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* CQL generators for Keyspace object actions.
|
||||
*/
|
||||
package org.springframework.cassandra.core.cql.generator;
|
||||
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* CQL support.
|
||||
*/
|
||||
package org.springframework.cassandra.core.cql;
|
||||
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* CQL core support.
|
||||
*/
|
||||
package org.springframework.cassandra.core;
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Provides a strategy for looking up {@link org.springframework.cassandra.core.session.SessionFactory}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
package org.springframework.cassandra.core.session.lookup;
|
||||
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* CQL support classes.
|
||||
*/
|
||||
package org.springframework.cassandra.core.support;
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.data.cassandra.config;
|
||||
|
||||
import org.springframework.cassandra.config.CassandraCqlClusterFactoryBean;
|
||||
import org.springframework.data.cql.config.CassandraCqlClusterFactoryBean;
|
||||
|
||||
/**
|
||||
* Spring Data Cassandra extension of CassandraCqlClusterFactoryBean. This class exists only in the name of symmetry,
|
||||
|
||||
@@ -26,8 +26,8 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
||||
import org.springframework.data.annotation.Persistent;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
import org.springframework.data.cassandra.core.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.core.mapping.Table;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2017 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -29,12 +29,12 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
import org.springframework.data.cassandra.core.CassandraTemplate;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.datastax.driver.core.Session;
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.config;
|
||||
|
||||
import org.springframework.cassandra.config.CassandraCqlSessionFactoryBean;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminOperations;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
|
||||
import org.springframework.data.cassandra.core.CassandraPersistentEntitySchemaCreator;
|
||||
import org.springframework.data.cassandra.core.CassandraPersistentEntitySchemaDropper;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cql.config.CassandraCqlSessionFactoryBean;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,11 +17,11 @@ package org.springframework.data.cassandra.config;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.cassandra.core.CqlOperations;
|
||||
import org.springframework.cassandra.core.session.DefaultSessionFactory;
|
||||
import org.springframework.cassandra.core.session.SessionFactory;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraTemplate;
|
||||
import org.springframework.data.cql.core.CqlOperations;
|
||||
import org.springframework.data.cql.core.session.DefaultSessionFactory;
|
||||
import org.springframework.data.cql.core.session.SessionFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.driver.core.Session;
|
||||
@@ -89,7 +89,7 @@ public class CassandraTemplateFactoryBean implements FactoryBean<CassandraTempla
|
||||
/**
|
||||
* Sets the Cassandra {@link Session} to use. The {@link CassandraTemplate} will use the logged keyspace of the
|
||||
* underlying {@link Session}. Don't change the keyspace using CQL but use a
|
||||
* {@link org.springframework.cassandra.core.session.SessionFactory}.
|
||||
* {@link org.springframework.data.cql.core.session.SessionFactory}.
|
||||
*
|
||||
* @param session must not be {@literal null}.
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.config;
|
||||
|
||||
import org.springframework.cassandra.config.xml.DefaultCqlBeanNames;
|
||||
import org.springframework.data.cql.config.xml.DefaultCqlBeanNames;
|
||||
|
||||
/**
|
||||
* @author Matthew T. Adams
|
||||
|
||||
@@ -19,25 +19,25 @@ import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.cassandra.config.java.AbstractClusterConfiguration;
|
||||
import org.springframework.cassandra.core.session.DefaultSessionFactory;
|
||||
import org.springframework.cassandra.core.session.SessionFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.data.cassandra.config.CassandraEntityClassScanner;
|
||||
import org.springframework.data.cassandra.config.CassandraSessionFactoryBean;
|
||||
import org.springframework.data.cassandra.config.SchemaAction;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.CassandraCustomConversions;
|
||||
import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminOperations;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.SimpleUserTypeResolver;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraCustomConversions;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver;
|
||||
import org.springframework.data.cassandra.core.mapping.Table;
|
||||
import org.springframework.data.convert.CustomConversions;
|
||||
import org.springframework.data.cql.config.java.AbstractClusterConfiguration;
|
||||
import org.springframework.data.cql.core.session.DefaultSessionFactory;
|
||||
import org.springframework.data.cql.core.session.SessionFactory;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,16 +17,16 @@ package org.springframework.data.cassandra.config.java;
|
||||
|
||||
import reactor.core.scheduler.Schedulers;
|
||||
|
||||
import org.springframework.cassandra.core.ReactiveCqlOperations;
|
||||
import org.springframework.cassandra.core.ReactiveCqlTemplate;
|
||||
import org.springframework.cassandra.core.session.DefaultBridgedReactiveSession;
|
||||
import org.springframework.cassandra.core.session.DefaultReactiveSessionFactory;
|
||||
import org.springframework.cassandra.core.session.ReactiveSession;
|
||||
import org.springframework.cassandra.core.session.ReactiveSessionFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
|
||||
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
|
||||
import org.springframework.data.cassandra.core.ReactiveCassandraTemplate;
|
||||
import org.springframework.data.cql.core.ReactiveCqlOperations;
|
||||
import org.springframework.data.cql.core.ReactiveCqlTemplate;
|
||||
import org.springframework.data.cql.core.session.DefaultBridgedReactiveSession;
|
||||
import org.springframework.data.cql.core.session.DefaultReactiveSessionFactory;
|
||||
import org.springframework.data.cql.core.session.ReactiveSession;
|
||||
import org.springframework.data.cql.core.session.ReactiveSessionFactory;
|
||||
|
||||
/**
|
||||
* Extension to {@link AbstractCassandraConfiguration} providing Spring Data Cassandra configuration for Spring Data's
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -17,12 +17,12 @@ package org.springframework.data.cassandra.config.xml;
|
||||
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.cassandra.config.xml.CassandraCqlClusterParser;
|
||||
import org.springframework.data.cql.config.xml.CassandraCqlClusterParser;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Spring Data Cassandra XML namespace parser for the {@code cassandra:cluster} element.
|
||||
*
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -27,14 +27,14 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.cassandra.config.xml.DefaultCqlBeanNames;
|
||||
import org.springframework.data.cassandra.config.CassandraEntityClassScanner;
|
||||
import org.springframework.data.cassandra.config.DefaultBeanNames;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.EntityMapping;
|
||||
import org.springframework.data.cassandra.mapping.Mapping;
|
||||
import org.springframework.data.cassandra.mapping.PropertyMapping;
|
||||
import org.springframework.data.cassandra.mapping.SimpleUserTypeResolver;
|
||||
import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.EntityMapping;
|
||||
import org.springframework.data.cassandra.core.mapping.Mapping;
|
||||
import org.springframework.data.cassandra.core.mapping.PropertyMapping;
|
||||
import org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver;
|
||||
import org.springframework.data.cql.config.xml.DefaultCqlBeanNames;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -21,13 +21,13 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.data.cassandra.config.DefaultBeanNames;
|
||||
import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Spring Data Cassandra XML namespace parser for the {@code cassandra:converter} element.
|
||||
*
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2017 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -15,20 +15,20 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.config.xml;
|
||||
|
||||
import static org.springframework.cassandra.config.xml.ParsingUtils.*;
|
||||
import static org.springframework.data.cql.config.xml.ParsingUtils.*;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.cassandra.config.xml.CassandraCqlSessionParser;
|
||||
import org.springframework.data.cassandra.config.CassandraSessionFactoryBean;
|
||||
import org.springframework.data.cassandra.config.DefaultBeanNames;
|
||||
import org.springframework.data.cassandra.config.SchemaAction;
|
||||
import org.springframework.data.cql.config.xml.CassandraCqlSessionParser;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Spring Data Cassandra XML namespace parser for the {@code cassandra:session} element.
|
||||
*
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2017 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.config.xml;
|
||||
|
||||
import static org.springframework.cassandra.config.xml.ParsingUtils.*;
|
||||
import static org.springframework.data.cql.config.xml.ParsingUtils.*;
|
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
@@ -29,7 +29,7 @@ import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Spring Data Cassandra XML namespace parser for the {@code cassandra:template} element.
|
||||
*
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
* @author Mateusz Szymczak
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.springframework.data.cassandra.core;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.cassandra.core.AsyncCqlOperations;
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.query.Query;
|
||||
import org.springframework.data.cassandra.core.query.Update;
|
||||
import org.springframework.data.cql.core.AsyncCqlOperations;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
|
||||
import com.datastax.driver.core.Statement;
|
||||
|
||||
@@ -20,25 +20,25 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.cassandra.core.AsyncCqlOperations;
|
||||
import org.springframework.cassandra.core.AsyncCqlTemplate;
|
||||
import org.springframework.cassandra.core.AsyncSessionCallback;
|
||||
import org.springframework.cassandra.core.CqlProvider;
|
||||
import org.springframework.cassandra.core.GuavaListenableFutureAdapter;
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.cassandra.core.session.DefaultSessionFactory;
|
||||
import org.springframework.cassandra.core.session.SessionFactory;
|
||||
import org.springframework.cassandra.core.support.CQLExceptionTranslator;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.core.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.query.Query;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cql.core.AsyncCqlOperations;
|
||||
import org.springframework.data.cql.core.AsyncCqlTemplate;
|
||||
import org.springframework.data.cql.core.AsyncSessionCallback;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlProvider;
|
||||
import org.springframework.data.cql.core.GuavaListenableFutureAdapter;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
import org.springframework.data.cql.core.session.DefaultSessionFactory;
|
||||
import org.springframework.data.cql.core.session.SessionFactory;
|
||||
import org.springframework.data.cql.core.support.CQLExceptionTranslator;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
@@ -182,8 +182,8 @@ public class AsyncCassandraTemplate implements AsyncCassandraOperations {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to
|
||||
* store (map) objects to Cassandra tables.
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to store (map)
|
||||
* objects to Cassandra tables.
|
||||
*
|
||||
* @return the {@link CassandraMappingContext} used by this template.
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraMappingContext
|
||||
@@ -329,8 +329,8 @@ public class AsyncCassandraTemplate implements AsyncCassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return selectOne(getStatementFactory().select(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)), entityClass);
|
||||
return selectOne(getStatementFactory().select(query, getMappingContext().getRequiredPersistentEntity(entityClass)),
|
||||
entityClass);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -344,8 +344,8 @@ public class AsyncCassandraTemplate implements AsyncCassandraOperations {
|
||||
Assert.notNull(update, "Update must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return getAsyncCqlOperations().execute(getStatementFactory().update(query, update,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
return getAsyncCqlOperations().execute(
|
||||
getStatementFactory().update(query, update, getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -357,8 +357,8 @@ public class AsyncCassandraTemplate implements AsyncCassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return getAsyncCqlOperations().execute(getStatementFactory().delete(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
return getAsyncCqlOperations()
|
||||
.execute(getStatementFactory().delete(query, getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -519,8 +519,8 @@ public class AsyncCassandraTemplate implements AsyncCassandraOperations {
|
||||
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
Truncate truncate =
|
||||
QueryBuilder.truncate(getMappingContext().getRequiredPersistentEntity(entityClass).getTableName().toCql());
|
||||
Truncate truncate = QueryBuilder
|
||||
.truncate(getMappingContext().getRequiredPersistentEntity(entityClass).getTableName().toCql());
|
||||
|
||||
return new MappingListenableFutureAdapter<>(getAsyncCqlOperations().execute(truncate), aBoolean -> null);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.data.cassandra.core;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
|
||||
import com.datastax.driver.core.KeyspaceMetadata;
|
||||
import com.datastax.driver.core.TableMetadata;
|
||||
|
||||
@@ -18,17 +18,17 @@ package org.springframework.data.cassandra.core;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.cassandra.core.SessionCallback;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.cassandra.core.cql.generator.CreateTableCqlGenerator;
|
||||
import org.springframework.cassandra.core.cql.generator.DropTableCqlGenerator;
|
||||
import org.springframework.cassandra.core.cql.generator.DropUserTypeCqlGenerator;
|
||||
import org.springframework.cassandra.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.cassandra.core.keyspace.DropTableSpecification;
|
||||
import org.springframework.cassandra.core.keyspace.DropUserTypeSpecification;
|
||||
import org.springframework.cassandra.core.session.SessionFactory;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.SessionCallback;
|
||||
import org.springframework.data.cql.core.generator.CreateTableCqlGenerator;
|
||||
import org.springframework.data.cql.core.generator.DropTableCqlGenerator;
|
||||
import org.springframework.data.cql.core.generator.DropUserTypeCqlGenerator;
|
||||
import org.springframework.data.cql.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.data.cql.core.keyspace.DropTableSpecification;
|
||||
import org.springframework.data.cql.core.keyspace.DropUserTypeSpecification;
|
||||
import org.springframework.data.cql.core.session.SessionFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.driver.core.KeyspaceMetadata;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core;
|
||||
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
|
||||
/**
|
||||
* Batch operations for insert/update/delete actions on a table. {@link CassandraBatchOperations} use logged Cassandra
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.data.cassandra.core;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.driver.core.querybuilder.Batch;
|
||||
|
||||
@@ -19,14 +19,14 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.cassandra.core.CqlOperations;
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.query.Query;
|
||||
import org.springframework.data.cassandra.core.query.Update;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlOperations;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
|
||||
import com.datastax.driver.core.Statement;
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.cassandra.core.cql.generator.CreateTableCqlGenerator;
|
||||
import org.springframework.cassandra.core.cql.generator.CreateUserTypeCqlGenerator;
|
||||
import org.springframework.cassandra.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.cassandra.core.keyspace.CreateUserTypeSpecification;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.generator.CreateTableCqlGenerator;
|
||||
import org.springframework.data.cql.core.generator.CreateUserTypeCqlGenerator;
|
||||
import org.springframework.data.cql.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.data.cql.core.keyspace.CreateUserTypeSpecification;
|
||||
import org.springframework.data.util.Optionals;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -42,9 +42,9 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Paluch
|
||||
* @author Jens Schauder
|
||||
* @since 1.5
|
||||
* @see org.springframework.data.cassandra.mapping.Table
|
||||
* @see org.springframework.data.cassandra.mapping.UserDefinedType
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraType
|
||||
* @see org.springframework.data.cassandra.core.mapping.Table
|
||||
* @see org.springframework.data.cassandra.core.mapping.UserDefinedType
|
||||
* @see org.springframework.data.cassandra.core.mapping.CassandraType
|
||||
*/
|
||||
public class CassandraPersistentEntitySchemaCreator {
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ package org.springframework.data.cassandra.core;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -29,9 +29,9 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 1.5
|
||||
* @see org.springframework.data.cassandra.mapping.Table
|
||||
* @see org.springframework.data.cassandra.mapping.UserDefinedType
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraType
|
||||
* @see org.springframework.data.cassandra.core.mapping.Table
|
||||
* @see org.springframework.data.cassandra.core.mapping.UserDefinedType
|
||||
* @see org.springframework.data.cassandra.core.mapping.CassandraType
|
||||
*/
|
||||
public class CassandraPersistentEntitySchemaDropper {
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CassandraPersistentEntitySchemaDropper {
|
||||
* Drop user types that exist in the keyspace.
|
||||
*
|
||||
* @param dropUnused {@literal true} to drop unused types before creation. Type usage is determined from existing
|
||||
* mapped {@link org.springframework.data.cassandra.mapping.UserDefinedType}s and UDT names on field
|
||||
* mapped {@link org.springframework.data.cassandra.core.mapping.UserDefinedType}s and UDT names on field
|
||||
* specifications.
|
||||
*/
|
||||
public void dropUserTypes(boolean dropUnused) {
|
||||
|
||||
@@ -22,24 +22,24 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.springframework.cassandra.core.CqlOperations;
|
||||
import org.springframework.cassandra.core.CqlProvider;
|
||||
import org.springframework.cassandra.core.CqlTemplate;
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.cassandra.core.SessionCallback;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.cassandra.core.session.DefaultSessionFactory;
|
||||
import org.springframework.cassandra.core.session.SessionFactory;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.core.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.core.query.Query;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlOperations;
|
||||
import org.springframework.data.cql.core.CqlProvider;
|
||||
import org.springframework.data.cql.core.CqlTemplate;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.SessionCallback;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
import org.springframework.data.cql.core.session.DefaultSessionFactory;
|
||||
import org.springframework.data.cql.core.session.SessionFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -142,9 +142,9 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
this.statementFactory = new StatementFactory(new QueryMapper(converter), new UpdateMapper(converter));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.CassandraOperations#getConverter()
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.cassandra.core.CassandraOperations#getConverter()
|
||||
*/
|
||||
@Override
|
||||
public CassandraConverter getConverter() {
|
||||
return this.converter;
|
||||
@@ -170,8 +170,8 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to
|
||||
* store (map) object to Cassandra tables.
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to store (map)
|
||||
* object to Cassandra tables.
|
||||
*
|
||||
* @return the {@link CassandraMappingContext} used by this template.
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraMappingContext
|
||||
@@ -283,8 +283,8 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return select(getStatementFactory().select(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)), entityClass);
|
||||
return select(getStatementFactory().select(query, getMappingContext().getRequiredPersistentEntity(entityClass)),
|
||||
entityClass);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -296,8 +296,8 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return stream(getStatementFactory().select(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)), entityClass);
|
||||
return stream(getStatementFactory().select(query, getMappingContext().getRequiredPersistentEntity(entityClass)),
|
||||
entityClass);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -322,8 +322,8 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
Assert.notNull(update, "Update must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return getCqlOperations().execute(getStatementFactory().update(query, update,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
return getCqlOperations().execute(
|
||||
getStatementFactory().update(query, update, getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -335,8 +335,8 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return getCqlOperations().execute(getStatementFactory().delete(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
return getCqlOperations()
|
||||
.execute(getStatementFactory().delete(query, getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -404,15 +404,14 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
|
||||
CassandraPersistentEntity<?> entity = getMappingContext().getRequiredPersistentEntity(entityClass);
|
||||
|
||||
CassandraPersistentProperty idProperty = entity.getIdProperty().orElseThrow(() ->
|
||||
new IllegalArgumentException(String.format("Entity class [%s] has no primary key",
|
||||
entityClass.getName())));
|
||||
CassandraPersistentProperty idProperty = entity.getIdProperty().orElseThrow(() -> new IllegalArgumentException(
|
||||
String.format("Entity class [%s] has no primary key", entityClass.getName())));
|
||||
|
||||
if (idProperty.isCompositePrimaryKey()) {
|
||||
String typeName = idProperty.getCompositePrimaryKeyEntity().getType().getName();
|
||||
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Entity class [%s] uses a composite primary key class [%s] which this method can't support",
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Entity class [%s] uses a composite primary key class [%s] which this method can't support",
|
||||
entityClass.getName(), typeName));
|
||||
}
|
||||
|
||||
@@ -520,8 +519,8 @@ public class CassandraTemplate implements CassandraOperations {
|
||||
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
Truncate truncate =
|
||||
QueryBuilder.truncate(getMappingContext().getRequiredPersistentEntity(entityClass).getTableName().toCql());
|
||||
Truncate truncate = QueryBuilder
|
||||
.truncate(getMappingContext().getRequiredPersistentEntity(entityClass).getTableName().toCql());
|
||||
|
||||
getCqlOperations().execute(truncate);
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core;
|
||||
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.cassandra.core.QueryOptionsUtil;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.data.convert.EntityWriter;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.QueryOptionsUtil;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.driver.core.querybuilder.Delete;
|
||||
|
||||
@@ -19,13 +19,13 @@ import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.cassandra.core.ReactiveCqlOperations;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.query.Query;
|
||||
import org.springframework.data.cassandra.core.query.Update;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.ReactiveCqlOperations;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
|
||||
import com.datastax.driver.core.Statement;
|
||||
|
||||
|
||||
@@ -18,30 +18,29 @@ package org.springframework.data.cassandra.core;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.cassandra.core.CqlProvider;
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.cassandra.core.ReactiveCqlOperations;
|
||||
import org.springframework.cassandra.core.ReactiveCqlTemplate;
|
||||
import org.springframework.cassandra.core.ReactiveSessionCallback;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.cassandra.core.session.DefaultReactiveSessionFactory;
|
||||
import org.springframework.cassandra.core.session.ReactiveResultSet;
|
||||
import org.springframework.cassandra.core.session.ReactiveSession;
|
||||
import org.springframework.cassandra.core.session.ReactiveSessionFactory;
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.core.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.query.Query;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlProvider;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.ReactiveCqlOperations;
|
||||
import org.springframework.data.cql.core.ReactiveCqlTemplate;
|
||||
import org.springframework.data.cql.core.ReactiveSessionCallback;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
import org.springframework.data.cql.core.session.DefaultReactiveSessionFactory;
|
||||
import org.springframework.data.cql.core.session.ReactiveResultSet;
|
||||
import org.springframework.data.cql.core.session.ReactiveSession;
|
||||
import org.springframework.data.cql.core.session.ReactiveSessionFactory;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import com.datastax.driver.core.Session;
|
||||
import com.datastax.driver.core.SimpleStatement;
|
||||
import com.datastax.driver.core.Statement;
|
||||
@@ -67,10 +66,10 @@ import com.datastax.driver.core.querybuilder.Update;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author John Blum
|
||||
* @see org.springframework.cassandra.core.ReactiveCqlOperations
|
||||
* @see org.springframework.data.cassandra.convert.CassandraConverter
|
||||
* @see org.springframework.data.cassandra.convert.QueryMapper
|
||||
* @see org.springframework.data.cassandra.convert.UpdateMapper
|
||||
* @see org.springframework.data.cql.core.ReactiveCqlOperations
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
* @see org.springframework.data.cassandra.core.convert.QueryMapper
|
||||
* @see org.springframework.data.cassandra.core.convert.UpdateMapper
|
||||
* @see org.springframework.data.cassandra.core.ReactiveCassandraOperations
|
||||
* @see com.datastax.driver.core.querybuilder.Delete
|
||||
* @see com.datastax.driver.core.querybuilder.Insert
|
||||
@@ -109,7 +108,7 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
* @param session {@link ReactiveSession} used to interact with Cassandra; must not be {@literal null}.
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see org.springframework.data.cassandra.convert.CassandraConverter
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
* @see com.datastax.driver.core.Session
|
||||
*/
|
||||
public ReactiveCassandraTemplate(ReactiveSession session, CassandraConverter converter) {
|
||||
@@ -123,7 +122,7 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
* @param sessionFactory {@link ReactiveSessionFactory} used to interact with Cassandra; must not be {@literal null}.
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see org.springframework.data.cassandra.convert.CassandraConverter
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
* @see com.datastax.driver.core.Session
|
||||
*/
|
||||
public ReactiveCassandraTemplate(ReactiveSessionFactory sessionFactory, CassandraConverter converter) {
|
||||
@@ -145,7 +144,7 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
* {@literal null}.
|
||||
* @param converter {@link CassandraConverter} used to convert between Java and Cassandra types; must not be
|
||||
* {@literal null}.
|
||||
* @see org.springframework.data.cassandra.convert.CassandraConverter
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
* @see com.datastax.driver.core.Session
|
||||
*/
|
||||
public ReactiveCassandraTemplate(ReactiveCqlOperations reactiveCqlOperations, CassandraConverter converter) {
|
||||
@@ -179,8 +178,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to
|
||||
* store (map) objects to Cassandra tables.
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to store (map)
|
||||
* objects to Cassandra tables.
|
||||
*
|
||||
* @return the {@link CassandraMappingContext} used by this template.
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraMappingContext
|
||||
@@ -277,8 +276,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return select(getStatementFactory().select(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)), entityClass);
|
||||
return select(getStatementFactory().select(query, getMappingContext().getRequiredPersistentEntity(entityClass)),
|
||||
entityClass);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -290,8 +289,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return selectOne(getStatementFactory().select(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)), entityClass);
|
||||
return selectOne(getStatementFactory().select(query, getMappingContext().getRequiredPersistentEntity(entityClass)),
|
||||
entityClass);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -305,8 +304,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
Assert.notNull(update, "Update must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return getReactiveCqlOperations().execute(getStatementFactory().update(query, update,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
return getReactiveCqlOperations().execute(
|
||||
getStatementFactory().update(query, update, getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -318,8 +317,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
Assert.notNull(query, "Query must not be null");
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
return getReactiveCqlOperations().execute(getStatementFactory().delete(query,
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
return getReactiveCqlOperations()
|
||||
.execute(getStatementFactory().delete(query, getMappingContext().getRequiredPersistentEntity(entityClass)));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -403,8 +402,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
|
||||
@Override
|
||||
public Publisher<T> doInSession(ReactiveSession session) throws DriverException, DataAccessException {
|
||||
return session.execute(insert).flatMap(
|
||||
reactiveResultSet -> reactiveResultSet.wasApplied() ? Mono.just(entity) : Mono.empty());
|
||||
return session.execute(insert)
|
||||
.flatMap(reactiveResultSet -> reactiveResultSet.wasApplied() ? Mono.just(entity) : Mono.empty());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -538,8 +537,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
|
||||
@Override
|
||||
public Publisher<T> doInSession(ReactiveSession session) throws DriverException, DataAccessException {
|
||||
return session.execute(delete).flatMap(
|
||||
reactiveResultSet -> reactiveResultSet.wasApplied() ? Mono.just(entity) : Mono.empty());
|
||||
return session.execute(delete)
|
||||
.flatMap(reactiveResultSet -> reactiveResultSet.wasApplied() ? Mono.just(entity) : Mono.empty());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -581,8 +580,8 @@ public class ReactiveCassandraTemplate implements ReactiveCassandraOperations {
|
||||
|
||||
Assert.notNull(entityClass, "Entity type must not be null");
|
||||
|
||||
Truncate truncate = QueryBuilder.truncate(
|
||||
getMappingContext().getRequiredPersistentEntity(entityClass).getTableName().toCql());
|
||||
Truncate truncate = QueryBuilder
|
||||
.truncate(getMappingContext().getRequiredPersistentEntity(entityClass).getTableName().toCql());
|
||||
|
||||
return getReactiveCqlOperations().execute(truncate).then();
|
||||
}
|
||||
|
||||
@@ -20,11 +20,9 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.cassandra.core.QueryOptionsUtil;
|
||||
import org.springframework.cassandra.core.WriteOptions;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cassandra.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.convert.QueryMapper;
|
||||
import org.springframework.data.cassandra.core.convert.UpdateMapper;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.query.Columns.ColumnSelector;
|
||||
import org.springframework.data.cassandra.core.query.Columns.FunctionCall;
|
||||
import org.springframework.data.cassandra.core.query.Columns.Selector;
|
||||
@@ -42,7 +40,9 @@ import org.springframework.data.cassandra.core.query.Update.RemoveOp;
|
||||
import org.springframework.data.cassandra.core.query.Update.SetAtIndexOp;
|
||||
import org.springframework.data.cassandra.core.query.Update.SetAtKeyOp;
|
||||
import org.springframework.data.cassandra.core.query.Update.SetOp;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.QueryOptionsUtil;
|
||||
import org.springframework.data.cql.core.WriteOptions;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -108,7 +108,7 @@ public class StatementFactory {
|
||||
* Returns the {@link QueryMapper} used to map {@link Query} to CQL-specific data types.
|
||||
*
|
||||
* @return the {@link QueryMapper} used to map {@link Query} to CQL-specific data types.
|
||||
* @see org.springframework.data.cassandra.convert.QueryMapper
|
||||
* @see QueryMapper
|
||||
*/
|
||||
protected QueryMapper getQueryMapper() {
|
||||
return this.queryMapper;
|
||||
@@ -118,7 +118,7 @@ public class StatementFactory {
|
||||
* Returns the {@link UpdateMapper} used to map {@link Update} to CQL-specific data types.
|
||||
*
|
||||
* @return the {@link UpdateMapper} used to map {@link Update} to CQL-specific data types.
|
||||
* @see org.springframework.data.cassandra.convert.UpdateMapper
|
||||
* @see UpdateMapper
|
||||
*/
|
||||
protected UpdateMapper getUpdateMapper() {
|
||||
return this.updateMapper;
|
||||
@@ -140,8 +140,7 @@ public class StatementFactory {
|
||||
|
||||
List<Selector> selectors = getQueryMapper().getMappedSelectors(query.getColumns(), entity);
|
||||
|
||||
Sort sort = Optional.ofNullable(query.getSort())
|
||||
.map(querySort -> getQueryMapper().getMappedSort(querySort, entity))
|
||||
Sort sort = Optional.ofNullable(query.getSort()).map(querySort -> getQueryMapper().getMappedSort(querySort, entity))
|
||||
.orElse(null);
|
||||
|
||||
Select select = select(selectors, entity.getTableName(), filter, sort);
|
||||
@@ -293,8 +292,8 @@ public class StatementFactory {
|
||||
private static Assignment getAssignment(IncrOp incrOp) {
|
||||
|
||||
return incrOp.getValue().intValue() > 0
|
||||
? QueryBuilder.incr(incrOp.getColumnName().toCql(), Math.abs(incrOp.getValue().intValue()))
|
||||
: QueryBuilder.decr(incrOp.getColumnName().toCql(), Math.abs(incrOp.getValue().intValue()));
|
||||
? QueryBuilder.incr(incrOp.getColumnName().toCql(), Math.abs(incrOp.getValue().intValue()))
|
||||
: QueryBuilder.decr(incrOp.getColumnName().toCql(), Math.abs(incrOp.getValue().intValue()));
|
||||
}
|
||||
|
||||
private static Assignment getAssignment(SetOp updateOp) {
|
||||
@@ -333,8 +332,8 @@ public class StatementFactory {
|
||||
}
|
||||
|
||||
return Mode.PREPEND.equals(updateOp.getMode())
|
||||
? QueryBuilder.prependAll(updateOp.getColumnName().toCql(), (List) updateOp.getValue())
|
||||
: QueryBuilder.appendAll(updateOp.getColumnName().toCql(), (List) updateOp.getValue());
|
||||
? QueryBuilder.prependAll(updateOp.getColumnName().toCql(), (List) updateOp.getValue())
|
||||
: QueryBuilder.appendAll(updateOp.getColumnName().toCql(), (List) updateOp.getValue());
|
||||
}
|
||||
|
||||
private static Assignment getAssignment(AddToMapOp updateOp) {
|
||||
@@ -429,7 +428,7 @@ public class StatementFactory {
|
||||
return QueryBuilder.containsKey(columnName, predicate.getValue());
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("Criteria %s %s %s not supported",
|
||||
columnName, predicate.getOperator(), predicate.getValue()));
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Criteria %s %s %s not supported", columnName, predicate.getOperator(), predicate.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.data.convert.EntityInstantiators;
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
* @see org.springframework.beans.factory.InitializingBean
|
||||
* @see org.springframework.data.cassandra.convert.CassandraConverter
|
||||
* @see org.springframework.data.cassandra.core.convert.CassandraConverter
|
||||
*/
|
||||
public abstract class AbstractCassandraConverter implements CassandraConverter, InitializingBean {
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
|
||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -13,13 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.convert.CustomConversions;
|
||||
import org.springframework.data.convert.EntityConverter;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
@@ -51,11 +51,11 @@ public interface CassandraConverter
|
||||
* Returns the Id for an entity. It can return:
|
||||
* <ul>
|
||||
* <li>A singular value if for a simple {@link org.springframework.data.annotation.Id} or
|
||||
* {@link org.springframework.data.cassandra.mapping.PrimaryKey} Id</li>
|
||||
* {@link org.springframework.data.cassandra.core.mapping.PrimaryKey} Id</li>
|
||||
* <li>A {@link org.springframework.data.cassandra.repository.MapId} for composite
|
||||
* {@link org.springframework.data.cassandra.mapping.PrimaryKeyColumn} Id's</li>
|
||||
* <li>A the composite primary key for {@link org.springframework.data.cassandra.mapping.PrimaryKey} using a
|
||||
* {@link org.springframework.data.cassandra.mapping.PrimaryKeyClass}</li>
|
||||
* {@link org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn} Id's</li>
|
||||
* <li>A the composite primary key for {@link org.springframework.data.cassandra.core.mapping.PrimaryKey} using a
|
||||
* {@link org.springframework.data.cassandra.core.mapping.PrimaryKeyClass}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param object must not be {@literal null}.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
@@ -23,11 +23,11 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.cassandra.core.converter.RowToListConverter;
|
||||
import org.springframework.cassandra.core.converter.RowToMapConverter;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.converter.ConverterFactory;
|
||||
import org.springframework.data.convert.ReadingConverter;
|
||||
import org.springframework.data.cql.core.converter.RowToListConverter;
|
||||
import org.springframework.data.cql.core.converter.RowToMapConverter;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.NumberUtils;
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraSimpleTypeHolder;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013-2016 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
|
||||
*
|
||||
*
|
||||
* http://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.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import com.datastax.driver.core.Row;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
|
||||
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.mapping.model.PropertyValueProvider;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ public interface CassandraValueProvider extends PropertyValueProvider<CassandraP
|
||||
|
||||
/**
|
||||
* Returns whether the underlying source contains a data source for the given {@link CassandraPersistentProperty}.
|
||||
*
|
||||
*
|
||||
* @param property must not be {@literal null}.
|
||||
* @return {@literal true} if the underlying source contains a data source for the given
|
||||
* {@link CassandraPersistentProperty}.
|
||||
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
|
||||
import com.datastax.driver.core.CodecRegistry;
|
||||
import com.datastax.driver.core.ColumnDefinitions;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,6 +39,5 @@ public class CustomConversions extends CassandraCustomConversions {
|
||||
*/
|
||||
private CustomConversions(List<?> converters) {
|
||||
super(converters);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import static org.springframework.data.cassandra.repository.support.BasicMapId.Entry;
|
||||
import static org.springframework.data.cassandra.repository.support.BasicMapId.id;
|
||||
import static org.springframework.data.cassandra.repository.support.BasicMapId.*;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -24,8 +25,8 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -33,11 +34,11 @@ import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.CollectionFactory;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.mapping.CassandraType;
|
||||
import org.springframework.data.cassandra.core.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraType;
|
||||
import org.springframework.data.cassandra.repository.MapId;
|
||||
import org.springframework.data.cassandra.repository.MapIdentifiable;
|
||||
import org.springframework.data.convert.EntityInstantiator;
|
||||
@@ -55,9 +56,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.datastax.driver.core.CodecRegistry;
|
||||
import com.datastax.driver.core.DataType;
|
||||
import com.datastax.driver.core.Row;
|
||||
@@ -150,8 +148,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
return getConversionService().convert(row, type);
|
||||
}
|
||||
|
||||
CassandraPersistentEntity<R> persistentEntity =
|
||||
(CassandraPersistentEntity<R>) getMappingContext().getRequiredPersistentEntity(typeInfo);
|
||||
CassandraPersistentEntity<R> persistentEntity = (CassandraPersistentEntity<R>) getMappingContext()
|
||||
.getRequiredPersistentEntity(typeInfo);
|
||||
|
||||
return readEntityFromRow(persistentEntity, row);
|
||||
}
|
||||
@@ -162,9 +160,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
|
||||
BasicCassandraRowValueProvider rowValueProvider = new BasicCassandraRowValueProvider(row, expressionEvaluator);
|
||||
|
||||
PersistentEntityParameterValueProvider<CassandraPersistentProperty> parameterValueProvider =
|
||||
new PersistentEntityParameterValueProvider<>(entity,
|
||||
new MappingAndConvertingValueProvider(rowValueProvider), Optional.empty());
|
||||
PersistentEntityParameterValueProvider<CassandraPersistentProperty> parameterValueProvider = new PersistentEntityParameterValueProvider<>(
|
||||
entity, new MappingAndConvertingValueProvider(rowValueProvider), Optional.empty());
|
||||
|
||||
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
|
||||
S instance = instantiator.createInstance(entity, parameterValueProvider);
|
||||
@@ -178,12 +175,11 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
|
||||
DefaultSpELExpressionEvaluator expressionEvaluator = new DefaultSpELExpressionEvaluator(udtValue, spELContext);
|
||||
|
||||
CassandraUDTValueProvider valueProvider =
|
||||
new CassandraUDTValueProvider(udtValue, CodecRegistry.DEFAULT_INSTANCE, expressionEvaluator);
|
||||
CassandraUDTValueProvider valueProvider = new CassandraUDTValueProvider(udtValue, CodecRegistry.DEFAULT_INSTANCE,
|
||||
expressionEvaluator);
|
||||
|
||||
PersistentEntityParameterValueProvider<CassandraPersistentProperty> parameterValueProvider =
|
||||
new PersistentEntityParameterValueProvider<>(entity,
|
||||
new MappingAndConvertingValueProvider(valueProvider), Optional.empty());
|
||||
PersistentEntityParameterValueProvider<CassandraPersistentProperty> parameterValueProvider = new PersistentEntityParameterValueProvider<>(
|
||||
entity, new MappingAndConvertingValueProvider(valueProvider), Optional.empty());
|
||||
|
||||
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
|
||||
S instance = instantiator.createInstance(entity, parameterValueProvider);
|
||||
@@ -202,8 +198,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
protected void readProperties(CassandraPersistentEntity<?> entity, CassandraValueProvider valueProvider,
|
||||
PersistentPropertyAccessor propertyAccessor) {
|
||||
|
||||
entity.getPersistentProperties().forEach(property ->
|
||||
MappingCassandraConverter.this.readProperty(entity, property, valueProvider, propertyAccessor));
|
||||
entity.getPersistentProperties().forEach(
|
||||
property -> MappingCassandraConverter.this.readProperty(entity, property, valueProvider, propertyAccessor));
|
||||
}
|
||||
|
||||
protected void readProperty(CassandraPersistentEntity<?> entity, CassandraPersistentProperty property,
|
||||
@@ -269,10 +265,8 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Optional<Object> convertToColumnType(Optional<T> obj) {
|
||||
|
||||
return convertToColumnType(obj,
|
||||
obj.map(Object::getClass)
|
||||
.map(ClassTypeInformation::from)
|
||||
.orElse((ClassTypeInformation) ClassTypeInformation.OBJECT));
|
||||
return convertToColumnType(obj, obj.map(Object::getClass).map(ClassTypeInformation::from)
|
||||
.orElse((ClassTypeInformation) ClassTypeInformation.OBJECT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -671,19 +665,17 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
|
||||
I value = optional.get();
|
||||
|
||||
Class<O> requestedTargetType = Optional.ofNullable(typeInformation)
|
||||
.map(typeInfo -> (Class<O>) typeInfo.getType())
|
||||
Class<O> requestedTargetType = Optional.ofNullable(typeInformation).map(typeInfo -> (Class<O>) typeInfo.getType())
|
||||
.orElse(null);
|
||||
|
||||
if (getCustomConversions().hasCustomWriteTarget(value.getClass(), requestedTargetType)) {
|
||||
return Optional.ofNullable((O) getConversionService().convert(value,
|
||||
getCustomConversions().getCustomWriteTarget(value.getClass(), requestedTargetType)
|
||||
.orElse(requestedTargetType)));
|
||||
return Optional.ofNullable((O) getConversionService().convert(value, getCustomConversions()
|
||||
.getCustomWriteTarget(value.getClass(), requestedTargetType).orElse(requestedTargetType)));
|
||||
}
|
||||
|
||||
if (getCustomConversions().hasCustomWriteTarget(value.getClass())) {
|
||||
return Optional.ofNullable((O) getConversionService().convert(value,
|
||||
getCustomConversions().getCustomWriteTarget(value.getClass()).get()));
|
||||
getCustomConversions().getCustomWriteTarget(value.getClass()).get()));
|
||||
}
|
||||
|
||||
if (getCustomConversions().isSimpleType(value.getClass())) {
|
||||
@@ -700,15 +692,13 @@ public class MappingCassandraConverter extends AbstractCassandraConverter
|
||||
Collection<Object> original = (Collection<Object>) value;
|
||||
Collection<Object> converted = CollectionFactory.createCollection(getCollectionType(type), original.size());
|
||||
|
||||
original.stream()
|
||||
.map(element -> convertToColumnType(Optional.ofNullable(element), actualType).orElse(null))
|
||||
original.stream().map(element -> convertToColumnType(Optional.ofNullable(element), actualType).orElse(null))
|
||||
.forEach(converted::add);
|
||||
|
||||
return Optional.of((O) converted);
|
||||
}
|
||||
|
||||
Optional<CassandraPersistentEntity<?>> optionalUdt = getMappingContext()
|
||||
.getPersistentEntity(actualType.getType())
|
||||
Optional<CassandraPersistentEntity<?>> optionalUdt = getMappingContext().getPersistentEntity(actualType.getType())
|
||||
.filter(CassandraPersistentEntity::isUserDefinedType);
|
||||
|
||||
if (optionalUdt.isPresent()) {
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -23,7 +23,9 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.core.query.ColumnName;
|
||||
import org.springframework.data.cassandra.core.query.Columns;
|
||||
import org.springframework.data.cassandra.core.query.Columns.ColumnSelector;
|
||||
@@ -33,9 +35,7 @@ import org.springframework.data.cassandra.core.query.Criteria;
|
||||
import org.springframework.data.cassandra.core.query.CriteriaDefinition;
|
||||
import org.springframework.data.cassandra.core.query.CriteriaDefinition.Predicate;
|
||||
import org.springframework.data.cassandra.core.query.Filter;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
@@ -87,8 +87,7 @@ public class QueryMapper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configured {@link CassandraConverter} used to convert object values into
|
||||
* Cassandra column typed values.
|
||||
* Returns the configured {@link CassandraConverter} used to convert object values into Cassandra column typed values.
|
||||
*
|
||||
* @return the configured {@link CassandraConverter}.
|
||||
* @see org.springframework.data.cassandra.convert.CassandraConverter
|
||||
@@ -98,8 +97,8 @@ public class QueryMapper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configured {@link CassandraMappingContext} containing mapping meta-data (persistent entities
|
||||
* and properties) used to store (map) objects to Cassandra tables (rows/columns).
|
||||
* Returns the configured {@link CassandraMappingContext} containing mapping meta-data (persistent entities and
|
||||
* properties) used to store (map) objects to Cassandra tables (rows/columns).
|
||||
*
|
||||
* @return the configured {@link CassandraMappingContext}.
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraMappingContext
|
||||
@@ -117,8 +116,8 @@ public class QueryMapper {
|
||||
public List<Selector> getColumns(CassandraPersistentEntity<?> entity) {
|
||||
|
||||
return entity.getPersistentProperties() //
|
||||
.flatMap(p -> p.getColumnNames().stream()).map(ColumnSelector::from) //
|
||||
.collect(Collectors.toList());
|
||||
.flatMap(p -> p.getColumnNames().stream()).map(ColumnSelector::from) //
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,28 +207,23 @@ public class QueryMapper {
|
||||
|
||||
ColumnSelector mappedColumnSelector = ColumnSelector.from(cqlIdentifier);
|
||||
|
||||
return columnSelector.getAlias()
|
||||
.map(mappedColumnSelector::as)
|
||||
.orElse(mappedColumnSelector);
|
||||
return columnSelector.getAlias().map(mappedColumnSelector::as).orElse(mappedColumnSelector);
|
||||
}
|
||||
|
||||
if (selector instanceof FunctionCall) {
|
||||
|
||||
FunctionCall functionCall = (FunctionCall) selector;
|
||||
|
||||
List<Object> mappedParameters = functionCall.getParameters()
|
||||
.stream()
|
||||
.map(obj -> {
|
||||
if (obj instanceof Selector) {
|
||||
return getMappedSelector((Selector) obj, cqlIdentifier);
|
||||
}
|
||||
List<Object> mappedParameters = functionCall.getParameters().stream().map(obj -> {
|
||||
if (obj instanceof Selector) {
|
||||
return getMappedSelector((Selector) obj, cqlIdentifier);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}) //
|
||||
return obj;
|
||||
}) //
|
||||
.collect(Collectors.toList());
|
||||
|
||||
FunctionCall mappedFunctionCall =
|
||||
FunctionCall.from(functionCall.getExpression(), mappedParameters.toArray());
|
||||
FunctionCall mappedFunctionCall = FunctionCall.from(functionCall.getExpression(), mappedParameters.toArray());
|
||||
|
||||
return functionCall.getAlias() //
|
||||
.map(mappedFunctionCall::as) //
|
||||
@@ -341,19 +335,16 @@ public class QueryMapper {
|
||||
* @return
|
||||
*/
|
||||
protected Field createPropertyField(CassandraPersistentEntity<?> entity, ColumnName key) {
|
||||
return Optional.ofNullable(entity).<Field>map(e -> new MetadataBackedField(key, e, getMappingContext()))
|
||||
.orElseGet(() -> new Field(key));
|
||||
return Optional.ofNullable(entity).<Field> map(e -> new MetadataBackedField(key, e, getMappingContext()))
|
||||
.orElseGet(() -> new Field(key));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
TypeInformation<?> getTypeInformation(Field field, Optional<? extends Object> value) {
|
||||
|
||||
return field.getProperty().map(CassandraPersistentProperty::getTypeInformation)
|
||||
.orElseGet(() ->
|
||||
value.map(Object::getClass)
|
||||
.map(ClassTypeInformation::from)
|
||||
.orElse((ClassTypeInformation) ClassTypeInformation.OBJECT)
|
||||
);
|
||||
.orElseGet(() -> value.map(Object::getClass).map(ClassTypeInformation::from)
|
||||
.orElse((ClassTypeInformation) ClassTypeInformation.OBJECT));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,8 +411,8 @@ public class QueryMapper {
|
||||
private final Optional<CassandraPersistentProperty> optionalProperty;
|
||||
|
||||
/**
|
||||
* Creates a new {@link MetadataBackedField} with the given name, {@link CassandraPersistentEntity}
|
||||
* and {@link MappingContext}.
|
||||
* Creates a new {@link MetadataBackedField} with the given name, {@link CassandraPersistentEntity} and
|
||||
* {@link MappingContext}.
|
||||
*
|
||||
* @param name must not be {@literal null} or empty.
|
||||
* @param entity must not be {@literal null}.
|
||||
@@ -469,8 +460,8 @@ public class QueryMapper {
|
||||
PropertyPath propertyPath = PropertyPath.from(pathExpression.replaceAll("\\.\\d", ""),
|
||||
entity.getTypeInformation());
|
||||
|
||||
PersistentPropertyPath<CassandraPersistentProperty> persistentPropertyPath =
|
||||
mappingContext.getPersistentPropertyPath(propertyPath);
|
||||
PersistentPropertyPath<CassandraPersistentProperty> persistentPropertyPath = mappingContext
|
||||
.getPersistentPropertyPath(propertyPath);
|
||||
|
||||
return Optional.of(persistentPropertyPath);
|
||||
} catch (PropertyReferenceException e) {
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.expression.PropertyAccessor;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.core.query.Filter;
|
||||
import org.springframework.data.cassandra.core.query.Update;
|
||||
import org.springframework.data.cassandra.core.query.Update.AddToMapOp;
|
||||
@@ -35,7 +36,6 @@ import org.springframework.data.cassandra.core.query.Update.RemoveOp;
|
||||
import org.springframework.data.cassandra.core.query.Update.SetAtIndexOp;
|
||||
import org.springframework.data.cassandra.core.query.Update.SetAtKeyOp;
|
||||
import org.springframework.data.cassandra.core.query.Update.SetOp;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -126,8 +126,8 @@ public class UpdateMapper extends QueryMapper {
|
||||
|
||||
SetAtKeyOp op = (SetAtKeyOp) updateOp;
|
||||
|
||||
Optional<? extends TypeInformation<?>> typeInformation =
|
||||
field.getProperty().map(PersistentProperty::getTypeInformation);
|
||||
Optional<? extends TypeInformation<?>> typeInformation = field.getProperty()
|
||||
.map(PersistentProperty::getTypeInformation);
|
||||
|
||||
Optional<TypeInformation<?>> keyType = typeInformation.map(TypeInformation::getActualType);
|
||||
Optional<TypeInformation<?>> valueType = typeInformation.flatMap(TypeInformation::getMapValueType);
|
||||
@@ -150,8 +150,8 @@ public class UpdateMapper extends QueryMapper {
|
||||
|
||||
SetAtIndexOp op = (SetAtIndexOp) updateOp;
|
||||
|
||||
Optional<Object> mappedValue = getConverter().convertToColumnType(
|
||||
Optional.ofNullable(op.getValue()), typeInformation);
|
||||
Optional<Object> mappedValue = getConverter().convertToColumnType(Optional.ofNullable(op.getValue()),
|
||||
typeInformation);
|
||||
|
||||
return new SetAtIndexOp(field.getMappedKey(), op.getIndex(), mappedValue.orElse(null));
|
||||
}
|
||||
@@ -162,10 +162,8 @@ public class UpdateMapper extends QueryMapper {
|
||||
|
||||
if (collection.isEmpty()) {
|
||||
|
||||
DataType.Name dataType = field.getProperty()
|
||||
.map(property -> getMappingContext().getDataType(property))
|
||||
.map(DataType::getName)
|
||||
.orElse(Name.LIST);
|
||||
DataType.Name dataType = field.getProperty().map(property -> getMappingContext().getDataType(property))
|
||||
.map(DataType::getName).orElse(Name.LIST);
|
||||
|
||||
if (dataType == Name.SET) {
|
||||
return new SetOp(field.getMappedKey(), Collections.emptySet());
|
||||
@@ -219,8 +217,8 @@ public class UpdateMapper extends QueryMapper {
|
||||
|
||||
private AssignmentOp getMappedUpdateOperation(Field field, AddToMapOp updateOp) {
|
||||
|
||||
Optional<? extends TypeInformation<?>> typeInformation =
|
||||
field.getProperty().map(PersistentProperty::getTypeInformation);
|
||||
Optional<? extends TypeInformation<?>> typeInformation = field.getProperty()
|
||||
.map(PersistentProperty::getTypeInformation);
|
||||
|
||||
Optional<TypeInformation<?>> keyType = typeInformation.map(TypeInformation::getActualType);
|
||||
Optional<TypeInformation<?>> valueType = typeInformation.flatMap(TypeInformation::getMapValueType);
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Spring Data Cassandra specific converter infrastructure.
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
package org.springframework.data.cassandra.core.convert;
|
||||
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
|
||||
import static org.springframework.cassandra.core.keyspace.CreateTableSpecification.createTable;
|
||||
import static org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder.getDataTypeFor;
|
||||
import static org.springframework.data.cassandra.core.mapping.CassandraSimpleTypeHolder.*;
|
||||
import static org.springframework.data.cql.core.CqlIdentifier.*;
|
||||
import static org.springframework.data.cql.core.keyspace.CreateTableSpecification.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -29,15 +29,15 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.cassandra.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.cassandra.core.keyspace.CreateUserTypeSpecification;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.data.cassandra.convert.CassandraCustomConversions;
|
||||
import org.springframework.data.cassandra.mapping.UserTypeUtil.FrozenLiteralDataType;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraCustomConversions;
|
||||
import org.springframework.data.cassandra.core.mapping.UserTypeUtil.FrozenLiteralDataType;
|
||||
import org.springframework.data.convert.CustomConversions;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.data.cql.core.keyspace.CreateUserTypeSpecification;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.PropertyHandler;
|
||||
import org.springframework.data.mapping.context.AbstractMappingContext;
|
||||
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
|
||||
import static org.springframework.data.cql.core.CqlIdentifier.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
@@ -23,13 +23,13 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.cassandra.support.exception.UnsupportedCassandraOperationException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.expression.BeanFactoryAccessor;
|
||||
import org.springframework.context.expression.BeanFactoryResolver;
|
||||
import org.springframework.data.cassandra.util.SpelUtils;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.support.exception.UnsupportedCassandraOperationException;
|
||||
import org.springframework.data.mapping.Association;
|
||||
import org.springframework.data.mapping.AssociationHandler;
|
||||
import org.springframework.data.mapping.model.BasicPersistentEntity;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.cqlId;
|
||||
import static org.springframework.data.cql.core.CqlIdentifier.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -25,9 +25,6 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.cassandra.core.Ordering;
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.expression.BeanFactoryAccessor;
|
||||
@@ -35,6 +32,9 @@ import org.springframework.context.expression.BeanFactoryResolver;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.cassandra.util.SpelUtils;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.Ordering;
|
||||
import org.springframework.data.cql.core.PrimaryKeyType;
|
||||
import org.springframework.data.mapping.Association;
|
||||
import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty;
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
* Copyright 2013-2017 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* {@link Comparator} implementation that uses {@link Column#value()}.
|
||||
*
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@@ -13,12 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.cassandra.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.cassandra.core.keyspace.CreateUserTypeSpecification;
|
||||
import org.springframework.data.cql.core.keyspace.CreateTableSpecification;
|
||||
import org.springframework.data.cql.core.keyspace.CreateUserTypeSpecification;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
* Copyright 2013-2017 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.model.MutablePersistentEntity;
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.datastax.driver.core.UserType;
|
||||
|
||||
/**
|
||||
* Cassandra specific {@link PersistentEntity} abstraction.
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
@@ -51,14 +51,14 @@ public interface CassandraPersistentEntity<T>
|
||||
|
||||
/**
|
||||
* Sets the CQL table name.
|
||||
*
|
||||
*
|
||||
* @param tableName must not be {@literal null}.
|
||||
*/
|
||||
void setTableName(CqlIdentifier tableName);
|
||||
|
||||
/**
|
||||
* Sets whether to enforce quoting when using the {@link #getTableName()} in CQL.
|
||||
*
|
||||
*
|
||||
* @param forceQuote {@literal true} to enforce quoting; {@literal false} to disable enforced quoting usage.
|
||||
*/
|
||||
void setForceQuote(boolean forceQuote);
|
||||
@@ -1,32 +1,32 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
|
||||
/**
|
||||
* Interface for Cassandra Persistent Entity Mapping Verification.
|
||||
*
|
||||
*
|
||||
* @author David Webb
|
||||
*/
|
||||
public interface CassandraPersistentEntityMetadataVerifier {
|
||||
|
||||
/**
|
||||
* Performs verification on the Persistent Entity to ensure all markers and marker combinations are valid.
|
||||
*
|
||||
*
|
||||
* @param entity
|
||||
*/
|
||||
void verify(CassandraPersistentEntity<?> entity) throws MappingException;
|
||||
@@ -13,16 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.cassandra.core.Ordering;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.Ordering;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*
|
||||
* Copyright 2013-2017 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
|
||||
/**
|
||||
* {@link Comparator} implementation that orders {@link CassandraPersistentProperty} instances.
|
||||
@@ -28,8 +28,7 @@ import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
* <li>Composite primary keys first (equal if both {@link CassandraPersistentProperty} are a composite primary key)</li>
|
||||
* <li>Primary key columns (see {@link CassandraPrimaryKeyColumnAnnotationComparator}, compare by ordinal/name/ordering)
|
||||
* </li>
|
||||
* <li>Regular columns, compared by column name (see
|
||||
* {@link org.springframework.cassandra.core.cql.CqlIdentifier#compareTo(CqlIdentifier)})</li>
|
||||
* <li>Regular columns, compared by column name (see {@link CqlIdentifier#compareTo(CqlIdentifier)})</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Alex Shvid
|
||||
@@ -37,7 +36,7 @@ import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
* @author Mark Paluch
|
||||
* @author John Blum
|
||||
* @see java.util.Comparator
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraPersistentProperty
|
||||
* @see org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty
|
||||
*/
|
||||
public enum CassandraPersistentPropertyComparator implements Comparator<CassandraPersistentProperty> {
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*
|
||||
* Copyright 2013-2017 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.springframework.cassandra.core.Ordering;
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.cql.core.Ordering;
|
||||
import org.springframework.data.cql.core.PrimaryKeyType;
|
||||
|
||||
/**
|
||||
* {@link Comparator} implementation that uses, in order, the...
|
||||
@@ -28,14 +28,14 @@ import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
* <li>{@link PrimaryKeyColumn#name()}, then, if ordered the same,</li>
|
||||
* <li>{@link PrimaryKeyColumn#ordering()}.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* @author Matthew T. Adams
|
||||
* @author John Blum
|
||||
* @author Mark Paluch
|
||||
* @see PrimaryKeyType#compare(PrimaryKeyType, PrimaryKeyType)
|
||||
* @see Ordering#compare(Ordering, Ordering)
|
||||
* @see java.util.Comparator
|
||||
* @see org.springframework.data.cassandra.mapping.PrimaryKeyColumn
|
||||
* @see org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn
|
||||
*/
|
||||
public enum CassandraPrimaryKeyColumnAnnotationComparator implements Comparator<PrimaryKeyColumn> {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -107,7 +107,7 @@ public class CassandraSimpleTypeHolder extends SimpleTypeHolder {
|
||||
classToDataType.put(javaType, dataType);
|
||||
|
||||
Optional.ofNullable(primitiveWrappers.get(javaType))
|
||||
.ifPresent(primitiveType -> classToDataType.put(primitiveType, dataType));
|
||||
.ifPresent(primitiveType -> classToDataType.put(primitiveType, dataType));
|
||||
});
|
||||
|
||||
// override String to text datatype as String is used multiple times
|
||||
@@ -129,11 +129,8 @@ public class CassandraSimpleTypeHolder extends SimpleTypeHolder {
|
||||
*/
|
||||
private static Set<Class<?>> getCassandraPrimitiveTypes(CodecRegistry codecRegistry) {
|
||||
|
||||
return DataType.allPrimitiveTypes().stream()
|
||||
.map(codecRegistry::codecFor)
|
||||
.map(TypeCodec::getJavaType)
|
||||
.map(TypeToken::getRawType)
|
||||
.collect(Collectors.toSet());
|
||||
return DataType.allPrimitiveTypes().stream().map(codecRegistry::codecFor).map(TypeCodec::getJavaType)
|
||||
.map(TypeToken::getRawType).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +168,7 @@ public class CassandraSimpleTypeHolder extends SimpleTypeHolder {
|
||||
|
||||
if (dataType == null) {
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
String.format("Did not find appropriate primitive DataType for type '%s'", typeInfo.getType()));
|
||||
String.format("Did not find appropriate primitive DataType for type '%s'", typeInfo.getType()));
|
||||
}
|
||||
|
||||
array[i] = dataType.getName();
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013-2016 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -23,7 +23,7 @@ import com.datastax.driver.core.DataType;
|
||||
|
||||
/**
|
||||
* Specifies the Cassandra type of the annotated property or parameter if used in query methods.
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
* @author Mark Paluch
|
||||
@@ -52,7 +52,7 @@ public @interface CassandraType {
|
||||
* If the property maps to a user-defined type then this attribute holds the user type name. For collection-like
|
||||
* properties the user type name applies to the component type. The user type name is only required if the UDT does
|
||||
* not map to a class annotated with {@link UserDefinedType}.
|
||||
*
|
||||
*
|
||||
* @return name of the user type
|
||||
* @since 1.5
|
||||
*/
|
||||
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -28,7 +28,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -22,7 +22,7 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Identifies a secondary index in the table on a single, non-key column.
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
*/
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.annotation.Persistent;
|
||||
* <p/>
|
||||
* If your Cassandra table has multiple primary key columns, then you must define a primary key class, annotate it with
|
||||
* this annotation, and use that class as the {@link PrimaryKey} of your entity class!
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
*/
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -13,16 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.cassandra.core.Ordering;
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import org.springframework.data.cql.core.Ordering;
|
||||
import org.springframework.data.cql.core.PrimaryKeyType;
|
||||
|
||||
/**
|
||||
* Identifies the annotated field of a composite primary key class as a primary key field that is either a partition or
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.driver.core.Cluster;
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
@@ -25,7 +25,7 @@ import org.springframework.data.annotation.Persistent;
|
||||
|
||||
/**
|
||||
* Identifies a domain object to be persisted to Cassandra as a table.
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
*/
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
@@ -13,15 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
|
||||
import com.datastax.driver.core.UserType;
|
||||
|
||||
/**
|
||||
* Strategy interface to resolve {@link UserType} by its name.
|
||||
*
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @since 1.5
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ public interface UserTypeResolver {
|
||||
|
||||
/**
|
||||
* Resolve a {@link UserType} by its name.
|
||||
*
|
||||
*
|
||||
* @param typeName must not be {@literal null}.
|
||||
* @return the type or {@literal null}, if not found.
|
||||
*/
|
||||
@@ -13,11 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import static org.springframework.cassandra.core.cql.CqlIdentifier.*;
|
||||
import static org.springframework.data.cql.core.CqlIdentifier.*;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Infrastructure for the Apache Cassandra row-to-object mapping subsystem.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
package org.springframework.data.cassandra.core.mapping;
|
||||
@@ -17,7 +17,7 @@ package org.springframework.data.cassandra.core.query;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.query;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -25,9 +27,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.query;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.nullSafeHashCode;
|
||||
import static org.springframework.util.ObjectUtils.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -98,15 +98,8 @@ public interface CriteriaDefinition {
|
||||
*/
|
||||
enum Operators implements Operator {
|
||||
|
||||
EQ("="),
|
||||
GT(">"),
|
||||
GTE(">="),
|
||||
LT("<"),
|
||||
LTE("<="),
|
||||
CONTAINS("CONTAINS"),
|
||||
CONTAINS_KEY("CONTAINS KEY"),
|
||||
IN("IN"),
|
||||
LIKE("LIKE");
|
||||
EQ("="), GT(">"), GTE(">="), LT("<"), LTE("<="), CONTAINS("CONTAINS"), CONTAINS_KEY("CONTAINS KEY"), IN("IN"), LIKE(
|
||||
"LIKE");
|
||||
|
||||
private final String operator;
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.query;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.nullSafeEquals;
|
||||
import static org.springframework.util.ObjectUtils.nullSafeHashCode;
|
||||
import static org.springframework.util.ObjectUtils.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -26,7 +25,7 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.springframework.cassandra.core.QueryOptions;
|
||||
import org.springframework.data.cql.core.QueryOptions;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -129,8 +128,8 @@ public class Query implements Filter {
|
||||
criteriaDefinitions.add(criteriaDefinition);
|
||||
}
|
||||
|
||||
return new Query(criteriaDefinitions, this.columns, this.sort, this.pagingState,
|
||||
this.queryOptions, this.limit, this.allowFiltering);
|
||||
return new Query(criteriaDefinitions, this.columns, this.sort, this.pagingState, this.queryOptions, this.limit,
|
||||
this.allowFiltering);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -180,8 +179,8 @@ public class Query implements Filter {
|
||||
}
|
||||
}
|
||||
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort.and(sort), this.pagingState,
|
||||
this.queryOptions, this.limit, this.allowFiltering);
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort.and(sort), this.pagingState, this.queryOptions,
|
||||
this.limit, this.allowFiltering);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,8 +200,8 @@ public class Query implements Filter {
|
||||
|
||||
Assert.notNull(pagingState, "PagingState must not be null");
|
||||
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, Optional.of(pagingState),
|
||||
this.queryOptions, this.limit, this.allowFiltering);
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, Optional.of(pagingState), this.queryOptions,
|
||||
this.limit, this.allowFiltering);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,8 +221,8 @@ public class Query implements Filter {
|
||||
|
||||
Assert.notNull(queryOptions, "QueryOptions must not be null");
|
||||
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, this.pagingState,
|
||||
Optional.of(queryOptions), this.limit, this.allowFiltering);
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, this.pagingState, Optional.of(queryOptions),
|
||||
this.limit, this.allowFiltering);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,8 +239,8 @@ public class Query implements Filter {
|
||||
* @return a new {@link Query} object containing the former settings with {@code limit} applied.
|
||||
*/
|
||||
public Query limit(long limit) {
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, this.pagingState,
|
||||
this.queryOptions, Optional.of(limit), this.allowFiltering);
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, this.pagingState, this.queryOptions,
|
||||
Optional.of(limit), this.allowFiltering);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,8 +256,8 @@ public class Query implements Filter {
|
||||
* @return a new {@link Query} object containing the former settings with {@code allowFiltering} applied.
|
||||
*/
|
||||
public Query withAllowFiltering() {
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, this.pagingState,
|
||||
this.queryOptions, this.limit, true);
|
||||
return new Query(this.criteriaDefinitions, this.columns, this.sort, this.pagingState, this.queryOptions, this.limit,
|
||||
true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,9 +123,9 @@ abstract class SerializationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link String} representation from the given {@link Iterable} prepending the {@code prefix},
|
||||
* applying the given {@link Converter} to each element before adding it to the result {@link String},
|
||||
* concatenating each element with {@literal ,} and applying the {@code postfix}.
|
||||
* Creates a {@link String} representation from the given {@link Iterable} prepending the {@code prefix}, applying the
|
||||
* given {@link Converter} to each element before adding it to the result {@link String}, concatenating each element
|
||||
* with {@literal ,} and applying the {@code postfix}.
|
||||
*/
|
||||
private static <T> String iterableToDelimitedString(Iterable<T> source, String prefix, String postfix,
|
||||
Converter<? super T, Object> transformer) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.core.query;
|
||||
|
||||
import static org.springframework.data.cassandra.core.query.SerializationUtils.serializeToCqlSafely;
|
||||
import static org.springframework.data.cassandra.core.query.SerializationUtils.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -86,8 +86,8 @@ public class Update {
|
||||
*
|
||||
* @param columnName must not be {@literal null}.
|
||||
* @param value value to set on column with name.
|
||||
* @return a new {@link Update} object containing the merge result of the existing assignments
|
||||
* and the current assignment.
|
||||
* @return a new {@link Update} object containing the merge result of the existing assignments and the current
|
||||
* assignment.
|
||||
*/
|
||||
public Update set(String columnName, Object value) {
|
||||
return add(new SetOp(ColumnName.from(columnName), value));
|
||||
@@ -509,8 +509,8 @@ public class Update {
|
||||
public String toString() {
|
||||
|
||||
return Mode.PREPEND.equals(getMode())
|
||||
? String.format("%s = %s + %s", getColumnName(), serializeToCqlSafely(value), getColumnName())
|
||||
: String.format("%s = %s + %s", getColumnName(), getColumnName(), serializeToCqlSafely(value));
|
||||
? String.format("%s = %s + %s", getColumnName(), serializeToCqlSafely(value), getColumnName())
|
||||
: String.format("%s = %s + %s", getColumnName(), getColumnName(), serializeToCqlSafely(value));
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Spring Data's CQL abstraction.
|
||||
* Spring Data's Cassandra abstraction.
|
||||
*/
|
||||
package org.springframework.data.cassandra;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.springframework.data.cassandra.repository;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn;
|
||||
import org.springframework.data.cassandra.repository.support.BasicMapId;
|
||||
import org.springframework.data.repository.NoRepositoryBean;
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ package org.springframework.data.cassandra.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
import org.springframework.data.cassandra.core.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.core.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn;
|
||||
import org.springframework.data.cassandra.core.mapping.Table;
|
||||
import org.springframework.data.cassandra.repository.support.BasicMapId;
|
||||
import org.springframework.data.domain.Persistable;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.data.cassandra.config.DefaultBeanNames;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
import org.springframework.data.cassandra.core.mapping.Table;
|
||||
import org.springframework.data.cassandra.repository.CassandraRepository;
|
||||
import org.springframework.data.cassandra.repository.support.CassandraRepositoryFactoryBean;
|
||||
import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.repository.query;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -24,12 +26,12 @@ import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
import org.springframework.data.cassandra.core.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.repository.query.CassandraQueryExecution.CollectionExecution;
|
||||
import org.springframework.data.cassandra.repository.query.CassandraQueryExecution.ResultProcessingConverter;
|
||||
import org.springframework.data.cassandra.repository.query.CassandraQueryExecution.ResultProcessingExecution;
|
||||
@@ -45,9 +47,6 @@ import org.springframework.data.repository.query.ReturnedType;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.datastax.driver.core.ResultSet;
|
||||
import com.datastax.driver.core.Row;
|
||||
import com.datastax.driver.core.Statement;
|
||||
@@ -92,7 +91,7 @@ public abstract class AbstractCassandraQuery implements RepositoryQuery {
|
||||
@Deprecated
|
||||
public void setConversionService(ConversionService conversionService) {
|
||||
throw new UnsupportedOperationException("setConversionService(ConversionService) is not supported anymore. "
|
||||
+ "Please use CassandraMappingContext instead");
|
||||
+ "Please use CassandraMappingContext instead");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,13 +130,12 @@ public abstract class AbstractCassandraQuery implements RepositoryQuery {
|
||||
CassandraParameterAccessor parameterAccessor = new ConvertingParameterAccessor(getOperations().getConverter(),
|
||||
new CassandraParametersParameterAccessor(getQueryMethod(), parameters));
|
||||
|
||||
ResultProcessor resultProcessor =
|
||||
getQueryMethod().getResultProcessor().withDynamicProjection(parameterAccessor);
|
||||
ResultProcessor resultProcessor = getQueryMethod().getResultProcessor().withDynamicProjection(parameterAccessor);
|
||||
|
||||
Statement statement = createQuery(parameterAccessor);
|
||||
|
||||
CassandraQueryExecution queryExecution = getExecution(new ResultProcessingConverter(
|
||||
resultProcessor, getOperations().getConverter().getMappingContext(), getEntityInstantiators()));
|
||||
CassandraQueryExecution queryExecution = getExecution(new ResultProcessingConverter(resultProcessor,
|
||||
getOperations().getConverter().getMappingContext(), getEntityInstantiators()));
|
||||
|
||||
CassandraReturnedType returnedType = new CassandraReturnedType(resultProcessor.getReturnedType(),
|
||||
getOperations().getConverter().getCustomConversions());
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.cassandra.repository.query;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
|
||||
@@ -31,8 +32,6 @@ import org.springframework.data.repository.query.RepositoryQuery;
|
||||
import org.springframework.data.repository.query.ResultProcessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import com.datastax.driver.core.Statement;
|
||||
|
||||
/**
|
||||
@@ -107,17 +106,16 @@ public abstract class AbstractReactiveCassandraQuery implements RepositoryQuery
|
||||
|
||||
private Object execute(CassandraParameterAccessor parameterAccessor) {
|
||||
|
||||
CassandraParameterAccessor convertingParameterAccessor =
|
||||
new ConvertingParameterAccessor(getReactiveCassandraOperations().getConverter(), parameterAccessor);
|
||||
CassandraParameterAccessor convertingParameterAccessor = new ConvertingParameterAccessor(
|
||||
getReactiveCassandraOperations().getConverter(), parameterAccessor);
|
||||
|
||||
Statement statement = createQuery(convertingParameterAccessor);
|
||||
|
||||
ResultProcessor resultProcessor =
|
||||
getQueryMethod().getResultProcessor().withDynamicProjection(convertingParameterAccessor);
|
||||
ResultProcessor resultProcessor = getQueryMethod().getResultProcessor()
|
||||
.withDynamicProjection(convertingParameterAccessor);
|
||||
|
||||
ReactiveCassandraQueryExecution queryExecution = getExecution(new ResultProcessingConverter(
|
||||
resultProcessor, getReactiveCassandraOperations().getConverter().getMappingContext(),
|
||||
getEntityInstantiators()));
|
||||
ReactiveCassandraQueryExecution queryExecution = getExecution(new ResultProcessingConverter(resultProcessor,
|
||||
getReactiveCassandraOperations().getConverter().getMappingContext(), getEntityInstantiators()));
|
||||
|
||||
CassandraReturnedType returnedType = new CassandraReturnedType(resultProcessor.getReturnedType(),
|
||||
getReactiveCassandraOperations().getConverter().getCustomConversions());
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2013-2014 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.repository.query;
|
||||
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cql.core.CqlIdentifier;
|
||||
import org.springframework.data.repository.core.EntityMetadata;
|
||||
|
||||
/**
|
||||
* Extension of {@link EntityMetadata} to additionally expose the table name an entity shall be persisted to.
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
* @param <T>
|
||||
@@ -29,7 +29,7 @@ public interface CassandraEntityMetadata<T> extends EntityMetadata<T> {
|
||||
|
||||
/**
|
||||
* Returns the name of the table the entity shall be persisted to.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
CqlIdentifier getTableName();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.repository.query;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraType;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraType;
|
||||
import org.springframework.data.repository.query.ParameterAccessor;
|
||||
|
||||
import com.datastax.driver.core.DataType;
|
||||
@@ -31,14 +31,14 @@ public interface CassandraParameterAccessor extends ParameterAccessor {
|
||||
|
||||
/**
|
||||
* Returns the Cassandra {@link DataType} for the declared parameter if the type is a
|
||||
* {@link org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder simple type}. Parameter types may be
|
||||
* specified using {@link org.springframework.data.cassandra.mapping.CassandraType}.
|
||||
* {@link org.springframework.data.cassandra.core.mapping.CassandraSimpleTypeHolder simple type}. Parameter types may be
|
||||
* specified using {@link org.springframework.data.cassandra.core.mapping.CassandraType}.
|
||||
*
|
||||
* @param index the parameter index
|
||||
* @return the Cassandra {@link DataType} or {@literal null} if the parameter type cannot be determined from
|
||||
* {@link org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder}
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraType
|
||||
* {@link org.springframework.data.cassandra.core.mapping.CassandraSimpleTypeHolder}
|
||||
* @see org.springframework.data.cassandra.core.mapping.CassandraSimpleTypeHolder
|
||||
* @see org.springframework.data.cassandra.core.mapping.CassandraType
|
||||
*/
|
||||
DataType getDataType(int index);
|
||||
|
||||
@@ -47,8 +47,8 @@ public interface CassandraParameterAccessor extends ParameterAccessor {
|
||||
*
|
||||
* @param index the parameter index
|
||||
* @return the Cassandra {@link CassandraType} or {@literal null}.
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraType
|
||||
* @see org.springframework.data.cassandra.core.mapping.CassandraSimpleTypeHolder
|
||||
* @see org.springframework.data.cassandra.core.mapping.CassandraType
|
||||
*/
|
||||
CassandraType findCassandraType(int index);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.data.cassandra.mapping.CassandraType;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraType;
|
||||
import org.springframework.data.cassandra.repository.query.CassandraParameters.CassandraParameter;
|
||||
import org.springframework.data.repository.query.Parameter;
|
||||
import org.springframework.data.repository.query.Parameters;
|
||||
@@ -102,7 +102,7 @@ public class CassandraParameters extends Parameters<CassandraParameters, Cassand
|
||||
|
||||
/**
|
||||
* Returns the {@link CassandraType} for the declared parameter if specified using
|
||||
* {@link org.springframework.data.cassandra.mapping.CassandraType}.
|
||||
* {@link org.springframework.data.cassandra.core.mapping.CassandraType}.
|
||||
*
|
||||
* @return the {@link CassandraType} or {@literal null}.
|
||||
*/
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.data.cassandra.repository.query;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder;
|
||||
import org.springframework.data.cassandra.mapping.CassandraType;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraSimpleTypeHolder;
|
||||
import org.springframework.data.cassandra.core.mapping.CassandraType;
|
||||
import org.springframework.data.repository.query.ParameterAccessor;
|
||||
import org.springframework.data.repository.query.ParametersParameterAccessor;
|
||||
|
||||
|
||||
@@ -20,12 +20,14 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
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.Query;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.repository.query.ConvertingParameterAccessor.PotentiallyConvertingIterator;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
@@ -36,9 +38,6 @@ import org.springframework.data.repository.query.parser.Part.Type;
|
||||
import org.springframework.data.repository.query.parser.PartTree;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.datastax.driver.core.querybuilder.Clause;
|
||||
|
||||
/**
|
||||
@@ -75,8 +74,8 @@ class CassandraQueryCreator extends AbstractQueryCreator<Query, CriteriaDefiniti
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to
|
||||
* store (map) object to Cassandra tables.
|
||||
* Returns the {@link CassandraMappingContext} used by this template to access mapping meta-data used to store (map)
|
||||
* object to Cassandra tables.
|
||||
*
|
||||
* @return the {@link CassandraMappingContext} used by this template.
|
||||
* @see org.springframework.data.cassandra.mapping.CassandraMappingContext
|
||||
@@ -100,8 +99,8 @@ class CassandraQueryCreator extends AbstractQueryCreator<Query, CriteriaDefiniti
|
||||
@Override
|
||||
protected CriteriaDefinition create(Part part, Iterator<Object> iterator) {
|
||||
|
||||
PersistentPropertyPath<CassandraPersistentProperty> path =
|
||||
getMappingContext().getPersistentPropertyPath(part.getProperty());
|
||||
PersistentPropertyPath<CassandraPersistentProperty> path = getMappingContext()
|
||||
.getPersistentPropertyPath(part.getProperty());
|
||||
|
||||
CassandraPersistentProperty property = path.getLeafProperty();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user