You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by il...@apache.org on 2020/06/30 18:04:30 UTC
[ignite] 02/02: Stylistic fixes.
This is an automated email from the ASF dual-hosted git repository.
ilyak pushed a commit to branch ignite-13005
in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 0e36155a372190a63d27e0c7a59a6c3831d2ac4f
Author: Ilya Kasnacheev <il...@gmail.com>
AuthorDate: Tue Jun 30 21:03:40 2020 +0300
Stylistic fixes.
---
.../springdata20/repository/IgniteRepository.java | 4 +-
.../repository/config/DynamicQueryConfig.java | 75 ++-------
.../config/IgniteRepositoriesRegistar.java | 8 +-
.../IgniteRepositoryConfigurationExtension.java | 16 +-
.../springdata20/repository/config/Query.java | 10 --
.../repository/query/DeclaredQuery.java | 5 -
.../repository/query/EmptyDeclaredQuery.java | 33 +---
.../query/ExpressionBasedStringQuery.java | 1 -
.../springdata20/repository/query/IgniteQuery.java | 25 +--
.../repository/query/IgniteQueryGenerator.java | 5 +-
.../repository/query/IgniteRepositoryQuery.java | 176 +++++++-------------
.../springdata20/repository/query/QueryUtils.java | 51 +-----
.../springdata20/repository/query/StringQuery.java | 171 +++++++++-----------
.../repository/query/spel/SpelEvaluator.java | 19 +--
.../repository/query/spel/SpelQueryContext.java | 52 ++----
.../repository/support/ConditionFalse.java | 4 +-
.../support/IgniteRepositoryFactory.java | 46 ++----
.../support/IgniteRepositoryFactoryBean.java | 12 +-
.../repository/support/IgniteRepositoryImpl.java | 101 +++---------
.../IgniteSpringDataCrudSelfExpressionTest.java | 47 ++----
.../springdata/IgniteSpringDataCrudSelfTest.java | 52 +++---
.../IgniteSpringDataQueriesSelfTest.java | 95 ++++-------
.../springdata/misc/ApplicationConfiguration.java | 9 +-
.../ignite/springdata/misc/FullNameProjection.java | 1 -
.../ignite/springdata/misc/PersonProjection.java | 2 +-
.../ignite/springdata/misc/PersonRepository.java | 2 +-
.../misc/SampleEvaluationContextExtension.java | 10 +-
.../springdata22/repository/IgniteRepository.java | 4 +-
.../repository/config/DynamicQueryConfig.java | 75 ++-------
.../config/IgniteRepositoriesRegistar.java | 8 +-
.../IgniteRepositoryConfigurationExtension.java | 16 +-
.../springdata22/repository/config/Query.java | 11 --
.../repository/query/DeclaredQuery.java | 5 -
.../repository/query/EmptyDeclaredQuery.java | 33 +---
.../query/ExpressionBasedStringQuery.java | 1 -
.../springdata22/repository/query/IgniteQuery.java | 25 +--
.../repository/query/IgniteQueryGenerator.java | 5 +-
.../repository/query/IgniteRepositoryQuery.java | 177 +++++++--------------
.../springdata22/repository/query/QueryUtils.java | 51 +-----
.../springdata22/repository/query/StringQuery.java | 172 +++++++++-----------
.../repository/support/ConditionFalse.java | 4 +-
.../support/IgniteRepositoryFactory.java | 46 ++----
.../support/IgniteRepositoryFactoryBean.java | 12 +-
.../repository/support/IgniteRepositoryImpl.java | 101 +++---------
.../IgniteSpringDataCrudSelfExpressionTest.java | 47 ++----
.../springdata/IgniteSpringDataCrudSelfTest.java | 52 +++---
.../IgniteSpringDataQueriesSelfTest.java | 95 ++++-------
.../springdata/misc/ApplicationConfiguration.java | 9 +-
.../ignite/springdata/misc/FullNameProjection.java | 1 -
.../ignite/springdata/misc/PersonProjection.java | 2 +-
.../ignite/springdata/misc/PersonRepository.java | 2 +-
.../misc/SampleEvaluationContextExtension.java | 13 +-
52 files changed, 594 insertions(+), 1405 deletions(-)
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/IgniteRepository.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/IgniteRepository.java
index d311d72..7dee951 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/IgniteRepository.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/IgniteRepository.java
@@ -66,7 +66,7 @@ public interface IgniteRepository<V, K extends Serializable> extends CrudReposit
* It's suggested to use this method instead of default {@link CrudRepository#save(Object)} that generates IDs
* (keys) that are not unique cluster wide.
*
- * @param <S> type of entities.
+ * @param <S> Type of entities.
* @param entities Map of key-entities pairs to save.
* @return Saved entities.
*/
@@ -92,7 +92,7 @@ public interface IgniteRepository<V, K extends Serializable> extends CrudReposit
* It's suggested to use this method instead of default {@link CrudRepository#save(Object)} that generates IDs
* (keys) that are not unique cluster wide.
*
- * @param <S> type of entities.
+ * @param <S> Type of entities.
* @param entities Map of key-entities pairs to save.
* @param expiryPlc ExpiryPolicy to apply, if not null.
* @return Saved entities.
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/DynamicQueryConfig.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/DynamicQueryConfig.java
index 82bc02c..ed422a9 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/DynamicQueryConfig.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/DynamicQueryConfig.java
@@ -31,64 +31,37 @@ package org.apache.ignite.springdata20.repository.config;
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public class DynamicQueryConfig {
- /**
- * Value.
- */
+ /** */
private String value = "";
- /**
- * Text query.
- */
+ /** */
private boolean textQuery;
- /**
- * Force fields query.
- */
+ /** */
private boolean forceFieldsQry;
- /**
- * Collocated.
- */
+ /** */
private boolean collocated;
- /**
- * Timeout.
- */
+ /** */
private int timeout;
- /**
- * Enforce join order.
- */
+ /** */
private boolean enforceJoinOrder;
- /**
- * Distributed joins.
- */
+ /** */
private boolean distributedJoins;
- /**
- * Replicated only.
- */
- private boolean replicatedOnly;
-
- /**
- * Lazy.
- */
+ /** */
private boolean lazy;
- /**
- * Local.
- */
+ /** */
private boolean local;
- /**
- * Parts.
- */
+ /** */
private int[] parts;
- /**
- * Limit.
- */
+ /** */
private int limit;
/**
@@ -105,7 +78,6 @@ public class DynamicQueryConfig {
config.timeout = queryConfiguration.timeout();
config.enforceJoinOrder = queryConfiguration.enforceJoinOrder();
config.distributedJoins = queryConfiguration.distributedJoins();
- config.replicatedOnly = queryConfiguration.replicatedOnly();
config.lazy = queryConfiguration.lazy();
config.parts = queryConfiguration.parts();
config.local = queryConfiguration.local();
@@ -201,19 +173,6 @@ public class DynamicQueryConfig {
}
/**
- * Specify if the query contains only replicated tables. This is a hint for potentially more effective execution.
- * <p>
- * Only applicable to SqlFieldsQuery and SqlQuery
- *
- * @return the boolean
- * @deprecated No longer used as of Apache Ignite 2.8.
- */
- @Deprecated
- public boolean replicatedOnly() {
- return replicatedOnly;
- }
-
- /**
* Sets lazy query execution flag.
* <p>
* By default Ignite attempts to fetch the whole query result set to memory and send it to the client. For small and
@@ -344,17 +303,6 @@ public class DynamicQueryConfig {
}
/**
- * Sets replicated only.
- *
- * @param replicatedOnly the replicated only
- * @return this for chaining
- */
- public DynamicQueryConfig setReplicatedOnly(boolean replicatedOnly) {
- this.replicatedOnly = replicatedOnly;
- return this;
- }
-
- /**
* Sets lazy.
*
* @param lazy the lazy
@@ -397,5 +345,4 @@ public class DynamicQueryConfig {
this.limit = limit;
return this;
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoriesRegistar.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoriesRegistar.java
index 546eb2f..83ff7ff 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoriesRegistar.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoriesRegistar.java
@@ -24,16 +24,12 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* Apache Ignite specific implementation of {@link RepositoryBeanDefinitionRegistrarSupport}.
*/
public class IgniteRepositoriesRegistar extends RepositoryBeanDefinitionRegistrarSupport {
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected Class<? extends Annotation> getAnnotation() {
return EnableIgniteRepositories.class;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected RepositoryConfigurationExtension getExtension() {
return new IgniteRepositoryConfigurationExtension();
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoryConfigurationExtension.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoryConfigurationExtension.java
index 9cd36ec..354e35b 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoryConfigurationExtension.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/IgniteRepositoryConfigurationExtension.java
@@ -27,30 +27,22 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* Apache Ignite specific implementation of {@link RepositoryConfigurationExtension}.
*/
public class IgniteRepositoryConfigurationExtension extends RepositoryConfigurationExtensionSupport {
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getModuleName() {
return "Apache Ignite";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected String getModulePrefix() {
return "ignite";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getRepositoryFactoryBeanClassName() {
return IgniteRepositoryFactoryBean.class.getName();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected Collection<Class<?>> getIdentifyingTypes() {
return Collections.singleton(IgniteRepository.class);
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/Query.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/Query.java
index 394ed43..7b44d19 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/Query.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/config/Query.java
@@ -89,16 +89,6 @@ public @interface Query {
boolean distributedJoins() default false;
/**
- * Specify if the query contains only replicated tables. This is a hint for potentially more effective execution.
- * <p>
- * Only applicable to SqlFieldsQuery and SqlQuery
- *
- * @deprecated No longer used as of Apache Ignite 2.8.
- */
- @Deprecated
- boolean replicatedOnly() default false;
-
- /**
* Sets lazy query execution flag.
* <p>
* By default Ignite attempts to fetch the whole query result set to memory and send it to the client. For small and
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/DeclaredQuery.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/DeclaredQuery.java
index 9edf321..42450ba 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/DeclaredQuery.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/DeclaredQuery.java
@@ -23,7 +23,6 @@ import org.springframework.util.StringUtils;
* A wrapper for a String representation of a query offering information about the query.
*
* @author Jens Schauder
- * @since 2.0.3
*/
interface DeclaredQuery {
/**
@@ -56,8 +55,6 @@ interface DeclaredQuery {
/**
* Returns whether the query is using a constructor expression.
- *
- * @since 1.10
*/
public boolean hasConstructorExpression();
@@ -84,7 +81,6 @@ interface DeclaredQuery {
/**
* @return whether paging is implemented in the query itself, e.g. using SpEL expressions.
- * @since 2.0.6
*/
public default boolean usesPaging() {
return false;
@@ -95,7 +91,6 @@ interface DeclaredQuery {
* name.
*
* @return Whether the query uses JDBC style parameters.
- * @since 2.0.6
*/
public boolean usesJdbcStyleParameters();
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/EmptyDeclaredQuery.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/EmptyDeclaredQuery.java
index 243c36e..85eeaf6 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/EmptyDeclaredQuery.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/EmptyDeclaredQuery.java
@@ -24,7 +24,6 @@ import org.springframework.util.Assert;
* NULL-Object pattern implementation for {@link DeclaredQuery}.
*
* @author Jens Schauder
- * @since 2.0.3
*/
class EmptyDeclaredQuery implements DeclaredQuery {
/**
@@ -32,59 +31,43 @@ class EmptyDeclaredQuery implements DeclaredQuery {
*/
static final DeclaredQuery EMPTY_QUERY = new EmptyDeclaredQuery();
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean hasNamedParameter() {
return false;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getQueryString() {
return "";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getAlias() {
return null;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean hasConstructorExpression() {
return false;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean isDefaultProjection() {
return false;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public List<StringQuery.ParameterBinding> getParameterBindings() {
return Collections.emptyList();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public DeclaredQuery deriveCountQuery(@Nullable String cntQry, @Nullable String cntQryProjection) {
Assert.hasText(cntQry, "CountQuery must not be empty!");
return DeclaredQuery.of(cntQry);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean usesJdbcStyleParameters() {
return false;
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/ExpressionBasedStringQuery.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/ExpressionBasedStringQuery.java
index 3791985..b7559a5 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/ExpressionBasedStringQuery.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/ExpressionBasedStringQuery.java
@@ -150,5 +150,4 @@ class ExpressionBasedStringQuery extends StringQuery {
private static boolean containsExpression(String qry) {
return qry.contains(ENTITY_NAME_VARIABLE_EXPRESSION);
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQuery.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQuery.java
index 7e75bc2..44215a0 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQuery.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQuery.java
@@ -17,7 +17,7 @@
package org.apache.ignite.springdata20.repository.query;
-import java.util.StringJoiner;
+import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Ignite query helper class. For internal use only.
@@ -26,24 +26,15 @@ import java.util.StringJoiner;
* @author Manuel Núñez (manuel.nunez@hawkore.com)
*/
public class IgniteQuery {
-
- /**
- *
- */
+ /** */
enum Option {
- /**
- * Query will be used with Sort object.
- */
+ /** Query will be used with Sort object. */
SORTING,
- /**
- * Query will be used with Pageable object.
- */
+ /** Query will be used with Pageable object. */
PAGINATION,
- /**
- * No advanced option.
- */
+ /** No advanced option. */
NONE
}
@@ -136,10 +127,8 @@ public class IgniteQuery {
return option;
}
+ /** */
@Override public String toString() {
- return new StringJoiner(", ", IgniteQuery.class.getSimpleName() + "[", "]").add("qrySql='" + qrySql + "'")
- .add("isFieldQuery=" + isFieldQuery).add("isTextQuery=" + isTextQuery)
- .add("isAutogenerated=" + isAutogenerated).add("option=" + option).toString();
+ return S.toString(IgniteQuery.class, this);
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQueryGenerator.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQueryGenerator.java
index f8eb64c..a5b13b5 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQueryGenerator.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteQueryGenerator.java
@@ -29,8 +29,9 @@ import org.springframework.data.repository.query.parser.PartTree;
* Ignite query generator for Spring Data framework.
*/
public class IgniteQueryGenerator {
-
+ /** */
private IgniteQueryGenerator() {
+ // No-op.
}
/**
@@ -38,7 +39,6 @@ public class IgniteQueryGenerator {
* @param metadata Metadata.
* @return Generated ignite query.
*/
- @NotNull
public static IgniteQuery generateSql(Method mtd, RepositoryMetadata metadata) {
PartTree parts = new PartTree(mtd.getName(), metadata.getDomainType());
@@ -253,5 +253,4 @@ public class IgniteQueryGenerator {
sql.append(")");
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteRepositoryQuery.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteRepositoryQuery.java
index 06ed98f..c01acf0 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteRepositoryQuery.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/IgniteRepositoryQuery.java
@@ -155,166 +155,105 @@ import static org.apache.ignite.springdata20.repository.support.IgniteRepository
* </pre>
* </li>
* </ol>
- * <p>
- * Visit <a href="https://docs.hawkore.com/private/apache-ignite-advanced-indexing">Apache Ignite advanced Indexing
- * Documentation site</a> for more info about Advanced Lucene Index and Lucene Query Builder.
*
* @author Apache Ignite Team
* @author Manuel Núñez (manuel.nunez@hawkore.com)
*/
@SuppressWarnings("unchecked")
public class IgniteRepositoryQuery implements RepositoryQuery {
-
+ /** */
private static final TreeMap<String, Class<?>> binaryFieldClass = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
/**
* Defines the way how to process query result
*/
private enum ReturnStrategy {
- /**
- * Need to return only one value.
- */
+ /** Need to return only one value. */
ONE_VALUE,
- /**
- * Need to return one cache entry
- */
+ /** Need to return one cache entry */
CACHE_ENTRY,
- /**
- * Need to return list of cache entries
- */
+ /** Need to return list of cache entries */
LIST_OF_CACHE_ENTRIES,
- /**
- * Need to return list of values
- */
+ /** Need to return list of values */
LIST_OF_VALUES,
- /**
- * Need to return list of lists
- */
+ /** Need to return list of lists */
LIST_OF_LISTS,
- /**
- * Need to return slice
- */
+ /** Need to return slice */
SLICE_OF_VALUES,
- /**
- * Slice of cache entries.
- */
+ /** Slice of cache entries */
SLICE_OF_CACHE_ENTRIES,
- /**
- * Slice of lists.
- */
+ /** Slice of lists */
SLICE_OF_LISTS,
- /**
- * Need to return Page of values
- */
+ /** Need to return Page of values */
PAGE_OF_VALUES,
- /**
- * Need to return stream of values
- */
+ /** Need to return stream of values */
STREAM_OF_VALUES,
}
- /**
- * Type.
- */
+ /** */
private final Class<?> type;
- /**
- * Sql.
- */
+ /** */
private final IgniteQuery staticQuery;
- /**
- * Cache.
- */
+ /** */
private final IgniteCache cache;
- /**
- * Ignite instance
- */
+ /** */
private final Ignite ignite;
- /**
- * required by qryStr field query type for binary manipulation
- */
+ /** Required by qryStr field query type for binary manipulation */
private IgniteBinaryImpl igniteBinary;
- /**
- * Ignite bin type.
- */
+ /** */
private BinaryType igniteBinType;
- /**
- * Method.
- */
+ /** */
private final Method mtd;
- /**
- * Metadata.
- */
+ /** */
private final RepositoryMetadata metadata;
- /**
- * Factory.
- */
+ /** */
private final ProjectionFactory factory;
- /**
- * Return strategy.
- */
+ /** */
private final ReturnStrategy staticReturnStgy;
- /**
- * Detect if returned data from method is projected
- */
+ /** Detect if returned data from method is projected */
private final boolean hasProjection;
- /**
- * Whether projection is dynamic (provided as method parameter)
- */
+ /** Whether projection is dynamic (provided as method parameter) */
private final boolean hasDynamicProjection;
- /**
- * Dynamic projection parameter index.
- */
+ /** Dynamic projection parameter index */
private final int dynamicProjectionIndex;
- /**
- * Dynamic query configuration.
- */
+ /** Dynamic query configuration */
private final int dynamicQueryConfigurationIndex;
- /**
- * the return query method
- */
+ /** The return query method */
private final QueryMethod qMethod;
- /**
- * the return domain class of QueryMethod
- */
+ /** The return domain class of QueryMethod */
private final Class<?> returnedDomainClass;
- /**
- * Expression parser.
- */
+ /** */
private final SpelExpressionParser expressionParser;
- /**
- * could provide ExtensionAwareQueryMethodEvaluationContextProvider
- */
+ /** Could provide ExtensionAwareQueryMethodEvaluationContextProvider */
private final EvaluationContextProvider queryMethodEvaluationContextProvider;
- /**
- * Static query configuration.
- */
+ /** Static query configuration. */
private final DynamicQueryConfig staticQueryConfiguration;
/**
@@ -385,7 +324,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
* @return the object
*/
@Override public Object execute(Object[] values) {
-
Object[] parameters = values;
// config via Query annotation (dynamicQuery = false)
@@ -419,9 +357,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return transformQueryCursor(qry, returnStgy, parameters, qryCursor);
}
- /**
- * {@inheritDoc} @return the query method
- */
+ /** {@inheritDoc} */
@Override public QueryMethod getQueryMethod() {
return new QueryMethod(mtd, metadata, factory);
}
@@ -433,28 +369,35 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
int index = -1;
while (it.hasNext()) {
T parameter = it.next();
+
if (DynamicQueryConfig.class.isAssignableFrom(parameter.getType())) {
if (found) {
throw new IllegalStateException("Invalid '" + method.getName() + "' repository method signature. "
+ "Only ONE DynamicQueryConfig parameter is allowed");
}
+
found = true;
index = i;
}
+
i++;
}
return index;
}
+ /** */
private synchronized IgniteBinaryImpl binary() {
if (igniteBinary == null)
igniteBinary = (IgniteBinaryImpl)ignite.binary();
+
return igniteBinary;
}
+ /** */
private synchronized BinaryType binType() {
if (igniteBinType == null)
igniteBinType = binary().type(type);
+
return igniteBinType;
}
@@ -500,7 +443,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
* @return if {@code mtd} return type is assignable from {@code cls}
*/
private boolean hasAssignableGenericReturnTypeFrom(Class<?> cls, Method mtd) {
-
Type genericReturnType = mtd.getGenericReturnType();
if (!(genericReturnType instanceof ParameterizedType))
@@ -529,7 +471,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
}
/**
- * when select fields by query H2 returns Timestamp for types java.util.Date and java.qryStr.Timestamp
+ * When select fields by query H2 returns Timestamp for types java.util.Date and java.qryStr.Timestamp
*
* @see org.apache.ignite.internal.processors.query.h2.H2DatabaseType map.put(Timestamp.class, TIMESTAMP)
* map.put(java.util.Date.class, TIMESTAMP) map.put(java.qryStr.Date.class, DATE)
@@ -537,6 +479,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private static <T> T fixExpectedType(final Object object, final Class<T> expected) {
if (expected != null && object instanceof java.sql.Timestamp && expected.equals(java.util.Date.class))
return (T)new java.util.Date(((java.sql.Timestamp)object).getTime());
+
return (T)object;
}
@@ -546,11 +489,13 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private IgniteQuery getQuery(@Nullable DynamicQueryConfig cfg) {
if (staticQuery != null)
return staticQuery;
+
if (cfg != null && (StringUtils.hasText(cfg.value()) || cfg.textQuery())) {
return new IgniteQuery(cfg.value(),
!cfg.textQuery() && (isFieldQuery(cfg.value()) || cfg.forceFieldsQuery()), cfg.textQuery(),
false, IgniteQueryGenerator.getOptions(mtd));
}
+
throw new IllegalStateException("Unable to obtain a valid query. When passing dynamicQuery = true via org"
+ ".apache.ignite.springdata.repository.config.Query annotation, you must"
+ " provide a non null method parameter of type DynamicQueryConfig with a "
@@ -563,8 +508,10 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private ReturnStrategy getReturnStgy(IgniteQuery qry) {
if (staticReturnStgy != null)
return staticReturnStgy;
+
if (qry != null)
return calcReturnType(mtd, qry.isFieldQuery());
+
throw new IllegalStateException("Unable to obtain a valid return strategy. When passing dynamicQuery = true "
+ "via org.apache.ignite.springdata.repository.config.Query annotation, "
+ "you must provide a non null method parameter of type "
@@ -600,7 +547,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
ReturnStrategy returnStgy,
Object[] prmtrs,
QueryCursor qryCursor) {
-
final Class<?> returnClass;
if (hasProjection) {
@@ -726,7 +672,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private Object[] extractBindableValues(Object[] values,
Parameters<?, ?> queryMethodParams,
List<ParameterBinding> queryBindings) {
-
// no binding params then exit
if (queryBindings.isEmpty())
return values;
@@ -785,7 +730,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
*/
@NotNull
private Query prepareQuery(IgniteQuery qry, DynamicQueryConfig config, ReturnStrategy returnStgy, Object[] values) {
-
Object[] parameters = values;
String queryString = qry.qryStr();
@@ -795,7 +739,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
checkRequiredPageable(returnStgy, values);
if (!qry.isTextQuery()) {
-
if (!qry.isAutogenerated()) {
StringQuery squery = new ExpressionBasedStringQuery(queryString, metadata, expressionParser);
queryString = squery.getQueryString();
@@ -839,7 +782,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
if (config.parts() != null && config.parts().length > 0)
sqlFieldsQry.setPartitions(config.parts());
- sqlFieldsQry.setReplicatedOnly(config.replicatedOnly());
sqlFieldsQry.setTimeout(config.timeout(), TimeUnit.MILLISECONDS);
query = sqlFieldsQry;
@@ -850,16 +792,16 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
sqlQry.setDistributedJoins(config.distributedJoins());
sqlQry.setLocal(config.local());
+
if (config.parts() != null && config.parts().length > 0)
sqlQry.setPartitions(config.parts());
- sqlQry.setReplicatedOnly(config.replicatedOnly());
+
sqlQry.setTimeout(config.timeout(), TimeUnit.MILLISECONDS);
query = sqlQry;
}
}
else {
-
int pageSize = -1;
switch (qry.options()) {
@@ -898,6 +840,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return query;
}
+ /** */
private static Map<String, Object> rowToMap(final List<?> row, final List<GridQueryFieldMetadata> meta) {
// use treemap with case insensitive property name
final TreeMap<String, Object> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
@@ -911,7 +854,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return map;
}
- /*
+ /**
* convert row ( with list of field values) into domain entity
*/
private <V> V rowToEntity(final IgniteBinaryImpl binary,
@@ -952,7 +895,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
final BinaryType binType,
final GridQueryFieldMetadata fieldMeta) {
try {
-
final String fieldId = fieldMeta.schemaName() + "." + fieldMeta.typeName() + "." + fieldMeta.fieldName();
if (binaryFieldClass.containsKey(fieldId))
@@ -1037,7 +979,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
* @param <V> transformed output type
*/
public static class QueryCursorWrapper<T, V> extends AbstractCollection<V> implements QueryCursor<V> {
-
/**
* Delegate query cursor.
*/
@@ -1059,14 +1000,12 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
this.transformer = transformer;
}
- /**
- * {@inheritDoc} @return the iterator
- */
+ /** {@inheritDoc} */
@Override public Iterator<V> iterator() {
-
final Iterator<T> it = delegate.iterator();
return new Iterator<V>() {
+ /** */
@Override public boolean hasNext() {
if (!it.hasNext()) {
U.closeQuiet(delegate);
@@ -1075,6 +1014,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return true;
}
+ /** */
@Override public V next() {
final V r = transformer.apply(it.next());
if (r != null)
@@ -1084,16 +1024,12 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
};
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public void close() {
U.closeQuiet(delegate);
}
- /**
- * {@inheritDoc} @return the all
- */
+ /** {@inheritDoc} */
@Override public List<V> getAll() {
final List<V> data = new ArrayList<>();
delegate.forEach(i -> data.add(transformer.apply(i)));
@@ -1101,13 +1037,9 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return data;
}
- /**
- * {@inheritDoc} @return the int
- */
+ /** {@inheritDoc} */
@Override public int size() {
return 0;
}
-
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/QueryUtils.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/QueryUtils.java
index e31c0d0..2f74e44 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/QueryUtils.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/QueryUtils.java
@@ -118,7 +118,6 @@ public abstract class QueryUtils {
private static final Pattern FUNCTION_PATTERN;
static {
-
StringBuilder builder = new StringBuilder();
builder.append("(?<=from)"); // from as starting delimiter
builder.append("(?:\\s)+"); // at least one space separating
@@ -165,7 +164,7 @@ public abstract class QueryUtils {
* Private constructor to prevent instantiation.
*/
private QueryUtils() {
-
+ // No-op.
}
/**
@@ -179,7 +178,6 @@ public abstract class QueryUtils {
public static String getExistsQueryString(String entityName,
String cntQryPlaceHolder,
Iterable<String> idAttrs) {
-
String whereClause = Streamable.of(idAttrs).stream() //
.map(idAttribute -> String.format(EQUALS_CONDITION_STRING, "x", idAttribute,
idAttribute)) //
@@ -194,10 +192,9 @@ public abstract class QueryUtils {
* @param template must not be {@literal null}.
* @param entityName must not be {@literal null}.
* @return the template with placeholders replaced by the {@literal entityName}. Guaranteed to be not {@literal
- * null}.
+ * null}.
*/
public static String getQueryString(String template, String entityName) {
-
Assert.hasText(entityName, "Entity name must not be null or empty!");
return String.format(template, entityName);
@@ -210,12 +207,10 @@ public abstract class QueryUtils {
* @return a {@literal Set} of aliases used in the query. Guaranteed to be not {@literal null}.
*/
static Set<String> getOuterJoinAliases(String qry) {
-
Set<String> result = new HashSet<>();
Matcher matcher = JOIN_PATTERN.matcher(qry);
while (matcher.find()) {
-
String alias = matcher.group(QUERY_JOIN_ALIAS_GROUP_INDEX);
if (StringUtils.hasText(alias))
result.add(alias);
@@ -231,12 +226,10 @@ public abstract class QueryUtils {
* @return a {@literal Set} containing all found aliases. Guaranteed to be not {@literal null}.
*/
static Set<String> getFunctionAliases(String qry) {
-
Set<String> result = new HashSet<>();
Matcher matcher = FUNCTION_PATTERN.matcher(qry);
while (matcher.find()) {
-
String alias = matcher.group(1);
if (StringUtils.hasText(alias))
@@ -251,12 +244,9 @@ public abstract class QueryUtils {
*
* @param qry must not be {@literal null}.
* @return Might return {@literal null}.
- * @deprecated use {@link DeclaredQuery#getAlias()} instead.
*/
@Nullable
- @Deprecated
- public static String detectAlias(String qry) {
-
+ static String detectAlias(String qry) {
Matcher matcher = ALIAS_MATCH.matcher(qry);
return matcher.find() ? matcher.group(2) : null;
@@ -265,34 +255,17 @@ public abstract class QueryUtils {
/**
* Creates a count projected query from the given original query.
*
- * @param originalQry must not be {@literal null} or empty.
- * @return Guaranteed to be not {@literal null}.
- * @deprecated use {@link DeclaredQuery#deriveCountQuery(String, String)} instead.
- */
- @Deprecated
- public static String createCountQueryFor(String originalQry) {
- return createCountQueryFor(originalQry, null);
- }
-
- /**
- * Creates a count projected query from the given original query.
- *
* @param originalQry must not be {@literal null}.
* @param cntProjection may be {@literal null}.
* @return a query String to be used a count query for pagination. Guaranteed to be not {@literal null}.
- * @since 1.6
- * @deprecated use {@link DeclaredQuery#deriveCountQuery(String, String)} instead.
*/
- @Deprecated
- public static String createCountQueryFor(String originalQry, @Nullable String cntProjection) {
-
+ static String createCountQueryFor(String originalQry, @Nullable String cntProjection) {
Assert.hasText(originalQry, "OriginalQuery must not be null or empty!");
Matcher matcher = COUNT_MATCH.matcher(originalQry);
String countQuery;
if (cntProjection == null) {
-
String variable = matcher.matches() ? matcher.group(VARIABLE_NAME_GROUP_INDEX) : null;
boolean useVariable = variable != null && StringUtils.hasText(variable) && !variable.startsWith("new")
&& !variable.startsWith("count(") && !variable.contains(",");
@@ -307,25 +280,12 @@ public abstract class QueryUtils {
}
/**
- * Returns whether the given query contains named parameters.
- *
- * @param qry can be {@literal null} or empty.
- * @return whether the given query contains named parameters.
- */
- @Deprecated
- static boolean hasNamedParameter(@Nullable String qry) {
- return StringUtils.hasText(qry) && NAMED_PARAMETER.matcher(qry).find();
- }
-
- /**
* Returns whether the given JPQL query contains a constructor expression.
*
* @param qry must not be {@literal null} or empty.
* @return boolean
- * @since 1.10
*/
public static boolean hasConstructorExpression(String qry) {
-
Assert.hasText(qry, "Query must not be null or empty!");
return CONSTRUCTOR_EXPRESSION.matcher(qry).find();
@@ -336,15 +296,12 @@ public abstract class QueryUtils {
*
* @param qry must not be {@literal null} or empty.
* @return projection
- * @since 1.10.2
*/
public static String getProjection(String qry) {
-
Assert.hasText(qry, "Query must not be null or empty!");
Matcher matcher = PROJECTION_CLAUSE.matcher(qry);
String projection = matcher.find() ? matcher.group(1) : "";
return projection.trim();
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/StringQuery.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/StringQuery.java
index ca056c5..c6e2572 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/StringQuery.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/StringQuery.java
@@ -50,18 +50,23 @@ import static org.springframework.util.ObjectUtils.nullSafeHashCode;
* @author Jens Schauder
*/
class StringQuery implements DeclaredQuery {
-
+ /** */
private final String query;
+ /** */
private final List<ParameterBinding> bindings;
+ /** */
@Nullable
private final String alias;
+ /** */
private final boolean hasConstructorExpression;
+ /** */
private final boolean containsPageableInSpel;
+ /** */
private final boolean usesJdbcStyleParameters;
/**
@@ -69,8 +74,7 @@ class StringQuery implements DeclaredQuery {
*
* @param query must not be {@literal null} or empty.
*/
- @SuppressWarnings("deprecation") StringQuery(String query) {
-
+ StringQuery(String query) {
Assert.hasText(query, "Query must not be null or empty!");
bindings = new ArrayList<>();
@@ -93,84 +97,64 @@ class StringQuery implements DeclaredQuery {
return !bindings.isEmpty();
}
+ /** */
String getProjection() {
return QueryUtils.getProjection(query);
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#getParameterBindings()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#getParameterBindings()
+ /** {@inheritDoc} */
@Override public List<ParameterBinding> getParameterBindings() {
return bindings;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#deriveCountQuery(java.lang.String, java.lang
- * .String)
- */
- @SuppressWarnings("deprecation")
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#deriveCountQuery(java.lang.String, java.lang
+ /** {@inheritDoc} */
@Override public DeclaredQuery deriveCountQuery(@Nullable String countQuery,
@Nullable String countQueryProjection) {
-
return DeclaredQuery
.of(countQuery != null ? countQuery : QueryUtils.createCountQueryFor(query, countQueryProjection));
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#usesJdbcStyleParameters()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#usesJdbcStyleParameters()
+ /** */
@Override public boolean usesJdbcStyleParameters() {
return usesJdbcStyleParameters;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#getQueryString()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#getQueryString()
+ /** {@inheritDoc} */
@Override public String getQueryString() {
return query;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#getAlias()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#getAlias()
+ /** {@inheritDoc} */
@Override @Nullable
public String getAlias() {
return alias;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#hasConstructorExpression()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#hasConstructorExpression()
+ /** {@inheritDoc} */
@Override public boolean hasConstructorExpression() {
return hasConstructorExpression;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#isDefaultProjection()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#isDefaultProjection()
+ /** {@inheritDoc} */
@Override public boolean isDefaultProjection() {
return getProjection().equalsIgnoreCase(alias);
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#hasNamedParameter()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#hasNamedParameter()
+ /** {@inheritDoc} */
@Override public boolean hasNamedParameter() {
return bindings.stream().anyMatch(b -> b.getName() != null);
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#usesPaging()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#usesPaging()
+ /** {@inheritDoc} */
@Override public boolean usesPaging() {
return containsPageableInSpel;
}
@@ -181,24 +165,40 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
enum ParameterBindingParser {
+ /** */
INSTANCE;
+
+ /** */
private static final String EXPRESSION_PARAMETER_PREFIX = "__$synthetic$__";
+
+ /** */
public static final String POSITIONAL_OR_INDEXED_PARAMETER = "\\?(\\d*+(?![#\\w]))";
// .....................................................................^ not followed by a hash or a letter.
// .................................................................^ zero or more digits.
// .............................................................^ start with a question mark.
+
+ /** */
private static final Pattern PARAMETER_BINDING_BY_INDEX = Pattern.compile(POSITIONAL_OR_INDEXED_PARAMETER);
+
+ /** */
private static final Pattern PARAMETER_BINDING_PATTERN;
+
+ /** */
private static final String MESSAGE =
"Already found parameter binding with same index / parameter name but differing binding type! "
+ "Already have: %s, found %s! If you bind a parameter multiple times make sure they use the same "
+ "binding.";
+
+ /** */
private static final int INDEXED_PARAMETER_GROUP = 4;
+
+ /** */
private static final int NAMED_PARAMETER_GROUP = 6;
+
+ /** */
private static final int COMPARISION_TYPE_GROUP = 1;
static {
-
List<String> keywords = new ArrayList<>();
for (ParameterBindingType type : ParameterBindingType.values()) {
@@ -233,7 +233,6 @@ class StringQuery implements DeclaredQuery {
private String parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQuery(String query,
List<ParameterBinding> bindings,
Metadata queryMeta) {
-
int greatestParamIdx = tryFindGreatestParameterIndexIn(query);
boolean parametersShouldBeAccessedByIdx = greatestParamIdx != -1;
@@ -255,8 +254,8 @@ class StringQuery implements DeclaredQuery {
int expressionParamIdx = parametersShouldBeAccessedByIdx ? greatestParamIdx : 0;
boolean usesJpaStyleParameters = false;
- while (matcher.find()) {
+ while (matcher.find()) {
if (quotedAreas.isQuoted(matcher.start()))
continue;
@@ -274,7 +273,6 @@ class StringQuery implements DeclaredQuery {
expressionParamIdx++;
if (paramIdxStr != null && paramIdxStr.isEmpty()) {
-
queryMeta.usesJdbcStyleParameters = true;
paramIdx = expressionParamIdx;
}
@@ -295,9 +293,7 @@ class StringQuery implements DeclaredQuery {
}
switch (ParameterBindingType.of(typeSrc)) {
-
case LIKE:
-
Type likeType = LikeParameterBinding.getLikeTypeFrom(matcher.group(2));
replacement = matcher.group(3);
@@ -312,7 +308,6 @@ class StringQuery implements DeclaredQuery {
break;
case IN:
-
if (paramIdx != null)
checkAndRegister(new InParameterBinding(paramIdx, expression), bindings);
else
@@ -334,6 +329,7 @@ class StringQuery implements DeclaredQuery {
return resultingQry;
}
+ /** */
private static SpelExtractor createSpelExtractor(String queryWithSpel,
boolean parametersShouldBeAccessedByIndex,
int greatestParameterIndex) {
@@ -359,8 +355,8 @@ class StringQuery implements DeclaredQuery {
return SpelQueryContext.of(indexToParameterName, parameterNameToReplacement).parse(queryWithSpel);
}
+ /** */
private static String replaceFirst(String text, String substring, String replacement) {
-
int index = text.indexOf(substring);
if (index < 0)
return text;
@@ -368,16 +364,16 @@ class StringQuery implements DeclaredQuery {
return text.substring(0, index) + replacement + text.substring(index + substring.length());
}
+ /** */
@Nullable
private static Integer getParameterIndex(@Nullable String parameterIndexString) {
-
if (parameterIndexString == null || parameterIndexString.isEmpty())
return null;
return Integer.valueOf(parameterIndexString);
}
+ /** */
private static int tryFindGreatestParameterIndexIn(String query) {
-
Matcher parameterIndexMatcher = PARAMETER_BINDING_BY_INDEX.matcher(query);
int greatestParameterIndex = -1;
@@ -392,6 +388,7 @@ class StringQuery implements DeclaredQuery {
return greatestParameterIndex;
}
+ /** */
private static void checkAndRegister(ParameterBinding binding, List<ParameterBinding> bindings) {
bindings.stream() //
@@ -411,12 +408,20 @@ class StringQuery implements DeclaredQuery {
private enum ParameterBindingType {
// Trailing whitespace is intentional to reflect that the keywords must be used with at least one whitespace
// character, while = does not.
+ /** */
LIKE("like "),
+
+ /** */
IN("in "),
+
+ /** */
AS_IS(null);
- private final @Nullable
- String keyword;
+ /** */
+ @Nullable
+ private final String keyword;
+
+ /** */
ParameterBindingType(@Nullable String keyword) {
this.keyword = keyword;
}
@@ -437,7 +442,6 @@ class StringQuery implements DeclaredQuery {
* #AS_IS} in case no other {@link ParameterBindingType} could be found.
*/
static ParameterBindingType of(String typeSource) {
-
if (!StringUtils.hasText(typeSource))
return AS_IS;
@@ -457,12 +461,15 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
static class ParameterBinding {
+ /** */
@Nullable
private final String name;
+ /** */
@Nullable
private final String expression;
+ /** */
@Nullable
private final Integer position;
@@ -523,7 +530,6 @@ class StringQuery implements DeclaredQuery {
/**
* @return the name
* @throws IllegalStateException if the name is not available.
- * @since 2.0
*/
String getRequiredName() throws IllegalStateException {
@@ -546,7 +552,6 @@ class StringQuery implements DeclaredQuery {
/**
* @return the position
* @throws IllegalStateException if the position is not available.
- * @since 2.0
*/
int getRequiredPosition() throws IllegalStateException {
@@ -565,10 +570,7 @@ class StringQuery implements DeclaredQuery {
return expression != null;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ /** */
@Override public int hashCode() {
int result = 17;
@@ -580,10 +582,7 @@ class StringQuery implements DeclaredQuery {
return result;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ /** */
@Override public boolean equals(Object obj) {
if (!(obj instanceof ParameterBinding))
@@ -595,10 +594,7 @@ class StringQuery implements DeclaredQuery {
&& nullSafeEquals(expression, that.expression);
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ /** */
@Override public String toString() {
return String.format("ParameterBinding [name: %s, position: %d, expression: %s]", getName(), getPosition(),
getExpression());
@@ -612,11 +608,11 @@ class StringQuery implements DeclaredQuery {
return valueToBind;
}
+ /** */
@Nullable
public String getExpression() {
return expression;
}
-
}
/**
@@ -626,7 +622,6 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
static class InParameterBinding extends ParameterBinding {
-
/**
* Creates a new {@link InParameterBinding} for the parameter with the given name.
*/
@@ -646,7 +641,6 @@ class StringQuery implements DeclaredQuery {
* @see org.springframework.data.jpa.repository.query.StringQuery.ParameterBinding#prepare(java.lang.Object)
*/
@Override public Object prepare(@Nullable Object value) {
-
if (!ObjectUtils.isArray(value))
return value;
@@ -669,10 +663,11 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
static class LikeParameterBinding extends ParameterBinding {
-
+ /** */
private static final List<Type> SUPPORTED_TYPES = Arrays.asList(Type.CONTAINING, Type.STARTING_WITH,
Type.ENDING_WITH, Type.LIKE);
+ /** */
private final Type type;
/**
@@ -750,7 +745,6 @@ class StringQuery implements DeclaredQuery {
*/
@Nullable
@Override public Object prepare(@Nullable Object value) {
-
if (value == null)
return null;
@@ -767,12 +761,8 @@ class StringQuery implements DeclaredQuery {
}
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ /** */
@Override public boolean equals(Object obj) {
-
if (!(obj instanceof LikeParameterBinding))
return false;
@@ -781,10 +771,7 @@ class StringQuery implements DeclaredQuery {
return super.equals(obj) && type.equals(that.type);
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ /** */
@Override public int hashCode() {
int result = super.hashCode();
@@ -794,10 +781,7 @@ class StringQuery implements DeclaredQuery {
return result;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ /** */
@Override public String toString() {
return String.format("LikeBinding [name: %s, position: %d, type: %s]", getName(), getPosition(), type);
}
@@ -825,13 +809,12 @@ class StringQuery implements DeclaredQuery {
}
+ /** */
static class Metadata {
-
/**
* Uses jdbc style parameters.
*/
private boolean usesJdbcStyleParameters;
-
}
/**
@@ -840,12 +823,12 @@ class StringQuery implements DeclaredQuery {
*
* @author Jens Schauder
* @author Oliver Gierke
- * @since 2.1
*/
static class QuotationMap {
-
+ /** */
private static final Collection<Character> QUOTING_CHARACTERS = Arrays.asList('"', '\'');
+ /** */
private final List<Range<Integer>> quotedRanges = new ArrayList<>();
/**
@@ -854,7 +837,6 @@ class StringQuery implements DeclaredQuery {
* @param query can be {@literal null}.
*/
public QuotationMap(@Nullable String query) {
-
if (query == null)
return;
@@ -862,18 +844,15 @@ class StringQuery implements DeclaredQuery {
int start = 0;
for (int i = 0; i < query.length(); i++) {
-
char currentChar = query.charAt(i);
if (QUOTING_CHARACTERS.contains(currentChar)) {
-
if (inQuotation == null) {
inQuotation = currentChar;
start = i;
}
else if (currentChar == inQuotation) {
-
inQuotation = null;
quotedRanges.add(Range.from(Bound.inclusive(start)).to(Bound.inclusive(i)));
@@ -896,7 +875,5 @@ class StringQuery implements DeclaredQuery {
public boolean isQuoted(int idx) {
return quotedRanges.stream().anyMatch(r -> r.contains(idx));
}
-
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelEvaluator.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelEvaluator.java
index f2b5e26..598b79a 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelEvaluator.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelEvaluator.java
@@ -32,27 +32,18 @@ import org.springframework.util.Assert;
* @author Jens Schauder
* @author Gerrit Meier
* @author Oliver Gierke
- * @since spring data 2.1 - transition code (borrowed and adapted code from version 2.1)
*/
public class SpelEvaluator {
- /**
- * Parser.
- */
+ /** */
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
- /**
- * Evaluation context provider.
- */
+ /** */
private final EvaluationContextProvider evaluationCtxProvider;
- /**
- * Parameters.
- */
+ /** */
private final Parameters<?, ?> parameters;
- /**
- * Extractor.
- */
+ /** */
private final SpelExtractor extractor;
/**
@@ -75,7 +66,6 @@ public class SpelEvaluator {
* @return a map from parameter name to evaluated value. Guaranteed to be not {@literal null}.
*/
public Map<String, Object> evaluate(Object[] values) {
-
Assert.notNull(values, "Values must not be null.");
EvaluationContext evaluationCtx = evaluationCtxProvider.getEvaluationContext(parameters, values);
@@ -103,5 +93,4 @@ public class SpelEvaluator {
private static Object getSpElValue(EvaluationContext evaluationCtx, String expression) {
return PARSER.parseExpression(expression).getValue(evaluationCtx);
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelQueryContext.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelQueryContext.java
index 579b36f..0684a5f 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelQueryContext.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/query/spel/SpelQueryContext.java
@@ -39,17 +39,12 @@ import org.springframework.util.Assert;
*
* @author Jens Schauder
* @author Gerrit Meier
- * @since spring data 2.1 - transition code (borrowed and adapted code from version 2.1)
*/
public class SpelQueryContext {
- /**
- * Spel pattern string.
- */
+ /** */
private static final String SPEL_PATTERN_STRING = "([:?])#\\{([^}]+)}";
- /**
- * Spel pattern.
- */
+ /** */
private static final Pattern SPEL_PATTERN = Pattern.compile(SPEL_PATTERN_STRING);
/**
@@ -68,6 +63,7 @@ public class SpelQueryContext {
*/
private final BiFunction<String, String, String> replacementSrc;
+ /** */
private SpelQueryContext(BiFunction<Integer, String, String> paramNameSrc,
BiFunction<String, String, String> replacementSrc) {
this.paramNameSrc = paramNameSrc;
@@ -112,7 +108,6 @@ public class SpelQueryContext {
* @return Evaluating Spel QueryContext
*/
public EvaluatingSpelQueryContext withEvaluationContextProvider(EvaluationContextProvider provider) {
-
Assert.notNull(provider, "EvaluationContextProvider must not be null!");
return new EvaluatingSpelQueryContext(provider, paramNameSrc, replacementSrc);
@@ -123,10 +118,9 @@ public class SpelQueryContext {
* {@link EvaluationContextProvider}.
*
* @author Oliver Gierke
- * @since 2.1
*/
public static class EvaluatingSpelQueryContext extends SpelQueryContext {
-
+ /** */
private final EvaluationContextProvider evaluationContextProvider;
/**
@@ -139,7 +133,6 @@ public class SpelQueryContext {
*/
private EvaluatingSpelQueryContext(EvaluationContextProvider evaluationCtxProvider,
BiFunction<Integer, String, String> paramNameSrc, BiFunction<String, String, String> replacementSrc) {
-
super(paramNameSrc, replacementSrc);
evaluationContextProvider = evaluationCtxProvider;
@@ -174,33 +167,21 @@ public class SpelQueryContext {
*
* @author Jens Schauder
* @author Oliver Gierke
- * @since 2.1
*/
public class SpelExtractor {
-
- /**
- * Prefix group index.
- */
+ /** */
private static final int PREFIX_GROUP_INDEX = 1;
- /**
- * Expression group index.
- */
+ /** */
private static final int EXPRESSION_GROUP_INDEX = 2;
- /**
- * Query.
- */
+ /** */
private final String query;
- /**
- * Expressions.
- */
+ /** */
private final Map<String, String> expressions;
- /**
- * Quotations.
- */
+ /** */
private final QuotationMap quotations;
/**
@@ -209,7 +190,6 @@ public class SpelQueryContext {
* @param qry must not be {@literal null}.
*/
SpelExtractor(String qry) {
-
Assert.notNull(qry, "Query must not be null");
Map<String, String> exps = new HashMap<>();
@@ -221,11 +201,10 @@ public class SpelQueryContext {
int matchedUntil = 0;
while (matcher.find()) {
-
if (quotedAreas.isQuoted(matcher.start()))
resultQry.append(qry, matchedUntil, matcher.end());
- else {
+ else {
String spelExpression = matcher.group(EXPRESSION_GROUP_INDEX);
String prefix = matcher.group(PREFIX_GROUP_INDEX);
@@ -303,18 +282,12 @@ public class SpelQueryContext {
*
* @author Jens Schauder
* @author Oliver Gierke
- * @since 2.1
*/
static class QuotationMap {
-
- /**
- * Quoting characters.
- */
+ /** */
private static final Collection<Character> QUOTING_CHARACTERS = Arrays.asList('"', '\'');
- /**
- * Quoted ranges.
- */
+ /** */
private final List<Range<Integer>> quotedRanges = new ArrayList<>();
/**
@@ -323,7 +296,6 @@ public class SpelQueryContext {
* @param qry can be {@literal null}.
*/
public QuotationMap(@Nullable String qry) {
-
if (qry == null)
return;
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/ConditionFalse.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/ConditionFalse.java
index f77f220..1b4b378 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/ConditionFalse.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/ConditionFalse.java
@@ -25,9 +25,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
* Always false condition. Tells spring context never load bean with such Condition.
*/
public class ConditionFalse implements Condition {
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
return false;
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactory.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactory.java
index be83460..ac8d175 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactory.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactory.java
@@ -101,6 +101,7 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
beanExpressionContext = new BeanExpressionContext(beanFactory, null);
}
+ /** */
private Ignite igniteForRepoConfig(RepositoryConfig config) {
try {
String igniteInstanceName = evaluateExpression(config.igniteInstance());
@@ -135,39 +136,27 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
}
}
- /**
- * {@inheritDoc} @param <T> the type parameter
- *
- * @param <ID> the type parameter
- * @param domainClass the domain class
- * @return the entity information
- */
+ /** {@inheritDoc} */
@Override public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
return new AbstractEntityInformation<T, ID>(domainClass) {
+ /** {@inheritDoc} */
@Override public ID getId(T entity) {
return null;
}
+ /** {@inheritDoc} */
@Override public Class<ID> getIdType() {
return null;
}
};
}
- /**
- * {@inheritDoc} @param metadata the metadata
- *
- * @return the repository base class
- */
+ /** {@inheritDoc} */
@Override protected Class<?> getRepositoryBaseClass(RepositoryMetadata metadata) {
return IgniteRepositoryImpl.class;
}
- /**
- * {@inheritDoc} @param repoItf the repo itf
- *
- * @return the repository metadata
- */
+ /** {@inheritDoc} */
@Override protected synchronized RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) {
Assert.notNull(repoItf, "Repository interface must be set.");
Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface.");
@@ -190,7 +179,7 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
}
/**
- * evaluate the SpEL expression
+ * Evaluate the SpEL expression
*
* @param spelExpression SpEL expression
* @return the result of execution of the SpEL expression
@@ -200,7 +189,7 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
return (String)resolver.evaluate(spelExpression, beanExpressionContext);
}
- /* control underline cache creation to avoid cache creation by mistake */
+ /** Control underlying cache creation to avoid cache creation by mistake */
private IgniteCache getRepositoryCache(Class<?> repoIf) {
Ignite ignite = repoToIgnite.get(repoIf);
@@ -221,27 +210,18 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
return c;
}
- /**
- * {@inheritDoc} @param metadata the metadata
- *
- * @return the target repository
- */
+ /** {@inheritDoc} */
@Override protected Object getTargetRepository(RepositoryInformation metadata) {
Ignite ignite = repoToIgnite.get(metadata.getRepositoryInterface());
+
return getTargetRepositoryViaReflection(metadata, ignite,
getRepositoryCache(metadata.getRepositoryInterface()));
}
- /**
- * {@inheritDoc} @param key the key
- *
- * @param evaluationContextProvider the evaluation context provider
- * @return the query lookup strategy
- */
+ /** {@inheritDoc} */
@Override protected Optional<QueryLookupStrategy> getQueryLookupStrategy(final QueryLookupStrategy.Key key,
EvaluationContextProvider evaluationContextProvider) {
return Optional.of((mtd, metadata, factory, namedQueries) -> {
-
final Query annotation = mtd.getAnnotation(Query.class);
final Ignite ignite = repoToIgnite.get(metadata.getRepositoryInterface());
@@ -249,11 +229,14 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
.dynamicQuery())) {
String qryStr = annotation.value();
+
boolean annotatedIgniteQuery = !annotation.dynamicQuery() && (StringUtils.hasText(qryStr) || annotation
.textQuery());
+
IgniteQuery query = annotatedIgniteQuery ? new IgniteQuery(qryStr,
!annotation.textQuery() && (isFieldQuery(qryStr) || annotation.forceFieldsQuery()),
annotation.textQuery(), false, IgniteQueryGenerator.getOptions(mtd)) : null;
+
if (key != QueryLookupStrategy.Key.CREATE) {
return new IgniteRepositoryQuery(ignite, metadata, query, mtd, factory,
getRepositoryCache(metadata.getRepositoryInterface()),
@@ -302,5 +285,4 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
// insert
qryUpperCase.matches("^\\s*INSERT\\b.*");
}
-
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactoryBean.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactoryBean.java
index fa94574..5b3d612 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactoryBean.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryFactoryBean.java
@@ -45,9 +45,7 @@ import org.springframework.data.repository.core.support.RepositoryFactorySupport
*/
public class IgniteRepositoryFactoryBean<T extends Repository<V, K>, V, K extends Serializable>
extends RepositoryFactoryBeanSupport<T, V, K> implements ApplicationContextAware {
- /**
- * Application context.
- */
+ /** */
private ApplicationContext ctx;
/**
@@ -57,16 +55,12 @@ public class IgniteRepositoryFactoryBean<T extends Repository<V, K>, V, K extend
super(repoInterface);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public void setApplicationContext(ApplicationContext ctx) throws BeansException {
this.ctx = ctx;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected RepositoryFactorySupport createRepositoryFactory() {
return new IgniteRepositoryFactory(ctx);
}
diff --git a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryImpl.java b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryImpl.java
index 3c32f7b..44156a7 100644
--- a/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryImpl.java
+++ b/modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryImpl.java
@@ -65,53 +65,31 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
this.ignite = ignite;
}
- /**
- * {@inheritDoc} @return the ignite cache
- */
+ /** {@inheritDoc} */
@Override public IgniteCache<K, V> cache() {
return cache;
}
- /**
- * {@inheritDoc} @return the ignite
- */
+ /** {@inheritDoc} */
@Override public Ignite ignite() {
return ignite;
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param key the key
- * @param entity the entity
- * @return the s
- */
+ /** {@inheritDoc} */
@Override public <S extends V> S save(K key, S entity) {
cache.put(key, entity);
return entity;
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entities the entities
- * @return the iterable
- */
+ /** {@inheritDoc} */
@Override public <S extends V> Iterable<S> save(Map<K, S> entities) {
cache.putAll(entities);
return entities.values();
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param key the key
- * @param entity the entity
- * @param expiryPlc the expiry policy
- * @return the s
- */
+ /** {@inheritDoc} */
@Override public <S extends V> S save(K key, S entity, @Nullable ExpiryPolicy expiryPlc) {
if (expiryPlc != null)
cache.withExpiryPolicy(expiryPlc).put(key, entity);
@@ -120,13 +98,7 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
return entity;
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entities the entities
- * @param expiryPlc the expiry policy
- * @return the iterable
- */
+ /** {@inheritDoc} */
@Override public <S extends V> Iterable<S> save(Map<K, S> entities, @Nullable ExpiryPolicy expiryPlc) {
if (expiryPlc != null)
cache.withExpiryPolicy(expiryPlc).putAll(entities);
@@ -136,60 +108,48 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
}
/**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entity the entity
- * @return the s
+ * Not implemented.
*/
@Override public <S extends V> S save(S entity) {
throw new UnsupportedOperationException("Use IgniteRepository.save(key,value) method instead.");
}
/**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entities the entities
- * @return the iterable
+ * Not implemented.
*/
@Override public <S extends V> Iterable<S> saveAll(Iterable<S> entities) {
throw new UnsupportedOperationException("Use IgniteRepository.save(Map<keys,value>) method instead.");
}
- /**
- * {@inheritDoc} @param id the id
- *
- * @return the optional
- */
+ /** {@inheritDoc} */
@Override public Optional<V> findById(K id) {
return Optional.ofNullable(cache.get(id));
}
- /**
- * {@inheritDoc} @param id the id
- *
- * @return the boolean
- */
+ /** {@inheritDoc} */
@Override public boolean existsById(K id) {
return cache.containsKey(id);
}
- /**
- * {@inheritDoc} @return the iterable
- */
+ /** {@inheritDoc} */
@Override public Iterable<V> findAll() {
final Iterator<Cache.Entry<K, V>> iter = cache.iterator();
return new Iterable<V>() {
+ /** */
@Override public Iterator<V> iterator() {
return new Iterator<V>() {
+ /** {@inheritDoc} */
@Override public boolean hasNext() {
return iter.hasNext();
}
+ /** {@inheritDoc} */
@Override public V next() {
return iter.next().getValue();
}
+ /** {@inheritDoc} */
@Override public void remove() {
iter.remove();
}
@@ -198,11 +158,7 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
};
}
- /**
- * {@inheritDoc} @param ids the ids
- *
- * @return the iterable
- */
+ /** {@inheritDoc} */
@Override public Iterable<V> findAllById(Iterable<K> ids) {
if (ids instanceof Set)
return cache.getAll((Set<K>)ids).values();
@@ -218,37 +174,27 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
return cache.getAll(keys).values();
}
- /**
- * {@inheritDoc} @return the long
- */
+ /** {@inheritDoc} */
@Override public long count() {
return cache.size(CachePeekMode.PRIMARY);
}
- /**
- * {@inheritDoc} @param id the id
- */
+ /** {@inheritDoc} */
@Override public void deleteById(K id) {
cache.remove(id);
}
- /**
- * {@inheritDoc} @param entity the entity
- */
+ /** {@inheritDoc} */
@Override public void delete(V entity) {
throw new UnsupportedOperationException("Use IgniteRepository.deleteById(key) method instead.");
}
- /**
- * {@inheritDoc} @param entities the entities
- */
+ /** {@inheritDoc} */
@Override public void deleteAll(Iterable<? extends V> entities) {
throw new UnsupportedOperationException("Use IgniteRepository.deleteAllById(keys) method instead.");
}
- /**
- * {@inheritDoc} @param ids the ids
- */
+ /** {@inheritDoc} */
@Override public void deleteAllById(Iterable<K> ids) {
if (ids instanceof Set) {
cache.removeAll((Set<K>)ids);
@@ -268,11 +214,8 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
cache.removeAll(keys);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public void deleteAll() {
cache.clear();
}
-
}
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java
index 47417ee..5841f41 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java
@@ -31,30 +31,20 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
* Test with using repository which is configured by Spring EL
*/
public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTest {
- /**
- * Number of entries to store
- */
+ /** Number of entries to store */
private static final int CACHE_SIZE = 1000;
- /**
- * Repository.
- */
+ /** Repository. */
private static PersonExpressionRepository repo;
- /**
- * Context.
- */
+ /** Context. */
private static AnnotationConfigApplicationContext ctx;
- /**
- *
- */
+ /** */
@Rule
public final ExpectedException expected = ExpectedException.none();
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
@@ -65,9 +55,7 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
repo = ctx.getBean(PersonExpressionRepository.class);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -76,9 +64,7 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
assertEquals(CACHE_SIZE, repo.count());
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
repo.deleteAll();
@@ -87,25 +73,21 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
super.afterTest();
}
- /**
- *
- */
+ /** */
private void fillInRepository() {
for (int i = 0; i < CACHE_SIZE - 5; i++) {
repo.save(i, new Person("person" + Integer.toHexString(i),
"lastName" + Integer.toHexString((i + 16) % 256)));
}
- repo.save((int)repo.count(), new Person("uniquePerson", "uniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("uniquePerson", "uniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void afterTestsStopped() {
ctx.close();
}
@@ -146,6 +128,7 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
cacheNames.contains("PersonCache"));
}
+ /** */
@Test
public void testCacheCountTWO() {
Ignite ignite = ctx.getBean("igniteInstanceTWO", Ignite.class);
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java
index 5b52092..38785ef 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/**
- *
+ * CRUD tests.
*/
public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
/** Repository. */
@@ -76,9 +76,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
super.afterTest();
}
- /**
- *
- */
+ /** */
private void fillInRepository() {
for (int i = 0; i < CACHE_SIZE - 5; i++) {
repo.save(i, new Person("person" + Integer.toHexString(i),
@@ -97,9 +95,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
ctx.destroy();
}
- /**
- *
- */
+ /** */
@Test
public void testPutGet() {
Person person = new Person("some_name", "some_surname");
@@ -122,9 +118,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testPutAllGetAll() {
LinkedHashMap<Integer, Person> map = new LinkedHashMap<>();
@@ -162,9 +156,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(map.size(), counter);
}
- /**
- *
- */
+ /** */
@Test
public void testGetAll() {
assertEquals(CACHE_SIZE, repo.count());
@@ -181,9 +173,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(repo.count(), counter);
}
- /**
- *
- */
+ /** */
@Test
public void testDelete() {
assertEquals(CACHE_SIZE, repo.count());
@@ -203,9 +193,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testDeleteSet() {
assertEquals(CACHE_SIZE, repo.count());
@@ -234,9 +222,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testDeleteAll() {
assertEquals(CACHE_SIZE, repo.count());
@@ -247,7 +233,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete existing record
+ * Delete existing record.
*/
@Test
public void testDeleteByFirstName() {
@@ -259,7 +245,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete NON existing record
+ * Delete NON existing record.
*/
@Test
public void testDeleteExpression() {
@@ -269,7 +255,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete Multiple records due to where
+ * Delete Multiple records due to where.
*/
@Test
public void testDeleteExpressionMultiple() {
@@ -280,7 +266,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Remove should do the same than Delete
+ * Remove should do the same than Delete.
*/
@Test
public void testRemoveExpression() {
@@ -291,7 +277,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete unique record using lower case key word
+ * Delete unique record using lower case key word.
*/
@Test
public void testDeleteQuery() {
@@ -302,7 +288,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Try to delete with a wrong @Query
+ * Try to delete with a wrong @Query.
*/
@Test
public void testWrongDeleteQuery() {
@@ -320,7 +306,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Update with a @Query a record
+ * Update with a @Query a record.
*/
@Test
public void testUpdateQueryMixedCase() {
@@ -347,6 +333,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName1");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionNamedParameter() {
final String newSecondName = "updatedUniqueSecondName2";
@@ -358,6 +345,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName2");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseDynamicProjectionNamedParameter() {
final String newSecondName = "updatedUniqueSecondName2";
@@ -372,6 +360,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(personFullName.get(0).getFullName(), "uniquePerson updatedUniqueSecondName2");
}
+ /** */
@Test
public void testUpdateQueryOneMixedCaseDynamicProjectionNamedParameter() {
final String newSecondName = "updatedUniqueSecondName2";
@@ -386,6 +375,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(personFullName.getFullName(), "uniquePerson updatedUniqueSecondName2");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionIndexedParameter() {
final String newSecondName = "updatedUniqueSecondName3";
@@ -397,6 +387,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName3");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionIndexedParameterLuceneTextQuery() {
final String newSecondName = "updatedUniqueSecondName4";
@@ -408,6 +399,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName4");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionNamedParameterAndTemplateDomainEntityVariable() {
final String newSecondName = "updatedUniqueSecondName5";
@@ -419,6 +411,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName5");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionNamedParameterWithSpELExtension() {
final String newSecondName = "updatedUniqueSecondName6";
@@ -438,6 +431,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
public void testWrongUpdateQuery() {
final String newSecondName = "updatedUniqueSecondName";
int rowsUpdated = 0;
+
try {
rowsUpdated = repo.setWrongFixedSecondName(newSecondName, "uniquePerson");
}
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java
index 03b15a6..9c16f6d 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java
@@ -38,14 +38,10 @@ import org.springframework.data.domain.Sort;
*
*/
public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
- /**
- * Repository.
- */
+ /** Repository. */
private static PersonRepository repo;
- /**
- * Repository 2.
- */
+ /** Repository 2. */
private static PersonSecondRepository repo2;
/**
@@ -53,9 +49,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
*/
private static PersonRepositoryOtherIgniteInstance repoTWO;
- /**
- * Context.
- */
+ /** Context. */
private static AnnotationConfigApplicationContext ctx;
/**
@@ -95,9 +89,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
ctx.destroy();
}
- /**
- *
- */
+ /** */
@Test
public void testExplicitQuery() {
List<Person> persons = repo.simpleQuery("person4a");
@@ -108,6 +100,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("person4a", person.getFirstName());
}
+ /** */
@Test
public void testExplicitQueryTWO() {
List<Person> persons = repoTWO.simpleQuery("TWOperson4a");
@@ -118,9 +111,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("TWOperson4a", person.getFirstName());
}
- /**
- *
- */
+ /** */
@Test
public void testEqualsPart() {
List<Person> persons = repo.findByFirstName("person4e");
@@ -131,6 +122,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("person4e", person.getFirstName());
}
+ /** */
@Test
public void testEqualsPartTWO() {
List<Person> persons = repoTWO.findByFirstName("TWOperson4e");
@@ -141,9 +133,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("TWOperson4e", person.getFirstName());
}
- /**
- *
- */
+ /** */
@Test
public void testContainingPart() {
List<Person> persons = repo.findByFirstNameContaining("person4");
@@ -154,6 +144,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("person4"));
}
+ /** */
@Test
public void testContainingPartTWO() {
List<Person> persons = repoTWO.findByFirstNameContaining("TWOperson4");
@@ -164,9 +155,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("TWOperson4"));
}
- /**
- *
- */
+ /** */
@Test
public void testTopPart() {
Iterable<Person> top = repo.findTopByFirstNameContaining("person4");
@@ -180,6 +169,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("person4"));
}
+ /** */
@Test
public void testTopPartTWO() {
Iterable<Person> top = repoTWO.findTopByFirstNameContaining("TWOperson4");
@@ -193,9 +183,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("TWOperson4"));
}
- /**
- *
- */
+ /** */
@Test
public void testLikeAndLimit() {
Iterable<Person> like = repo.findFirst10ByFirstNameLike("person");
@@ -211,6 +199,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(10, cnt);
}
+ /** */
@Test
public void testLikeAndLimitTWO() {
Iterable<Person> like = repoTWO.findFirst10ByFirstNameLike("TWOperson");
@@ -226,9 +215,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(10, cnt);
}
- /**
- *
- */
+ /** */
@Test
public void testCount() {
int cnt = repo.countByFirstNameLike("person");
@@ -236,6 +223,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(1000, cnt);
}
+ /** */
@Test
public void testCountTWO() {
int cnt = repoTWO.countByFirstNameLike("TWOperson");
@@ -243,9 +231,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(1000, cnt);
}
- /**
- *
- */
+ /** */
@Test
public void testCount2() {
int cnt = repo.countByFirstNameLike("person4");
@@ -253,6 +239,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cnt < 1000);
}
+ /** */
@Test
public void testCount2TWO() {
int cnt = repoTWO.countByFirstNameLike("TWOperson4");
@@ -260,9 +247,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cnt < 1000);
}
- /**
- *
- */
+ /** */
@Test
public void testPageable() {
PageRequest pageable = new PageRequest(1, 5, Sort.Direction.DESC, "firstName");
@@ -292,9 +277,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(10, firstNames.size());
}
- /**
- *
- */
+ /** */
@Test
public void testAndAndOr() {
int cntAnd = repo.countByFirstNameLikeAndSecondNameLike("person1", "lastName1");
@@ -304,9 +287,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cntAnd <= cntOr);
}
- /**
- *
- */
+ /** */
@Test
public void testQueryWithSort() {
List<Person> persons = repo.queryWithSort("^[a-z]+$", new Sort(Sort.Direction.DESC, "secondName"));
@@ -322,9 +303,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testQueryWithPaging() {
List<Person> persons = repo.queryWithPageable("^[a-z]+$", new PageRequest(1, 7, Sort.Direction.DESC, "secondName"));
@@ -342,9 +321,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testQueryFields() {
List<String> persons = repo.selectField("^[a-z]+$", new PageRequest(1, 7, Sort.Direction.DESC, "secondName"));
@@ -352,9 +329,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(7, persons.size());
}
- /**
- *
- */
+ /** */
@Test
public void testFindCacheEntries() {
List<Cache.Entry<Integer, Person>> cacheEntries = repo.findBySecondNameLike("stName1");
@@ -365,9 +340,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(entry.getValue().getSecondName().contains("stName1"));
}
- /**
- *
- */
+ /** */
@Test
public void testFindOneCacheEntry() {
Cache.Entry<Integer, Person> cacheEntry = repo.findTopBySecondNameLike("tName18");
@@ -377,9 +350,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cacheEntry.getValue().getSecondName().contains("tName18"));
}
- /**
- *
- */
+ /** */
@Test
public void testFindOneValue() {
PersonProjection person = repo.findTopBySecondNameStartingWith("lastName18");
@@ -389,9 +360,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFullName().split("\\s")[1].startsWith("lastName18"));
}
- /**
- *
- */
+ /** */
@Test
public void testSelectSeveralFields() {
List<List> lists = repo.selectSeveralField("^[a-z]+$", new PageRequest(2, 6));
@@ -405,9 +374,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testCountQuery() {
int cnt = repo.countQuery(".*");
@@ -415,9 +382,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(256, cnt);
}
- /**
- *
- */
+ /** */
@Test
public void testSliceOfCacheEntries() {
Slice<Cache.Entry<Integer, Person>> slice = repo2.findBySecondNameIsNot("lastName18", new PageRequest(3, 4));
@@ -428,9 +393,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertFalse("lastName18".equals(entry.getValue().getSecondName()));
}
- /**
- *
- */
+ /** */
@Test
public void testSliceOfLists() {
Slice<List> lists = repo2.querySliceOfList("^[a-z]+$", new PageRequest(0, 3));
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java
index 5ee327f..bce3340 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java
@@ -29,15 +29,14 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.repository.query.spi.EvaluationContextExtension;
-/**
- *
- */
+/** */
@Configuration
@EnableIgniteRepositories
public class ApplicationConfiguration {
-
+ /** */
public static final String IGNITE_INSTANCE_ONE = "IGNITE_INSTANCE_ONE";
+ /** */
public static final String IGNITE_INSTANCE_TWO = "IGNITE_INSTANCE_TWO";
/**
@@ -52,11 +51,13 @@ public class ApplicationConfiguration {
return bean;
}
+ /** */
@Bean
public EvaluationContextExtension sampleSpELExtension() {
return new SampleEvaluationContextExtension();
}
+ /** */
@Bean(value = "sampleExtensionBean")
public SamplePassParamExtension sampleExtensionBean() {
return new SamplePassParamExtension();
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java
index 9aca003..23f8f8e 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java
@@ -24,7 +24,6 @@ import org.springframework.beans.factory.annotation.Value;
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public interface FullNameProjection {
-
/**
* Sample of using SpEL expression
* @return
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java
index c4cab06..a187a08 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java
@@ -24,7 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public interface PersonProjection {
-
+ /** */
String getFirstName();
/**
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java
index 7cb437d..917d16a 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java
@@ -27,7 +27,7 @@ import org.apache.ignite.springdata20.repository.IgniteRepository;
import org.springframework.data.repository.query.Param;
/**
- *
+ * Test repository.
*/
@RepositoryConfig(cacheName = "PersonCache")
public interface PersonRepository extends IgniteRepository<Person, Integer> {
diff --git a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java
index 0e6356a..0fa535d 100644
--- a/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java
+++ b/modules/spring-data-2.0/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java
@@ -59,32 +59,34 @@ import org.springframework.data.repository.query.spi.EvaluationContextExtensionS
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public class SampleEvaluationContextExtension extends EvaluationContextExtensionSupport {
-
+ /** */
private static final SamplePassParamExtension SAMPLE_PASS_PARAM_EXTENSION_INSTANCE = new SamplePassParamExtension();
+ /** */
private static final Map<String, Object> properties = new HashMap<>();
+ /** */
private static final String SAMPLE_EXTENSION_SPEL_VAR = "sampleExtension";
static {
properties.put(SAMPLE_EXTENSION_SPEL_VAR, SAMPLE_PASS_PARAM_EXTENSION_INSTANCE);
}
+ /** */
@Override public String getExtensionId() {
return "HK-SAMPLE-PASS-PARAM-EXTENSION";
}
+ /** */
@Override public Map<String, Object> getProperties() {
return properties;
}
+ /** */
public static class SamplePassParamExtension {
-
// just return same param
public Object transformParam(Object param) {
return param;
}
-
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/IgniteRepository.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/IgniteRepository.java
index b81992e..3cc3172 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/IgniteRepository.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/IgniteRepository.java
@@ -66,7 +66,7 @@ public interface IgniteRepository<V, K extends Serializable> extends CrudReposit
* It's suggested to use this method instead of default {@link CrudRepository#save(Object)} that generates IDs
* (keys) that are not unique cluster wide.
*
- * @param <S> type of entities.
+ * @param <S> Type of entities.
* @param entities Map of key-entities pairs to save.
* @return Saved entities.
*/
@@ -92,7 +92,7 @@ public interface IgniteRepository<V, K extends Serializable> extends CrudReposit
* It's suggested to use this method instead of default {@link CrudRepository#save(Object)} that generates IDs
* (keys) that are not unique cluster wide.
*
- * @param <S> type of entities.
+ * @param <S> Type of entities.
* @param entities Map of key-entities pairs to save.
* @param expiryPlc ExpiryPolicy to apply, if not null.
* @return Saved entities.
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/DynamicQueryConfig.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/DynamicQueryConfig.java
index eed1b4d..f915267 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/DynamicQueryConfig.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/DynamicQueryConfig.java
@@ -31,64 +31,37 @@ package org.apache.ignite.springdata22.repository.config;
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public class DynamicQueryConfig {
- /**
- * Value.
- */
+ /** */
private String value = "";
- /**
- * Text query.
- */
+ /** */
private boolean textQuery;
- /**
- * Force fields query.
- */
+ /** */
private boolean forceFieldsQry;
- /**
- * Collocated.
- */
+ /** */
private boolean collocated;
- /**
- * Timeout.
- */
+ /** */
private int timeout;
- /**
- * Enforce join order.
- */
+ /** */
private boolean enforceJoinOrder;
- /**
- * Distributed joins.
- */
+ /** */
private boolean distributedJoins;
- /**
- * Replicated only.
- */
- private boolean replicatedOnly;
-
- /**
- * Lazy.
- */
+ /** */
private boolean lazy;
- /**
- * Local.
- */
+ /** */
private boolean local;
- /**
- * Parts.
- */
+ /** */
private int[] parts;
- /**
- * Limit.
- */
+ /** */
private int limit;
/**
@@ -105,7 +78,6 @@ public class DynamicQueryConfig {
config.timeout = queryConfiguration.timeout();
config.enforceJoinOrder = queryConfiguration.enforceJoinOrder();
config.distributedJoins = queryConfiguration.distributedJoins();
- config.replicatedOnly = queryConfiguration.replicatedOnly();
config.lazy = queryConfiguration.lazy();
config.parts = queryConfiguration.parts();
config.local = queryConfiguration.local();
@@ -201,19 +173,6 @@ public class DynamicQueryConfig {
}
/**
- * Specify if the query contains only replicated tables. This is a hint for potentially more effective execution.
- * <p>
- * Only applicable to SqlFieldsQuery and SqlQuery
- *
- * @return the boolean
- * @deprecated No longer used as of Apache Ignite 2.8.
- */
- @Deprecated
- public boolean replicatedOnly() {
- return replicatedOnly;
- }
-
- /**
* Sets lazy query execution flag.
* <p>
* By default Ignite attempts to fetch the whole query result set to memory and send it to the client. For small and
@@ -344,17 +303,6 @@ public class DynamicQueryConfig {
}
/**
- * Sets replicated only.
- *
- * @param replicatedOnly the replicated only
- * @return this for chaining
- */
- public DynamicQueryConfig setReplicatedOnly(boolean replicatedOnly) {
- this.replicatedOnly = replicatedOnly;
- return this;
- }
-
- /**
* Sets lazy.
*
* @param lazy the lazy
@@ -397,5 +345,4 @@ public class DynamicQueryConfig {
this.limit = limit;
return this;
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoriesRegistar.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoriesRegistar.java
index 416ec0b..ddecd77 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoriesRegistar.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoriesRegistar.java
@@ -25,16 +25,12 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* Apache Ignite specific implementation of {@link RepositoryBeanDefinitionRegistrarSupport}.
*/
public class IgniteRepositoriesRegistar extends RepositoryBeanDefinitionRegistrarSupport {
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected Class<? extends Annotation> getAnnotation() {
return EnableIgniteRepositories.class;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected RepositoryConfigurationExtension getExtension() {
return new IgniteRepositoryConfigurationExtension();
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoryConfigurationExtension.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoryConfigurationExtension.java
index b78811b..4989196 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoryConfigurationExtension.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/IgniteRepositoryConfigurationExtension.java
@@ -27,30 +27,22 @@ import org.springframework.data.repository.config.RepositoryConfigurationExtensi
* Apache Ignite specific implementation of {@link RepositoryConfigurationExtension}.
*/
public class IgniteRepositoryConfigurationExtension extends RepositoryConfigurationExtensionSupport {
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getModuleName() {
return "Apache Ignite";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected String getModulePrefix() {
return "ignite";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getRepositoryFactoryBeanClassName() {
return IgniteRepositoryFactoryBean.class.getName();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected Collection<Class<?>> getIdentifyingTypes() {
return Collections.singleton(IgniteRepository.class);
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/Query.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/Query.java
index a3b3a51..d1af467 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/Query.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/config/Query.java
@@ -89,16 +89,6 @@ public @interface Query {
boolean distributedJoins() default false;
/**
- * Specify if the query contains only replicated tables. This is a hint for potentially more effective execution.
- * <p>
- * Only applicable to SqlFieldsQuery and SqlQuery
- *
- * @deprecated No longer used as of Apache Ignite 2.8.
- */
- @Deprecated
- boolean replicatedOnly() default false;
-
- /**
* Sets lazy query execution flag.
* <p>
* By default Ignite attempts to fetch the whole query result set to memory and send it to the client. For small and
@@ -143,5 +133,4 @@ public @interface Query {
* Sets limit to response records count for TextQuery. If 0 or less, considered to be no limit.
*/
int limit() default 0;
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/DeclaredQuery.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/DeclaredQuery.java
index e6ad7ba..e968034 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/DeclaredQuery.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/DeclaredQuery.java
@@ -23,7 +23,6 @@ import org.springframework.util.StringUtils;
* A wrapper for a String representation of a query offering information about the query.
*
* @author Jens Schauder
- * @since 2.0.3
*/
interface DeclaredQuery {
/**
@@ -56,8 +55,6 @@ interface DeclaredQuery {
/**
* Returns whether the query is using a constructor expression.
- *
- * @since 1.10
*/
public boolean hasConstructorExpression();
@@ -84,7 +81,6 @@ interface DeclaredQuery {
/**
* @return whether paging is implemented in the query itself, e.g. using SpEL expressions.
- * @since 2.0.6
*/
public default boolean usesPaging() {
return false;
@@ -95,7 +91,6 @@ interface DeclaredQuery {
* name.
*
* @return Whether the query uses JDBC style parameters.
- * @since 2.0.6
*/
public boolean usesJdbcStyleParameters();
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/EmptyDeclaredQuery.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/EmptyDeclaredQuery.java
index dcf06b4..47691b6 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/EmptyDeclaredQuery.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/EmptyDeclaredQuery.java
@@ -24,7 +24,6 @@ import org.springframework.util.Assert;
* NULL-Object pattern implementation for {@link DeclaredQuery}.
*
* @author Jens Schauder
- * @since 2.0.3
*/
class EmptyDeclaredQuery implements DeclaredQuery {
/**
@@ -32,59 +31,43 @@ class EmptyDeclaredQuery implements DeclaredQuery {
*/
static final DeclaredQuery EMPTY_QUERY = new EmptyDeclaredQuery();
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean hasNamedParameter() {
return false;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getQueryString() {
return "";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public String getAlias() {
return null;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean hasConstructorExpression() {
return false;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean isDefaultProjection() {
return false;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public List<StringQuery.ParameterBinding> getParameterBindings() {
return Collections.emptyList();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public DeclaredQuery deriveCountQuery(@Nullable String cntQry, @Nullable String cntQryProjection) {
Assert.hasText(cntQry, "CountQuery must not be empty!");
return DeclaredQuery.of(cntQry);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean usesJdbcStyleParameters() {
return false;
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/ExpressionBasedStringQuery.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/ExpressionBasedStringQuery.java
index 4e6007a..bdbd81d 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/ExpressionBasedStringQuery.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/ExpressionBasedStringQuery.java
@@ -150,5 +150,4 @@ class ExpressionBasedStringQuery extends StringQuery {
private static boolean containsExpression(String qry) {
return qry.contains(ENTITY_NAME_VARIABLE_EXPRESSION);
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQuery.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQuery.java
index 5b552af..49c947d 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQuery.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQuery.java
@@ -17,7 +17,7 @@
package org.apache.ignite.springdata22.repository.query;
-import java.util.StringJoiner;
+import org.apache.ignite.internal.util.typedef.internal.S;
/**
* Ignite query helper class. For internal use only.
@@ -26,24 +26,15 @@ import java.util.StringJoiner;
* @author Manuel Núñez (manuel.nunez@hawkore.com)
*/
public class IgniteQuery {
-
- /**
- *
- */
+ /** */
enum Option {
- /**
- * Query will be used with Sort object.
- */
+ /** Query will be used with Sort object. */
SORTING,
- /**
- * Query will be used with Pageable object.
- */
+ /** Query will be used with Pageable object. */
PAGINATION,
- /**
- * No advanced option.
- */
+ /** No advanced option. */
NONE
}
@@ -136,10 +127,8 @@ public class IgniteQuery {
return option;
}
+ /** */
@Override public String toString() {
- return new StringJoiner(", ", IgniteQuery.class.getSimpleName() + "[", "]").add("qrySql='" + qrySql + "'")
- .add("isFieldQuery=" + isFieldQuery).add("isTextQuery=" + isTextQuery)
- .add("isAutogenerated=" + isAutogenerated).add("option=" + option).toString();
+ return S.toString(IgniteQuery.class, this);
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQueryGenerator.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQueryGenerator.java
index 9772e45..48b070d 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQueryGenerator.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteQueryGenerator.java
@@ -29,8 +29,9 @@ import org.springframework.data.repository.query.parser.PartTree;
* Ignite query generator for Spring Data framework.
*/
public class IgniteQueryGenerator {
-
+ /** */
private IgniteQueryGenerator() {
+ // No-op.
}
/**
@@ -38,7 +39,6 @@ public class IgniteQueryGenerator {
* @param metadata Metadata.
* @return Generated ignite query.
*/
- @NotNull
public static IgniteQuery generateSql(Method mtd, RepositoryMetadata metadata) {
PartTree parts = new PartTree(mtd.getName(), metadata.getDomainType());
@@ -253,5 +253,4 @@ public class IgniteQueryGenerator {
sql.append(")");
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteRepositoryQuery.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteRepositoryQuery.java
index c51c984..8ddbe51 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteRepositoryQuery.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/IgniteRepositoryQuery.java
@@ -33,7 +33,6 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Stream;
-
import javax.cache.Cache;
import org.apache.commons.lang.ArrayUtils;
import org.apache.ignite.Ignite;
@@ -156,166 +155,105 @@ import static org.apache.ignite.springdata22.repository.support.IgniteRepository
* </pre>
* </li>
* </ol>
- * <p>
- * Visit <a href="https://docs.hawkore.com/private/apache-ignite-advanced-indexing">Apache Ignite advanced Indexing
- * Documentation site</a> for more info about Advanced Lucene Index and Lucene Query Builder.
*
* @author Apache Ignite Team
* @author Manuel Núñez (manuel.nunez@hawkore.com)
*/
@SuppressWarnings("unchecked")
public class IgniteRepositoryQuery implements RepositoryQuery {
-
+ /** */
private static final TreeMap<String, Class<?>> binaryFieldClass = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
/**
* Defines the way how to process query result
*/
private enum ReturnStrategy {
- /**
- * Need to return only one value.
- */
+ /** Need to return only one value. */
ONE_VALUE,
- /**
- * Need to return one cache entry
- */
+ /** Need to return one cache entry */
CACHE_ENTRY,
- /**
- * Need to return list of cache entries
- */
+ /** Need to return list of cache entries */
LIST_OF_CACHE_ENTRIES,
- /**
- * Need to return list of values
- */
+ /** Need to return list of values */
LIST_OF_VALUES,
- /**
- * Need to return list of lists
- */
+ /** Need to return list of lists */
LIST_OF_LISTS,
- /**
- * Need to return slice
- */
+ /** Need to return slice */
SLICE_OF_VALUES,
- /**
- * Slice of cache entries.
- */
+ /** Slice of cache entries */
SLICE_OF_CACHE_ENTRIES,
- /**
- * Slice of lists.
- */
+ /** Slice of lists */
SLICE_OF_LISTS,
- /**
- * Need to return Page of values
- */
+ /** Need to return Page of values */
PAGE_OF_VALUES,
- /**
- * Need to return stream of values
- */
+ /** Need to return stream of values */
STREAM_OF_VALUES,
}
- /**
- * Type.
- */
+ /** */
private final Class<?> type;
- /**
- * Sql.
- */
+ /** */
private final IgniteQuery staticQuery;
- /**
- * Cache.
- */
+ /** */
private final IgniteCache cache;
- /**
- * Ignite instance
- */
+ /** */
private final Ignite ignite;
- /**
- * required by qryStr field query type for binary manipulation
- */
+ /** Required by qryStr field query type for binary manipulation */
private IgniteBinaryImpl igniteBinary;
- /**
- * Ignite bin type.
- */
+ /** */
private BinaryType igniteBinType;
- /**
- * Method.
- */
+ /** */
private final Method mtd;
- /**
- * Metadata.
- */
+ /** */
private final RepositoryMetadata metadata;
- /**
- * Factory.
- */
+ /** */
private final ProjectionFactory factory;
- /**
- * Return strategy.
- */
+ /** */
private final ReturnStrategy staticReturnStgy;
- /**
- * Detect if returned data from method is projected
- */
+ /** Detect if returned data from method is projected */
private final boolean hasProjection;
- /**
- * Whether projection is dynamic (provided as method parameter)
- */
+ /** Whether projection is dynamic (provided as method parameter) */
private final boolean hasDynamicProjection;
- /**
- * Dynamic projection parameter index.
- */
+ /** Dynamic projection parameter index */
private final int dynamicProjectionIndex;
- /**
- * Dynamic query configuration.
- */
+ /** Dynamic query configuration */
private final int dynamicQueryConfigurationIndex;
- /**
- * the return query method
- */
+ /** The return query method */
private final QueryMethod qMethod;
- /**
- * the return domain class of QueryMethod
- */
+ /** The return domain class of QueryMethod */
private final Class<?> returnedDomainClass;
- /**
- * Expression parser.
- */
+ /** */
private final SpelExpressionParser expressionParser;
- /**
- * could provide ExtensionAwareQueryMethodEvaluationContextProvider
- */
+ /** Could provide ExtensionAwareQueryMethodEvaluationContextProvider */
private final QueryMethodEvaluationContextProvider queryMethodEvaluationContextProvider;
- /**
- * Static query configuration.
- */
+ /** Static query configuration. */
private final DynamicQueryConfig staticQueryConfiguration;
/**
@@ -386,7 +324,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
* @return the object
*/
@Override public Object execute(Object[] values) {
-
Object[] parameters = values;
// config via Query annotation (dynamicQuery = false)
@@ -420,9 +357,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return transformQueryCursor(qry, returnStgy, parameters, qryCursor);
}
- /**
- * {@inheritDoc} @return the query method
- */
+ /** {@inheritDoc} */
@Override public QueryMethod getQueryMethod() {
return new QueryMethod(mtd, metadata, factory);
}
@@ -434,28 +369,35 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
int index = -1;
while (it.hasNext()) {
T parameter = it.next();
+
if (DynamicQueryConfig.class.isAssignableFrom(parameter.getType())) {
if (found) {
throw new IllegalStateException("Invalid '" + method.getName() + "' repository method signature. "
+ "Only ONE DynamicQueryConfig parameter is allowed");
}
+
found = true;
index = i;
}
+
i++;
}
return index;
}
+ /** */
private synchronized IgniteBinaryImpl binary() {
if (igniteBinary == null)
igniteBinary = (IgniteBinaryImpl)ignite.binary();
+
return igniteBinary;
}
+ /** */
private synchronized BinaryType binType() {
if (igniteBinType == null)
igniteBinType = binary().type(type);
+
return igniteBinType;
}
@@ -501,7 +443,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
* @return if {@code mtd} return type is assignable from {@code cls}
*/
private boolean hasAssignableGenericReturnTypeFrom(Class<?> cls, Method mtd) {
-
Type genericReturnType = mtd.getGenericReturnType();
if (!(genericReturnType instanceof ParameterizedType))
@@ -530,7 +471,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
}
/**
- * when select fields by query H2 returns Timestamp for types java.util.Date and java.qryStr.Timestamp
+ * When select fields by query H2 returns Timestamp for types java.util.Date and java.qryStr.Timestamp
*
* @see org.apache.ignite.internal.processors.query.h2.H2DatabaseType map.put(Timestamp.class, TIMESTAMP)
* map.put(java.util.Date.class, TIMESTAMP) map.put(java.qryStr.Date.class, DATE)
@@ -538,6 +479,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private static <T> T fixExpectedType(final Object object, final Class<T> expected) {
if (expected != null && object instanceof java.sql.Timestamp && expected.equals(java.util.Date.class))
return (T)new java.util.Date(((java.sql.Timestamp)object).getTime());
+
return (T)object;
}
@@ -547,11 +489,13 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private IgniteQuery getQuery(@Nullable DynamicQueryConfig cfg) {
if (staticQuery != null)
return staticQuery;
+
if (cfg != null && (StringUtils.hasText(cfg.value()) || cfg.textQuery())) {
return new IgniteQuery(cfg.value(),
!cfg.textQuery() && (isFieldQuery(cfg.value()) || cfg.forceFieldsQuery()), cfg.textQuery(),
false, IgniteQueryGenerator.getOptions(mtd));
}
+
throw new IllegalStateException("Unable to obtain a valid query. When passing dynamicQuery = true via org"
+ ".apache.ignite.springdata.repository.config.Query annotation, you must"
+ " provide a non null method parameter of type DynamicQueryConfig with a "
@@ -564,8 +508,10 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private ReturnStrategy getReturnStgy(IgniteQuery qry) {
if (staticReturnStgy != null)
return staticReturnStgy;
+
if (qry != null)
return calcReturnType(mtd, qry.isFieldQuery());
+
throw new IllegalStateException("Unable to obtain a valid return strategy. When passing dynamicQuery = true "
+ "via org.apache.ignite.springdata.repository.config.Query annotation, "
+ "you must provide a non null method parameter of type "
@@ -601,7 +547,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
ReturnStrategy returnStgy,
Object[] prmtrs,
QueryCursor qryCursor) {
-
final Class<?> returnClass;
if (hasProjection) {
@@ -727,7 +672,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
private Object[] extractBindableValues(Object[] values,
Parameters<?, ?> queryMethodParams,
List<ParameterBinding> queryBindings) {
-
// no binding params then exit
if (queryBindings.isEmpty())
return values;
@@ -786,7 +730,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
*/
@NotNull
private Query prepareQuery(IgniteQuery qry, DynamicQueryConfig config, ReturnStrategy returnStgy, Object[] values) {
-
Object[] parameters = values;
String queryString = qry.qryStr();
@@ -796,7 +739,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
checkRequiredPageable(returnStgy, values);
if (!qry.isTextQuery()) {
-
if (!qry.isAutogenerated()) {
StringQuery squery = new ExpressionBasedStringQuery(queryString, metadata, expressionParser);
queryString = squery.getQueryString();
@@ -840,7 +782,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
if (config.parts() != null && config.parts().length > 0)
sqlFieldsQry.setPartitions(config.parts());
- sqlFieldsQry.setReplicatedOnly(config.replicatedOnly());
sqlFieldsQry.setTimeout(config.timeout(), TimeUnit.MILLISECONDS);
query = sqlFieldsQry;
@@ -851,16 +792,16 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
sqlQry.setDistributedJoins(config.distributedJoins());
sqlQry.setLocal(config.local());
+
if (config.parts() != null && config.parts().length > 0)
sqlQry.setPartitions(config.parts());
- sqlQry.setReplicatedOnly(config.replicatedOnly());
+
sqlQry.setTimeout(config.timeout(), TimeUnit.MILLISECONDS);
query = sqlQry;
}
}
else {
-
int pageSize = -1;
switch (qry.options()) {
@@ -899,6 +840,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return query;
}
+ /** */
private static Map<String, Object> rowToMap(final List<?> row, final List<GridQueryFieldMetadata> meta) {
// use treemap with case insensitive property name
final TreeMap<String, Object> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
@@ -912,7 +854,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return map;
}
- /*
+ /**
* convert row ( with list of field values) into domain entity
*/
private <V> V rowToEntity(final IgniteBinaryImpl binary,
@@ -953,7 +895,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
final BinaryType binType,
final GridQueryFieldMetadata fieldMeta) {
try {
-
final String fieldId = fieldMeta.schemaName() + "." + fieldMeta.typeName() + "." + fieldMeta.fieldName();
if (binaryFieldClass.containsKey(fieldId))
@@ -1038,7 +979,6 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
* @param <V> transformed output type
*/
public static class QueryCursorWrapper<T, V> extends AbstractCollection<V> implements QueryCursor<V> {
-
/**
* Delegate query cursor.
*/
@@ -1060,14 +1000,12 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
this.transformer = transformer;
}
- /**
- * {@inheritDoc} @return the iterator
- */
+ /** {@inheritDoc} */
@Override public Iterator<V> iterator() {
-
final Iterator<T> it = delegate.iterator();
return new Iterator<V>() {
+ /** */
@Override public boolean hasNext() {
if (!it.hasNext()) {
U.closeQuiet(delegate);
@@ -1076,6 +1014,7 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return true;
}
+ /** */
@Override public V next() {
final V r = transformer.apply(it.next());
if (r != null)
@@ -1085,16 +1024,12 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
};
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public void close() {
U.closeQuiet(delegate);
}
- /**
- * {@inheritDoc} @return the all
- */
+ /** {@inheritDoc} */
@Override public List<V> getAll() {
final List<V> data = new ArrayList<>();
delegate.forEach(i -> data.add(transformer.apply(i)));
@@ -1102,13 +1037,9 @@ public class IgniteRepositoryQuery implements RepositoryQuery {
return data;
}
- /**
- * {@inheritDoc} @return the int
- */
+ /** {@inheritDoc} */
@Override public int size() {
return 0;
}
-
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/QueryUtils.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/QueryUtils.java
index 3c46aae..f3bae41 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/QueryUtils.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/QueryUtils.java
@@ -118,7 +118,6 @@ public abstract class QueryUtils {
private static final Pattern FUNCTION_PATTERN;
static {
-
StringBuilder builder = new StringBuilder();
builder.append("(?<=from)"); // from as starting delimiter
builder.append("(?:\\s)+"); // at least one space separating
@@ -165,7 +164,7 @@ public abstract class QueryUtils {
* Private constructor to prevent instantiation.
*/
private QueryUtils() {
-
+ // No-op.
}
/**
@@ -179,7 +178,6 @@ public abstract class QueryUtils {
public static String getExistsQueryString(String entityName,
String cntQryPlaceHolder,
Iterable<String> idAttrs) {
-
String whereClause = Streamable.of(idAttrs).stream() //
.map(idAttribute -> String.format(EQUALS_CONDITION_STRING, "x", idAttribute,
idAttribute)) //
@@ -194,10 +192,9 @@ public abstract class QueryUtils {
* @param template must not be {@literal null}.
* @param entityName must not be {@literal null}.
* @return the template with placeholders replaced by the {@literal entityName}. Guaranteed to be not {@literal
- * null}.
+ * null}.
*/
public static String getQueryString(String template, String entityName) {
-
Assert.hasText(entityName, "Entity name must not be null or empty!");
return String.format(template, entityName);
@@ -210,12 +207,10 @@ public abstract class QueryUtils {
* @return a {@literal Set} of aliases used in the query. Guaranteed to be not {@literal null}.
*/
static Set<String> getOuterJoinAliases(String qry) {
-
Set<String> result = new HashSet<>();
Matcher matcher = JOIN_PATTERN.matcher(qry);
while (matcher.find()) {
-
String alias = matcher.group(QUERY_JOIN_ALIAS_GROUP_INDEX);
if (StringUtils.hasText(alias))
result.add(alias);
@@ -231,12 +226,10 @@ public abstract class QueryUtils {
* @return a {@literal Set} containing all found aliases. Guaranteed to be not {@literal null}.
*/
static Set<String> getFunctionAliases(String qry) {
-
Set<String> result = new HashSet<>();
Matcher matcher = FUNCTION_PATTERN.matcher(qry);
while (matcher.find()) {
-
String alias = matcher.group(1);
if (StringUtils.hasText(alias))
@@ -251,12 +244,9 @@ public abstract class QueryUtils {
*
* @param qry must not be {@literal null}.
* @return Might return {@literal null}.
- * @deprecated use {@link DeclaredQuery#getAlias()} instead.
*/
@Nullable
- @Deprecated
- public static String detectAlias(String qry) {
-
+ static String detectAlias(String qry) {
Matcher matcher = ALIAS_MATCH.matcher(qry);
return matcher.find() ? matcher.group(2) : null;
@@ -265,34 +255,17 @@ public abstract class QueryUtils {
/**
* Creates a count projected query from the given original query.
*
- * @param originalQry must not be {@literal null} or empty.
- * @return Guaranteed to be not {@literal null}.
- * @deprecated use {@link DeclaredQuery#deriveCountQuery(String, String)} instead.
- */
- @Deprecated
- public static String createCountQueryFor(String originalQry) {
- return createCountQueryFor(originalQry, null);
- }
-
- /**
- * Creates a count projected query from the given original query.
- *
* @param originalQry must not be {@literal null}.
* @param cntProjection may be {@literal null}.
* @return a query String to be used a count query for pagination. Guaranteed to be not {@literal null}.
- * @since 1.6
- * @deprecated use {@link DeclaredQuery#deriveCountQuery(String, String)} instead.
*/
- @Deprecated
- public static String createCountQueryFor(String originalQry, @Nullable String cntProjection) {
-
+ static String createCountQueryFor(String originalQry, @Nullable String cntProjection) {
Assert.hasText(originalQry, "OriginalQuery must not be null or empty!");
Matcher matcher = COUNT_MATCH.matcher(originalQry);
String countQuery;
if (cntProjection == null) {
-
String variable = matcher.matches() ? matcher.group(VARIABLE_NAME_GROUP_INDEX) : null;
boolean useVariable = variable != null && StringUtils.hasText(variable) && !variable.startsWith("new")
&& !variable.startsWith("count(") && !variable.contains(",");
@@ -307,25 +280,12 @@ public abstract class QueryUtils {
}
/**
- * Returns whether the given query contains named parameters.
- *
- * @param qry can be {@literal null} or empty.
- * @return whether the given query contains named parameters.
- */
- @Deprecated
- static boolean hasNamedParameter(@Nullable String qry) {
- return StringUtils.hasText(qry) && NAMED_PARAMETER.matcher(qry).find();
- }
-
- /**
* Returns whether the given JPQL query contains a constructor expression.
*
* @param qry must not be {@literal null} or empty.
* @return boolean
- * @since 1.10
*/
public static boolean hasConstructorExpression(String qry) {
-
Assert.hasText(qry, "Query must not be null or empty!");
return CONSTRUCTOR_EXPRESSION.matcher(qry).find();
@@ -336,15 +296,12 @@ public abstract class QueryUtils {
*
* @param qry must not be {@literal null} or empty.
* @return projection
- * @since 1.10.2
*/
public static String getProjection(String qry) {
-
Assert.hasText(qry, "Query must not be null or empty!");
Matcher matcher = PROJECTION_CLAUSE.matcher(qry);
String projection = matcher.find() ? matcher.group(1) : "";
return projection.trim();
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/StringQuery.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/StringQuery.java
index bad39b2..1c2366e 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/StringQuery.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/query/StringQuery.java
@@ -25,7 +25,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.data.repository.query.SpelQueryContext;
import org.springframework.data.repository.query.SpelQueryContext.SpelExtractor;
-
import org.springframework.data.domain.Range;
import org.springframework.data.domain.Range.Bound;
import org.springframework.data.repository.query.parser.Part.Type;
@@ -51,18 +50,23 @@ import static org.springframework.util.ObjectUtils.nullSafeHashCode;
* @author Jens Schauder
*/
class StringQuery implements DeclaredQuery {
-
+ /** */
private final String query;
+ /** */
private final List<ParameterBinding> bindings;
+ /** */
@Nullable
private final String alias;
+ /** */
private final boolean hasConstructorExpression;
+ /** */
private final boolean containsPageableInSpel;
+ /** */
private final boolean usesJdbcStyleParameters;
/**
@@ -70,8 +74,7 @@ class StringQuery implements DeclaredQuery {
*
* @param query must not be {@literal null} or empty.
*/
- @SuppressWarnings("deprecation") StringQuery(String query) {
-
+ StringQuery(String query) {
Assert.hasText(query, "Query must not be null or empty!");
bindings = new ArrayList<>();
@@ -94,84 +97,64 @@ class StringQuery implements DeclaredQuery {
return !bindings.isEmpty();
}
+ /** */
String getProjection() {
return QueryUtils.getProjection(query);
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#getParameterBindings()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#getParameterBindings()
+ /** {@inheritDoc} */
@Override public List<ParameterBinding> getParameterBindings() {
return bindings;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#deriveCountQuery(java.lang.String, java.lang
- * .String)
- */
- @SuppressWarnings("deprecation")
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#deriveCountQuery(java.lang.String, java.lang
+ /** {@inheritDoc} */
@Override public DeclaredQuery deriveCountQuery(@Nullable String countQuery,
@Nullable String countQueryProjection) {
-
return DeclaredQuery
.of(countQuery != null ? countQuery : QueryUtils.createCountQueryFor(query, countQueryProjection));
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#usesJdbcStyleParameters()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#usesJdbcStyleParameters()
+ /** */
@Override public boolean usesJdbcStyleParameters() {
return usesJdbcStyleParameters;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#getQueryString()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#getQueryString()
+ /** {@inheritDoc} */
@Override public String getQueryString() {
return query;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#getAlias()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#getAlias()
+ /** {@inheritDoc} */
@Override @Nullable
public String getAlias() {
return alias;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#hasConstructorExpression()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#hasConstructorExpression()
+ /** {@inheritDoc} */
@Override public boolean hasConstructorExpression() {
return hasConstructorExpression;
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#isDefaultProjection()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#isDefaultProjection()
+ /** {@inheritDoc} */
@Override public boolean isDefaultProjection() {
return getProjection().equalsIgnoreCase(alias);
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#hasNamedParameter()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#hasNamedParameter()
+ /** {@inheritDoc} */
@Override public boolean hasNamedParameter() {
return bindings.stream().anyMatch(b -> b.getName() != null);
}
- /*
- * (non-Javadoc)
- * @see org.springframework.data.jpa.repository.query.DeclaredQuery#usesPaging()
- */
+ // See org.springframework.data.jpa.repository.query.DeclaredQuery#usesPaging()
+ /** {@inheritDoc} */
@Override public boolean usesPaging() {
return containsPageableInSpel;
}
@@ -182,24 +165,40 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
enum ParameterBindingParser {
+ /** */
INSTANCE;
+
+ /** */
private static final String EXPRESSION_PARAMETER_PREFIX = "__$synthetic$__";
+
+ /** */
public static final String POSITIONAL_OR_INDEXED_PARAMETER = "\\?(\\d*+(?![#\\w]))";
// .....................................................................^ not followed by a hash or a letter.
// .................................................................^ zero or more digits.
// .............................................................^ start with a question mark.
+
+ /** */
private static final Pattern PARAMETER_BINDING_BY_INDEX = Pattern.compile(POSITIONAL_OR_INDEXED_PARAMETER);
+
+ /** */
private static final Pattern PARAMETER_BINDING_PATTERN;
+
+ /** */
private static final String MESSAGE =
"Already found parameter binding with same index / parameter name but differing binding type! "
+ "Already have: %s, found %s! If you bind a parameter multiple times make sure they use the same "
+ "binding.";
+
+ /** */
private static final int INDEXED_PARAMETER_GROUP = 4;
+
+ /** */
private static final int NAMED_PARAMETER_GROUP = 6;
+
+ /** */
private static final int COMPARISION_TYPE_GROUP = 1;
static {
-
List<String> keywords = new ArrayList<>();
for (ParameterBindingType type : ParameterBindingType.values()) {
@@ -234,7 +233,6 @@ class StringQuery implements DeclaredQuery {
private String parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQuery(String query,
List<ParameterBinding> bindings,
Metadata queryMeta) {
-
int greatestParamIdx = tryFindGreatestParameterIndexIn(query);
boolean parametersShouldBeAccessedByIdx = greatestParamIdx != -1;
@@ -256,8 +254,8 @@ class StringQuery implements DeclaredQuery {
int expressionParamIdx = parametersShouldBeAccessedByIdx ? greatestParamIdx : 0;
boolean usesJpaStyleParameters = false;
- while (matcher.find()) {
+ while (matcher.find()) {
if (quotedAreas.isQuoted(matcher.start()))
continue;
@@ -275,7 +273,6 @@ class StringQuery implements DeclaredQuery {
expressionParamIdx++;
if (paramIdxStr != null && paramIdxStr.isEmpty()) {
-
queryMeta.usesJdbcStyleParameters = true;
paramIdx = expressionParamIdx;
}
@@ -296,9 +293,7 @@ class StringQuery implements DeclaredQuery {
}
switch (ParameterBindingType.of(typeSrc)) {
-
case LIKE:
-
Type likeType = LikeParameterBinding.getLikeTypeFrom(matcher.group(2));
replacement = matcher.group(3);
@@ -313,7 +308,6 @@ class StringQuery implements DeclaredQuery {
break;
case IN:
-
if (paramIdx != null)
checkAndRegister(new InParameterBinding(paramIdx, expression), bindings);
else
@@ -335,6 +329,7 @@ class StringQuery implements DeclaredQuery {
return resultingQry;
}
+ /** */
private static SpelExtractor createSpelExtractor(String queryWithSpel,
boolean parametersShouldBeAccessedByIndex,
int greatestParameterIndex) {
@@ -360,8 +355,8 @@ class StringQuery implements DeclaredQuery {
return SpelQueryContext.of(indexToParameterName, parameterNameToReplacement).parse(queryWithSpel);
}
+ /** */
private static String replaceFirst(String text, String substring, String replacement) {
-
int index = text.indexOf(substring);
if (index < 0)
return text;
@@ -369,16 +364,16 @@ class StringQuery implements DeclaredQuery {
return text.substring(0, index) + replacement + text.substring(index + substring.length());
}
+ /** */
@Nullable
private static Integer getParameterIndex(@Nullable String parameterIndexString) {
-
if (parameterIndexString == null || parameterIndexString.isEmpty())
return null;
return Integer.valueOf(parameterIndexString);
}
+ /** */
private static int tryFindGreatestParameterIndexIn(String query) {
-
Matcher parameterIndexMatcher = PARAMETER_BINDING_BY_INDEX.matcher(query);
int greatestParameterIndex = -1;
@@ -393,6 +388,7 @@ class StringQuery implements DeclaredQuery {
return greatestParameterIndex;
}
+ /** */
private static void checkAndRegister(ParameterBinding binding, List<ParameterBinding> bindings) {
bindings.stream() //
@@ -412,12 +408,20 @@ class StringQuery implements DeclaredQuery {
private enum ParameterBindingType {
// Trailing whitespace is intentional to reflect that the keywords must be used with at least one whitespace
// character, while = does not.
+ /** */
LIKE("like "),
+
+ /** */
IN("in "),
+
+ /** */
AS_IS(null);
- private final @Nullable
- String keyword;
+ /** */
+ @Nullable
+ private final String keyword;
+
+ /** */
ParameterBindingType(@Nullable String keyword) {
this.keyword = keyword;
}
@@ -438,7 +442,6 @@ class StringQuery implements DeclaredQuery {
* #AS_IS} in case no other {@link ParameterBindingType} could be found.
*/
static ParameterBindingType of(String typeSource) {
-
if (!StringUtils.hasText(typeSource))
return AS_IS;
@@ -458,12 +461,15 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
static class ParameterBinding {
+ /** */
@Nullable
private final String name;
+ /** */
@Nullable
private final String expression;
+ /** */
@Nullable
private final Integer position;
@@ -524,7 +530,6 @@ class StringQuery implements DeclaredQuery {
/**
* @return the name
* @throws IllegalStateException if the name is not available.
- * @since 2.0
*/
String getRequiredName() throws IllegalStateException {
@@ -547,7 +552,6 @@ class StringQuery implements DeclaredQuery {
/**
* @return the position
* @throws IllegalStateException if the position is not available.
- * @since 2.0
*/
int getRequiredPosition() throws IllegalStateException {
@@ -566,10 +570,7 @@ class StringQuery implements DeclaredQuery {
return expression != null;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ /** */
@Override public int hashCode() {
int result = 17;
@@ -581,10 +582,7 @@ class StringQuery implements DeclaredQuery {
return result;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ /** */
@Override public boolean equals(Object obj) {
if (!(obj instanceof ParameterBinding))
@@ -596,10 +594,7 @@ class StringQuery implements DeclaredQuery {
&& nullSafeEquals(expression, that.expression);
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ /** */
@Override public String toString() {
return String.format("ParameterBinding [name: %s, position: %d, expression: %s]", getName(), getPosition(),
getExpression());
@@ -613,11 +608,11 @@ class StringQuery implements DeclaredQuery {
return valueToBind;
}
+ /** */
@Nullable
public String getExpression() {
return expression;
}
-
}
/**
@@ -627,7 +622,6 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
static class InParameterBinding extends ParameterBinding {
-
/**
* Creates a new {@link InParameterBinding} for the parameter with the given name.
*/
@@ -647,7 +641,6 @@ class StringQuery implements DeclaredQuery {
* @see org.springframework.data.jpa.repository.query.StringQuery.ParameterBinding#prepare(java.lang.Object)
*/
@Override public Object prepare(@Nullable Object value) {
-
if (!ObjectUtils.isArray(value))
return value;
@@ -670,10 +663,11 @@ class StringQuery implements DeclaredQuery {
* @author Thomas Darimont
*/
static class LikeParameterBinding extends ParameterBinding {
-
+ /** */
private static final List<Type> SUPPORTED_TYPES = Arrays.asList(Type.CONTAINING, Type.STARTING_WITH,
Type.ENDING_WITH, Type.LIKE);
+ /** */
private final Type type;
/**
@@ -751,7 +745,6 @@ class StringQuery implements DeclaredQuery {
*/
@Nullable
@Override public Object prepare(@Nullable Object value) {
-
if (value == null)
return null;
@@ -768,12 +761,8 @@ class StringQuery implements DeclaredQuery {
}
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ /** */
@Override public boolean equals(Object obj) {
-
if (!(obj instanceof LikeParameterBinding))
return false;
@@ -782,10 +771,7 @@ class StringQuery implements DeclaredQuery {
return super.equals(obj) && type.equals(that.type);
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ /** */
@Override public int hashCode() {
int result = super.hashCode();
@@ -795,10 +781,7 @@ class StringQuery implements DeclaredQuery {
return result;
}
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ /** */
@Override public String toString() {
return String.format("LikeBinding [name: %s, position: %d, type: %s]", getName(), getPosition(), type);
}
@@ -826,13 +809,12 @@ class StringQuery implements DeclaredQuery {
}
+ /** */
static class Metadata {
-
/**
* Uses jdbc style parameters.
*/
private boolean usesJdbcStyleParameters;
-
}
/**
@@ -841,12 +823,12 @@ class StringQuery implements DeclaredQuery {
*
* @author Jens Schauder
* @author Oliver Gierke
- * @since 2.1
*/
static class QuotationMap {
-
+ /** */
private static final Collection<Character> QUOTING_CHARACTERS = Arrays.asList('"', '\'');
+ /** */
private final List<Range<Integer>> quotedRanges = new ArrayList<>();
/**
@@ -855,7 +837,6 @@ class StringQuery implements DeclaredQuery {
* @param query can be {@literal null}.
*/
public QuotationMap(@Nullable String query) {
-
if (query == null)
return;
@@ -863,18 +844,15 @@ class StringQuery implements DeclaredQuery {
int start = 0;
for (int i = 0; i < query.length(); i++) {
-
char currentChar = query.charAt(i);
if (QUOTING_CHARACTERS.contains(currentChar)) {
-
if (inQuotation == null) {
inQuotation = currentChar;
start = i;
}
else if (currentChar == inQuotation) {
-
inQuotation = null;
quotedRanges.add(Range.from(Bound.inclusive(start)).to(Bound.inclusive(i)));
@@ -897,7 +875,5 @@ class StringQuery implements DeclaredQuery {
public boolean isQuoted(int idx) {
return quotedRanges.stream().anyMatch(r -> r.contains(idx));
}
-
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/ConditionFalse.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/ConditionFalse.java
index b30c11b..a69dc8e 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/ConditionFalse.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/ConditionFalse.java
@@ -25,9 +25,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
* Always false condition. Tells spring context never load bean with such Condition.
*/
public class ConditionFalse implements Condition {
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
return false;
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactory.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactory.java
index 036280b..9c04b38 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactory.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactory.java
@@ -101,6 +101,7 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
beanExpressionContext = new BeanExpressionContext(beanFactory, null);
}
+ /** */
private Ignite igniteForRepoConfig(RepositoryConfig config) {
try {
String igniteInstanceName = evaluateExpression(config.igniteInstance());
@@ -135,39 +136,27 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
}
}
- /**
- * {@inheritDoc} @param <T> the type parameter
- *
- * @param <ID> the type parameter
- * @param domainClass the domain class
- * @return the entity information
- */
+ /** {@inheritDoc} */
@Override public <T, ID> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
return new AbstractEntityInformation<T, ID>(domainClass) {
+ /** {@inheritDoc} */
@Override public ID getId(T entity) {
return null;
}
+ /** {@inheritDoc} */
@Override public Class<ID> getIdType() {
return null;
}
};
}
- /**
- * {@inheritDoc} @param metadata the metadata
- *
- * @return the repository base class
- */
+ /** {@inheritDoc} */
@Override protected Class<?> getRepositoryBaseClass(RepositoryMetadata metadata) {
return IgniteRepositoryImpl.class;
}
- /**
- * {@inheritDoc} @param repoItf the repo itf
- *
- * @return the repository metadata
- */
+ /** {@inheritDoc} */
@Override protected synchronized RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) {
Assert.notNull(repoItf, "Repository interface must be set.");
Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface.");
@@ -190,7 +179,7 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
}
/**
- * evaluate the SpEL expression
+ * Evaluate the SpEL expression
*
* @param spelExpression SpEL expression
* @return the result of execution of the SpEL expression
@@ -200,7 +189,7 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
return (String)resolver.evaluate(spelExpression, beanExpressionContext);
}
- /* control underline cache creation to avoid cache creation by mistake */
+ /** Control underlying cache creation to avoid cache creation by mistake */
private IgniteCache getRepositoryCache(Class<?> repoIf) {
Ignite ignite = repoToIgnite.get(repoIf);
@@ -221,27 +210,18 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
return c;
}
- /**
- * {@inheritDoc} @param metadata the metadata
- *
- * @return the target repository
- */
+ /** {@inheritDoc} */
@Override protected Object getTargetRepository(RepositoryInformation metadata) {
Ignite ignite = repoToIgnite.get(metadata.getRepositoryInterface());
+
return getTargetRepositoryViaReflection(metadata, ignite,
getRepositoryCache(metadata.getRepositoryInterface()));
}
- /**
- * {@inheritDoc} @param key the key
- *
- * @param evaluationContextProvider the evaluation context provider
- * @return the query lookup strategy
- */
+ /** {@inheritDoc} */
@Override protected Optional<QueryLookupStrategy> getQueryLookupStrategy(final QueryLookupStrategy.Key key,
QueryMethodEvaluationContextProvider evaluationContextProvider) {
return Optional.of((mtd, metadata, factory, namedQueries) -> {
-
final Query annotation = mtd.getAnnotation(Query.class);
final Ignite ignite = repoToIgnite.get(metadata.getRepositoryInterface());
@@ -249,11 +229,14 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
.dynamicQuery())) {
String qryStr = annotation.value();
+
boolean annotatedIgniteQuery = !annotation.dynamicQuery() && (StringUtils.hasText(qryStr) || annotation
.textQuery());
+
IgniteQuery query = annotatedIgniteQuery ? new IgniteQuery(qryStr,
!annotation.textQuery() && (isFieldQuery(qryStr) || annotation.forceFieldsQuery()),
annotation.textQuery(), false, IgniteQueryGenerator.getOptions(mtd)) : null;
+
if (key != QueryLookupStrategy.Key.CREATE) {
return new IgniteRepositoryQuery(ignite, metadata, query, mtd, factory,
getRepositoryCache(metadata.getRepositoryInterface()),
@@ -302,5 +285,4 @@ public class IgniteRepositoryFactory extends RepositoryFactorySupport {
// insert
qryUpperCase.matches("^\\s*INSERT\\b.*");
}
-
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactoryBean.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactoryBean.java
index f56c68c..ece9f31 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactoryBean.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryFactoryBean.java
@@ -45,9 +45,7 @@ import org.springframework.data.repository.core.support.RepositoryFactorySupport
*/
public class IgniteRepositoryFactoryBean<T extends Repository<V, K>, V, K extends Serializable>
extends RepositoryFactoryBeanSupport<T, V, K> implements ApplicationContextAware {
- /**
- * Application context.
- */
+ /** */
private ApplicationContext ctx;
/**
@@ -57,16 +55,12 @@ public class IgniteRepositoryFactoryBean<T extends Repository<V, K>, V, K extend
super(repoInterface);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public void setApplicationContext(ApplicationContext ctx) throws BeansException {
this.ctx = ctx;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected RepositoryFactorySupport createRepositoryFactory() {
return new IgniteRepositoryFactory(ctx);
}
diff --git a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryImpl.java b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryImpl.java
index 9bf63ed..0e13ee9 100644
--- a/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryImpl.java
+++ b/modules/spring-data-2.2/src/main/java/org/apache/ignite/springdata22/repository/support/IgniteRepositoryImpl.java
@@ -65,53 +65,31 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
this.ignite = ignite;
}
- /**
- * {@inheritDoc} @return the ignite cache
- */
+ /** {@inheritDoc} */
@Override public IgniteCache<K, V> cache() {
return cache;
}
- /**
- * {@inheritDoc} @return the ignite
- */
+ /** {@inheritDoc} */
@Override public Ignite ignite() {
return ignite;
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param key the key
- * @param entity the entity
- * @return the s
- */
+ /** {@inheritDoc} */
@Override public <S extends V> S save(K key, S entity) {
cache.put(key, entity);
return entity;
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entities the entities
- * @return the iterable
- */
+ /** {@inheritDoc} */
@Override public <S extends V> Iterable<S> save(Map<K, S> entities) {
cache.putAll(entities);
return entities.values();
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param key the key
- * @param entity the entity
- * @param expiryPlc the expiry policy
- * @return the s
- */
+ /** {@inheritDoc} */
@Override public <S extends V> S save(K key, S entity, @Nullable ExpiryPolicy expiryPlc) {
if (expiryPlc != null)
cache.withExpiryPolicy(expiryPlc).put(key, entity);
@@ -120,13 +98,7 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
return entity;
}
- /**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entities the entities
- * @param expiryPlc the expiry policy
- * @return the iterable
- */
+ /** {@inheritDoc} */
@Override public <S extends V> Iterable<S> save(Map<K, S> entities, @Nullable ExpiryPolicy expiryPlc) {
if (expiryPlc != null)
cache.withExpiryPolicy(expiryPlc).putAll(entities);
@@ -136,60 +108,48 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
}
/**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entity the entity
- * @return the s
+ * Not implemented.
*/
@Override public <S extends V> S save(S entity) {
throw new UnsupportedOperationException("Use IgniteRepository.save(key,value) method instead.");
}
/**
- * {@inheritDoc} @param <S> the type parameter
- *
- * @param entities the entities
- * @return the iterable
+ * Not implemented.
*/
@Override public <S extends V> Iterable<S> saveAll(Iterable<S> entities) {
throw new UnsupportedOperationException("Use IgniteRepository.save(Map<keys,value>) method instead.");
}
- /**
- * {@inheritDoc} @param id the id
- *
- * @return the optional
- */
+ /** {@inheritDoc} */
@Override public Optional<V> findById(K id) {
return Optional.ofNullable(cache.get(id));
}
- /**
- * {@inheritDoc} @param id the id
- *
- * @return the boolean
- */
+ /** {@inheritDoc} */
@Override public boolean existsById(K id) {
return cache.containsKey(id);
}
- /**
- * {@inheritDoc} @return the iterable
- */
+ /** {@inheritDoc} */
@Override public Iterable<V> findAll() {
final Iterator<Cache.Entry<K, V>> iter = cache.iterator();
return new Iterable<V>() {
+ /** */
@Override public Iterator<V> iterator() {
return new Iterator<V>() {
+ /** {@inheritDoc} */
@Override public boolean hasNext() {
return iter.hasNext();
}
+ /** {@inheritDoc} */
@Override public V next() {
return iter.next().getValue();
}
+ /** {@inheritDoc} */
@Override public void remove() {
iter.remove();
}
@@ -198,11 +158,7 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
};
}
- /**
- * {@inheritDoc} @param ids the ids
- *
- * @return the iterable
- */
+ /** {@inheritDoc} */
@Override public Iterable<V> findAllById(Iterable<K> ids) {
if (ids instanceof Set)
return cache.getAll((Set<K>)ids).values();
@@ -218,37 +174,27 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
return cache.getAll(keys).values();
}
- /**
- * {@inheritDoc} @return the long
- */
+ /** {@inheritDoc} */
@Override public long count() {
return cache.size(CachePeekMode.PRIMARY);
}
- /**
- * {@inheritDoc} @param id the id
- */
+ /** {@inheritDoc} */
@Override public void deleteById(K id) {
cache.remove(id);
}
- /**
- * {@inheritDoc} @param entity the entity
- */
+ /** {@inheritDoc} */
@Override public void delete(V entity) {
throw new UnsupportedOperationException("Use IgniteRepository.deleteById(key) method instead.");
}
- /**
- * {@inheritDoc} @param entities the entities
- */
+ /** {@inheritDoc} */
@Override public void deleteAll(Iterable<? extends V> entities) {
throw new UnsupportedOperationException("Use IgniteRepository.deleteAllById(keys) method instead.");
}
- /**
- * {@inheritDoc} @param ids the ids
- */
+ /** {@inheritDoc} */
@Override public void deleteAllById(Iterable<K> ids) {
if (ids instanceof Set) {
cache.removeAll((Set<K>)ids);
@@ -268,11 +214,8 @@ public class IgniteRepositoryImpl<V, K extends Serializable> implements IgniteRe
cache.removeAll(keys);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public void deleteAll() {
cache.clear();
}
-
}
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java
index 7154619..d9de9b7 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfExpressionTest.java
@@ -32,30 +32,20 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
* Test with using repository which is configured by Spring EL
*/
public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTest {
- /**
- * Number of entries to store
- */
+ /** Number of entries to store */
private static final int CACHE_SIZE = 1000;
- /**
- * Repository.
- */
+ /** Repository. */
private static PersonExpressionRepository repo;
- /**
- * Context.
- */
+ /** Context. */
private static AnnotationConfigApplicationContext ctx;
- /**
- *
- */
+ /** */
@Rule
public final ExpectedException expected = ExpectedException.none();
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
super.beforeTestsStarted();
@@ -66,9 +56,7 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
repo = ctx.getBean(PersonExpressionRepository.class);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
@@ -77,9 +65,7 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
assertEquals(CACHE_SIZE, repo.count());
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
repo.deleteAll();
@@ -88,25 +74,21 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
super.afterTest();
}
- /**
- *
- */
+ /** */
private void fillInRepository() {
for (int i = 0; i < CACHE_SIZE - 5; i++) {
repo.save(i, new Person("person" + Integer.toHexString(i),
"lastName" + Integer.toHexString((i + 16) % 256)));
}
- repo.save((int)repo.count(), new Person("uniquePerson", "uniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
- repo.save((int)repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("uniquePerson", "uniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
+ repo.save((int) repo.count(), new Person("nonUniquePerson", "nonUniqueLastName"));
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override protected void afterTestsStopped() {
ctx.close();
}
@@ -147,6 +129,7 @@ public class IgniteSpringDataCrudSelfExpressionTest extends GridCommonAbstractTe
cacheNames.contains("PersonCache"));
}
+ /** */
@Test
public void testCacheCountTWO() {
Ignite ignite = ctx.getBean("igniteInstanceTWO", Ignite.class);
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java
index 5b52092..38785ef 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataCrudSelfTest.java
@@ -33,7 +33,7 @@ import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/**
- *
+ * CRUD tests.
*/
public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
/** Repository. */
@@ -76,9 +76,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
super.afterTest();
}
- /**
- *
- */
+ /** */
private void fillInRepository() {
for (int i = 0; i < CACHE_SIZE - 5; i++) {
repo.save(i, new Person("person" + Integer.toHexString(i),
@@ -97,9 +95,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
ctx.destroy();
}
- /**
- *
- */
+ /** */
@Test
public void testPutGet() {
Person person = new Person("some_name", "some_surname");
@@ -122,9 +118,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testPutAllGetAll() {
LinkedHashMap<Integer, Person> map = new LinkedHashMap<>();
@@ -162,9 +156,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(map.size(), counter);
}
- /**
- *
- */
+ /** */
@Test
public void testGetAll() {
assertEquals(CACHE_SIZE, repo.count());
@@ -181,9 +173,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(repo.count(), counter);
}
- /**
- *
- */
+ /** */
@Test
public void testDelete() {
assertEquals(CACHE_SIZE, repo.count());
@@ -203,9 +193,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testDeleteSet() {
assertEquals(CACHE_SIZE, repo.count());
@@ -234,9 +222,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testDeleteAll() {
assertEquals(CACHE_SIZE, repo.count());
@@ -247,7 +233,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete existing record
+ * Delete existing record.
*/
@Test
public void testDeleteByFirstName() {
@@ -259,7 +245,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete NON existing record
+ * Delete NON existing record.
*/
@Test
public void testDeleteExpression() {
@@ -269,7 +255,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete Multiple records due to where
+ * Delete Multiple records due to where.
*/
@Test
public void testDeleteExpressionMultiple() {
@@ -280,7 +266,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Remove should do the same than Delete
+ * Remove should do the same than Delete.
*/
@Test
public void testRemoveExpression() {
@@ -291,7 +277,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Delete unique record using lower case key word
+ * Delete unique record using lower case key word.
*/
@Test
public void testDeleteQuery() {
@@ -302,7 +288,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Try to delete with a wrong @Query
+ * Try to delete with a wrong @Query.
*/
@Test
public void testWrongDeleteQuery() {
@@ -320,7 +306,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
}
/**
- * Update with a @Query a record
+ * Update with a @Query a record.
*/
@Test
public void testUpdateQueryMixedCase() {
@@ -347,6 +333,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName1");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionNamedParameter() {
final String newSecondName = "updatedUniqueSecondName2";
@@ -358,6 +345,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName2");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseDynamicProjectionNamedParameter() {
final String newSecondName = "updatedUniqueSecondName2";
@@ -372,6 +360,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(personFullName.get(0).getFullName(), "uniquePerson updatedUniqueSecondName2");
}
+ /** */
@Test
public void testUpdateQueryOneMixedCaseDynamicProjectionNamedParameter() {
final String newSecondName = "updatedUniqueSecondName2";
@@ -386,6 +375,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(personFullName.getFullName(), "uniquePerson updatedUniqueSecondName2");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionIndexedParameter() {
final String newSecondName = "updatedUniqueSecondName3";
@@ -397,6 +387,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName3");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionIndexedParameterLuceneTextQuery() {
final String newSecondName = "updatedUniqueSecondName4";
@@ -408,6 +399,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName4");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionNamedParameterAndTemplateDomainEntityVariable() {
final String newSecondName = "updatedUniqueSecondName5";
@@ -419,6 +411,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
assertEquals(person.get(0).getFullName(), "uniquePerson updatedUniqueSecondName5");
}
+ /** */
@Test
public void testUpdateQueryMixedCaseProjectionNamedParameterWithSpELExtension() {
final String newSecondName = "updatedUniqueSecondName6";
@@ -438,6 +431,7 @@ public class IgniteSpringDataCrudSelfTest extends GridCommonAbstractTest {
public void testWrongUpdateQuery() {
final String newSecondName = "updatedUniqueSecondName";
int rowsUpdated = 0;
+
try {
rowsUpdated = repo.setWrongFixedSecondName(newSecondName, "uniquePerson");
}
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java
index 25592a2..d35c781 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/IgniteSpringDataQueriesSelfTest.java
@@ -38,14 +38,10 @@ import org.springframework.data.domain.Sort;
*
*/
public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
- /**
- * Repository.
- */
+ /** Repository. */
private static PersonRepository repo;
- /**
- * Repository 2.
- */
+ /** Repository 2. */
private static PersonSecondRepository repo2;
/**
@@ -53,9 +49,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
*/
private static PersonRepositoryOtherIgniteInstance repoTWO;
- /**
- * Context.
- */
+ /** Context. */
private static AnnotationConfigApplicationContext ctx;
/**
@@ -95,9 +89,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
ctx.destroy();
}
- /**
- *
- */
+ /** */
@Test
public void testExplicitQuery() {
List<Person> persons = repo.simpleQuery("person4a");
@@ -108,6 +100,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("person4a", person.getFirstName());
}
+ /** */
@Test
public void testExplicitQueryTWO() {
List<Person> persons = repoTWO.simpleQuery("TWOperson4a");
@@ -118,9 +111,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("TWOperson4a", person.getFirstName());
}
- /**
- *
- */
+ /** */
@Test
public void testEqualsPart() {
List<Person> persons = repo.findByFirstName("person4e");
@@ -131,6 +122,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("person4e", person.getFirstName());
}
+ /** */
@Test
public void testEqualsPartTWO() {
List<Person> persons = repoTWO.findByFirstName("TWOperson4e");
@@ -141,9 +133,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals("TWOperson4e", person.getFirstName());
}
- /**
- *
- */
+ /** */
@Test
public void testContainingPart() {
List<Person> persons = repo.findByFirstNameContaining("person4");
@@ -154,6 +144,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("person4"));
}
+ /** */
@Test
public void testContainingPartTWO() {
List<Person> persons = repoTWO.findByFirstNameContaining("TWOperson4");
@@ -164,9 +155,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("TWOperson4"));
}
- /**
- *
- */
+ /** */
@Test
public void testTopPart() {
Iterable<Person> top = repo.findTopByFirstNameContaining("person4");
@@ -180,6 +169,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("person4"));
}
+ /** */
@Test
public void testTopPartTWO() {
Iterable<Person> top = repoTWO.findTopByFirstNameContaining("TWOperson4");
@@ -193,9 +183,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFirstName().startsWith("TWOperson4"));
}
- /**
- *
- */
+ /** */
@Test
public void testLikeAndLimit() {
Iterable<Person> like = repo.findFirst10ByFirstNameLike("person");
@@ -211,6 +199,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(10, cnt);
}
+ /** */
@Test
public void testLikeAndLimitTWO() {
Iterable<Person> like = repoTWO.findFirst10ByFirstNameLike("TWOperson");
@@ -226,9 +215,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(10, cnt);
}
- /**
- *
- */
+ /** */
@Test
public void testCount() {
int cnt = repo.countByFirstNameLike("person");
@@ -236,6 +223,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(1000, cnt);
}
+ /** */
@Test
public void testCountTWO() {
int cnt = repoTWO.countByFirstNameLike("TWOperson");
@@ -243,9 +231,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(1000, cnt);
}
- /**
- *
- */
+ /** */
@Test
public void testCount2() {
int cnt = repo.countByFirstNameLike("person4");
@@ -253,6 +239,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cnt < 1000);
}
+ /** */
@Test
public void testCount2TWO() {
int cnt = repoTWO.countByFirstNameLike("TWOperson4");
@@ -260,9 +247,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cnt < 1000);
}
- /**
- *
- */
+ /** */
@Test
public void testPageable() {
PageRequest pageable = PageRequest.of(1, 5, Sort.Direction.DESC, "firstName");
@@ -292,9 +277,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(10, firstNames.size());
}
- /**
- *
- */
+ /** */
@Test
public void testAndAndOr() {
int cntAnd = repo.countByFirstNameLikeAndSecondNameLike("person1", "lastName1");
@@ -304,9 +287,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cntAnd <= cntOr);
}
- /**
- *
- */
+ /** */
@Test
public void testQueryWithSort() {
List<Person> persons = repo.queryWithSort("^[a-z]+$", Sort.by(Sort.Direction.DESC, "secondName"));
@@ -322,9 +303,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testQueryWithPaging() {
List<Person> persons = repo.queryWithPageable("^[a-z]+$", PageRequest.of(1, 7, Sort.Direction.DESC, "secondName"));
@@ -342,9 +321,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testQueryFields() {
List<String> persons = repo.selectField("^[a-z]+$", PageRequest.of(1, 7, Sort.Direction.DESC, "secondName"));
@@ -352,9 +329,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(7, persons.size());
}
- /**
- *
- */
+ /** */
@Test
public void testFindCacheEntries() {
List<Cache.Entry<Integer, Person>> cacheEntries = repo.findBySecondNameLike("stName1");
@@ -365,9 +340,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(entry.getValue().getSecondName().contains("stName1"));
}
- /**
- *
- */
+ /** */
@Test
public void testFindOneCacheEntry() {
Cache.Entry<Integer, Person> cacheEntry = repo.findTopBySecondNameLike("tName18");
@@ -377,9 +350,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(cacheEntry.getValue().getSecondName().contains("tName18"));
}
- /**
- *
- */
+ /** */
@Test
public void testFindOneValue() {
PersonProjection person = repo.findTopBySecondNameStartingWith("lastName18");
@@ -389,9 +360,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertTrue(person.getFullName().split("\\s")[1].startsWith("lastName18"));
}
- /**
- *
- */
+ /** */
@Test
public void testSelectSeveralFields() {
List<List> lists = repo.selectSeveralField("^[a-z]+$", PageRequest.of(2, 6));
@@ -405,9 +374,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
}
}
- /**
- *
- */
+ /** */
@Test
public void testCountQuery() {
int cnt = repo.countQuery(".*");
@@ -415,9 +382,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertEquals(256, cnt);
}
- /**
- *
- */
+ /** */
@Test
public void testSliceOfCacheEntries() {
Slice<Cache.Entry<Integer, Person>> slice = repo2.findBySecondNameIsNot("lastName18", PageRequest.of(3, 4));
@@ -428,9 +393,7 @@ public class IgniteSpringDataQueriesSelfTest extends GridCommonAbstractTest {
assertFalse("lastName18".equals(entry.getValue().getSecondName()));
}
- /**
- *
- */
+ /** */
@Test
public void testSliceOfLists() {
Slice<List> lists = repo2.querySliceOfList("^[a-z]+$", PageRequest.of(0, 3));
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java
index c418926..1443d5d 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/ApplicationConfiguration.java
@@ -29,15 +29,14 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.spel.spi.EvaluationContextExtension;
-/**
- *
- */
+/** */
@Configuration
@EnableIgniteRepositories
public class ApplicationConfiguration {
-
+ /** */
public static final String IGNITE_INSTANCE_ONE = "IGNITE_INSTANCE_ONE";
+ /** */
public static final String IGNITE_INSTANCE_TWO = "IGNITE_INSTANCE_TWO";
/**
@@ -52,11 +51,13 @@ public class ApplicationConfiguration {
return bean;
}
+ /** */
@Bean
public EvaluationContextExtension sampleSpELExtension() {
return new SampleEvaluationContextExtension();
}
+ /** */
@Bean(value = "sampleExtensionBean")
public SamplePassParamExtension sampleExtensionBean() {
return new SamplePassParamExtension();
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java
index 9aca003..23f8f8e 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/FullNameProjection.java
@@ -24,7 +24,6 @@ import org.springframework.beans.factory.annotation.Value;
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public interface FullNameProjection {
-
/**
* Sample of using SpEL expression
* @return
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java
index c4cab06..a187a08 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonProjection.java
@@ -24,7 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public interface PersonProjection {
-
+ /** */
String getFirstName();
/**
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java
index 59db22b..0a5826f 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/PersonRepository.java
@@ -30,7 +30,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.data.repository.query.Param;
/**
- *
+ * Test repository.
*/
@RepositoryConfig(cacheName = "PersonCache")
public interface PersonRepository extends IgniteRepository<Person, Integer> {
diff --git a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java
index 7acdcb5..9db4343 100644
--- a/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java
+++ b/modules/spring-data-2.2/src/test/java/org/apache/ignite/springdata/misc/SampleEvaluationContextExtension.java
@@ -22,7 +22,7 @@ import java.util.Map;
import org.springframework.data.spel.spi.EvaluationContextExtension;
/**
- * Sample EvaluationContext Extension for Spring Data 2.0
+ * Sample EvaluationContext Extension for Spring Data 2.2
* <p>
* Use SpEl expressions into your {@code @Query} definitions.
* <p>
@@ -59,32 +59,35 @@ import org.springframework.data.spel.spi.EvaluationContextExtension;
* @author Manuel Núñez Sánchez (manuel.nunez@hawkore.com)
*/
public class SampleEvaluationContextExtension implements EvaluationContextExtension {
-
+ /** */
private static final SamplePassParamExtension SAMPLE_PASS_PARAM_EXTENSION_INSTANCE = new SamplePassParamExtension();
+ /** */
private static final Map<String, Object> properties = new HashMap<>();
+ /** */
private static final String SAMPLE_EXTENSION_SPEL_VAR = "sampleExtension";
static {
properties.put(SAMPLE_EXTENSION_SPEL_VAR, SAMPLE_PASS_PARAM_EXTENSION_INSTANCE);
}
+ /** */
@Override public String getExtensionId() {
return "HK-SAMPLE-PASS-PARAM-EXTENSION";
}
+ /** */
@Override public Map<String, Object> getProperties() {
return properties;
}
+ /** */
public static class SamplePassParamExtension {
-
// just return same param
+ /** */
public Object transformParam(Object param) {
return param;
}
-
}
-
}