Skip to content

Commit

Permalink
FMWK-261 Align find APIs to use Query instead of Qualifier (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr authored Nov 9, 2023
1 parent 7ae637f commit 579a204
Show file tree
Hide file tree
Showing 35 changed files with 587 additions and 735 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.aerospike.client.query.ResultSet;
import org.springframework.data.aerospike.core.model.GroupedEntities;
import org.springframework.data.aerospike.core.model.GroupedKeys;
import org.springframework.data.aerospike.query.Qualifier;
import org.springframework.data.aerospike.repository.query.Query;
import org.springframework.data.domain.Sort;
import org.springframework.data.mapping.context.MappingContext;
Expand Down Expand Up @@ -712,11 +711,10 @@ public interface AerospikeOperations {
* @param id The id of the document to find. Must not be {@literal null}.
* @param entityClass The class to extract the Aerospike set from. Must not be {@literal null}.
* @param targetClass The class to map the document to.
* @param qualifiers {@link Qualifier}s provided to build a filter Expression for the query. Optional argument.
* @param query The {@link Query} to filter results. Optional argument (null if no filtering required).
* @return The document from Aerospike, returned document will be mapped to targetClass's type.
*/
<T, S> Object findByIdUsingQualifiers(Object id, Class<T> entityClass, Class<S> targetClass,
Qualifier... qualifiers);
<T, S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, @Nullable Query query);

/**
* Find document by providing id with a given set name.
Expand All @@ -728,11 +726,11 @@ <T, S> Object findByIdUsingQualifiers(Object id, Class<T> entityClass, Class<S>
* {@literal null}.
* @param targetClass The class to map the document to.
* @param setName Set name to find the document from.
* @param qualifiers {@link Qualifier}s provided to build a filter Expression for the query. Optional argument.
* @param query The {@link Query} to filter results. Optional argument (null if no filtering required).
* @return The document from Aerospike, returned document will be mapped to targetClass's type.
*/
<T, S> Object findByIdUsingQualifiers(Object id, Class<T> entityClass, Class<S> targetClass, String setName,
Qualifier... qualifiers);
<T, S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, String setName,
@Nullable Query query);

/**
* Find documents by providing multiple ids, set name will be determined by the given entityClass.
Expand All @@ -742,12 +740,12 @@ <T, S> Object findByIdUsingQualifiers(Object id, Class<T> entityClass, Class<S>
* @param ids The ids of the documents to find. Must not be {@literal null}.
* @param entityClass The class to extract the Aerospike set from. Must not be {@literal null}.
* @param targetClass The class to map the document to.
* @param qualifiers {@link Qualifier}s provided to build a filter Expression for the query. Optional argument.
* @param query The {@link Query} to filter results. Optional argument (null if no filtering required).
* @return The documents from Aerospike, returned documents will be mapped to targetClass's type, if no document
* exists, an empty list is returned.
*/
<T, S> List<?> findByIdsUsingQualifiers(Collection<?> ids, Class<T> entityClass, Class<S> targetClass,
Qualifier... qualifiers);
<T, S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass,
@Nullable Query query);

/**
* Find documents by providing multiple ids with a given set name.
Expand All @@ -759,17 +757,17 @@ <T, S> List<?> findByIdsUsingQualifiers(Collection<?> ids, Class<T> entityClass,
* {@literal null}.
* @param targetClass The class to map the document to.
* @param setName Set name to find the document from.
* @param qualifiers {@link Qualifier}s provided to build a filter Expression for the query. Optional argument.
* @param query The {@link Query} to filter results. Optional argument (null if no filtering required).
* @return The documents from Aerospike, returned documents will be mapped to targetClass's type, if no document
* exists, an empty list is returned.
*/
<T, S> List<?> findByIdsUsingQualifiers(Collection<?> ids, Class<T> entityClass, Class<S> targetClass,
String setName, Qualifier... qualifiers);
<T, S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, String setName,
@Nullable Query query);

