Skip to content

Commit c78fe9a

Browse files
committed
Adapt repository to List-based interface variants.
Closes #306
1 parent fa405e6 commit c78fe9a

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

src/main/java/org/springframework/data/ldap/repository/LdapRepository.java

+3-11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import javax.naming.Name;
2222

2323
import org.springframework.data.repository.CrudRepository;
24+
import org.springframework.data.repository.ListCrudRepository;
2425
import org.springframework.ldap.query.LdapQuery;
2526

2627
/**
@@ -29,16 +30,7 @@
2930
* @author Mattias Hellborg Arthursson
3031
* @author Mark Paluch
3132
*/
32-
public interface LdapRepository<T> extends CrudRepository<T, Name> {
33-
34-
@Override
35-
<S extends T> List<S> saveAll(Iterable<S> entities);
36-
37-
@Override
38-
List<T> findAll();
39-
40-
@Override
41-
List<T> findAllById(Iterable<Name> names);
33+
public interface LdapRepository<T> extends ListCrudRepository<T, Name> {
4234

4335
/**
4436
* Find one entry matching the specified query.
@@ -55,5 +47,5 @@ public interface LdapRepository<T> extends CrudRepository<T, Name> {
5547
* @param ldapQuery the query specification.
5648
* @return the entries matching the query.
5749
*/
58-
Iterable<T> findAll(LdapQuery ldapQuery);
50+
List<T> findAll(LdapQuery ldapQuery);
5951
}

src/main/java/org/springframework/data/ldap/repository/query/PartTreeLdapRepositoryQuery.java

-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.springframework.data.mapping.PersistentProperty;
2323
import org.springframework.data.mapping.context.MappingContext;
2424
import org.springframework.data.mapping.model.EntityInstantiators;
25-
import org.springframework.data.repository.query.Parameters;
2625
import org.springframework.data.repository.query.RepositoryQuery;
2726
import org.springframework.data.repository.query.ReturnedType;
2827
import org.springframework.data.repository.query.parser.PartTree;
@@ -39,7 +38,6 @@
3938
public class PartTreeLdapRepositoryQuery extends AbstractLdapRepositoryQuery {
4039

4140
private final PartTree partTree;
42-
private final Parameters<?, ?> parameters;
4341
private final ObjectDirectoryMapper objectDirectoryMapper;
4442

4543
/**
@@ -58,7 +56,6 @@ public PartTreeLdapRepositoryQuery(LdapQueryMethod queryMethod, Class<?> entityT
5856
super(queryMethod, entityType, ldapOperations, mappingContext, instantiators);
5957

6058
partTree = new PartTree(queryMethod.getName(), entityType);
61-
parameters = queryMethod.getParameters();
6259
objectDirectoryMapper = ldapOperations.getObjectDirectoryMapper();
6360
}
6461

src/main/java/org/springframework/data/ldap/repository/support/QuerydslLdapPredicateExecutor.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.springframework.data.mapping.model.EntityInstantiators;
3939
import org.springframework.data.projection.ProjectionFactory;
4040
import org.springframework.data.projection.ProjectionInformation;
41+
import org.springframework.data.querydsl.ListQuerydslPredicateExecutor;
4142
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
4243
import org.springframework.data.repository.core.EntityInformation;
4344
import org.springframework.data.repository.query.FluentQuery;
@@ -56,7 +57,7 @@
5657
* @author Mark Paluch
5758
* @since 2.6
5859
*/
59-
public class QuerydslLdapPredicateExecutor<T> implements QuerydslPredicateExecutor<T> {
60+
public class QuerydslLdapPredicateExecutor<T> implements ListQuerydslPredicateExecutor<T> {
6061

6162
private final EntityInformation<T, ?> entityInformation;
6263
private final ProjectionFactory projectionFactory;
@@ -129,7 +130,7 @@ public boolean exists(Predicate predicate) {
129130
return findBy(predicate, FluentQuery.FetchableFluentQuery::exists);
130131
}
131132

132-
public Iterable<T> findAll(Predicate predicate, Sort sort) {
133+
public List<T> findAll(Predicate predicate, Sort sort) {
133134

134135
Assert.notNull(sort, "Pageable must not be null!");
135136

@@ -140,7 +141,7 @@ public Iterable<T> findAll(Predicate predicate, Sort sort) {
140141
throw new UnsupportedOperationException("Sorting is not supported");
141142
}
142143

143-
public Iterable<T> findAll(OrderSpecifier<?>... orders) {
144+
public List<T> findAll(OrderSpecifier<?>... orders) {
144145

145146
if (orders.length == 0) {
146147
return findAll();
@@ -150,7 +151,7 @@ public Iterable<T> findAll(OrderSpecifier<?>... orders) {
150151
}
151152

152153
@Override
153-
public Iterable<T> findAll(Predicate predicate, OrderSpecifier<?>... orders) {
154+
public List<T> findAll(Predicate predicate, OrderSpecifier<?>... orders) {
154155

155156
if (orders.length == 0) {
156157
return findAll(predicate);

0 commit comments

Comments
 (0)