/**
* Find documents in the given entityClass's set using a query and map them to the given class type.
*
* @param query The query to filter results. Must not be {@literal null}.
* @param query The {@link Query} to filter results. Must not be {@literal null}.
* @param entityClass The class to extract the Aerospike set from and to map the documents to. Must not be
* {@literal null}.
* @return A Stream of matching documents, returned documents will be mapped to entityClass's type.
Expand All @@ -779,7 +777,7 @@ <T, S> List<?> findByIdsUsingQualifiers(Collection<?> ids, Class<T> entityClass,
/**
* Find documents in the given entityClass's set using a query and map them to the given target class type.
*
* @param query The query to filter results. Must not be {@literal null}.
* @param query The {@link Query} to filter results. Must not be {@literal null}.
* @param entityClass The class to extract the Aerospike set from. Must not be {@literal null}.
* @param targetClass The class to map the document to. Must not be {@literal null}.
* @return A Stream of matching documents, returned documents will be mapped to targetClass's type.
Expand All @@ -789,58 +787,13 @@ <T, S> List<?> findByIdsUsingQualifiers(Collection<?> ids, Class<T> entityClass,
/**
* Find documents in the given set using a query and map them to the given target class type.
*
* @param query The query to filter results. Must not be {@literal null}.
* @param query The {@link Query} to filter results. Must not be {@literal null}.
* @param setName Set name to find the documents in.
* @param targetClass The class to map the document to. Must not be {@literal null}.
* @return A Stream of matching documents, returned documents will be mapped to targetClass's type.
*/
<T> Stream<T> find(Query query, Class<T> targetClass, String setName);

/**
* Find all documents in the given entityClass's set using provided {@link Qualifier}.
*
* @param entityClass The class to extract the Aerospike set from and to map the entity to. Must not be
* {@literal null}.
* @param filter Secondary index filter.
* @param qualifier Qualifier to build filter expressions from. Can contain other qualifiers. Must not be
* {@literal null}. If filter param is null and qualifier has
* {@link Qualifier#getExcludeFilter()} == false, secondary index filter is built based on the
* first processed qualifier.
* @return Stream of entities.
*/
<T> Stream<T> findUsingQualifier(Class<T> entityClass, @Nullable Filter filter, Qualifier qualifier);

/**
* Find all documents in the given entityClass's set using provided {@link Qualifier}.
*
* @param entityClass The class to extract the Aerospike set from and to map the entity to. Must not be
* {@literal null}.
* @param targetClass The class to map the entity to. Must not be {@literal null}.
* @param filter Secondary index filter.
* @param qualifier Qualifier to build filter expressions from. Can contain other qualifiers. Must not be
* {@literal null}. If filter param is null and qualifier has
* {@link Qualifier#getExcludeFilter()} == false, secondary index filter is built based on the
* first processed qualifier.
* @return Stream of entities.
*/
<T, S> Stream<?> findUsingQualifier(Class<T> entityClass, Class<S> targetClass, @Nullable Filter filter,
Qualifier qualifier);

/**
* Find all documents in the given set using provided {@link Qualifier}.
*
* @param targetClass The class to map the entity to. Must not be {@literal null}.
* @param setName Set name to find the documents in.
* @param filter Secondary index filter.
* @param qualifier Qualifier to build filter expressions from. Can contain other qualifiers. Must not be
* {@literal null}. If filter param is null and qualifier has
* {@link Qualifier#getExcludeFilter()} == false, secondary index filter is built based on the
* first processed qualifier.
* @return Stream of entities.
*/
<T> Stream<T> findUsingQualifier(Class<T> targetClass, String setName, @Nullable Filter filter,
Qualifier qualifier);

/**
* Find all documents in the given entityClass's set and map them to the given class type.
*
Expand Down
Loading

0 comments on commit 579a204

Please sign in to comment.