Skip to content

Commit a7dd511

Browse files
schaudermp911de
authored andcommitted
DATALDAP-181 - Implement CrudRepository.deleteAllById(Iterable<ID> ids).
Original pull request: #20.
1 parent cd226e3 commit a7dd511

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@
1515
*/
1616
package org.springframework.data.ldap.repository.support;
1717

18-
import static org.springframework.ldap.query.LdapQueryBuilder.*;
19-
20-
import java.util.List;
21-
import java.util.Optional;
22-
import java.util.stream.Collectors;
23-
import java.util.stream.StreamSupport;
24-
25-
import javax.naming.Name;
26-
2718
import org.springframework.dao.EmptyResultDataAccessException;
2819
import org.springframework.data.domain.Persistable;
2920
import org.springframework.data.ldap.repository.LdapRepository;
@@ -37,6 +28,14 @@
3728
import org.springframework.ldap.query.LdapQuery;
3829
import org.springframework.util.Assert;
3930

31+
import javax.naming.Name;
32+
import java.util.List;
33+
import java.util.Optional;
34+
import java.util.stream.Collectors;
35+
import java.util.stream.StreamSupport;
36+
37+
import static org.springframework.ldap.query.LdapQueryBuilder.*;
38+
4039
/**
4140
* Base repository implementation for LDAP.
4241
*
@@ -56,8 +55,8 @@ public class SimpleLdapRepository<T> implements LdapRepository<T> {
5655
* Creates a new {@link SimpleLdapRepository}.
5756
*
5857
* @param ldapOperations must not be {@literal null}.
59-
* @param odm must not be {@literal null}.
60-
* @param entityType must not be {@literal null}.
58+
* @param odm must not be {@literal null}.
59+
* @param entityType must not be {@literal null}.
6160
*/
6261
public SimpleLdapRepository(LdapOperations ldapOperations, ObjectDirectoryMapper odm, Class<T> entityType) {
6362

@@ -222,9 +221,20 @@ public void delete(T entity) {
222221
*/
223222
@Override
224223
public void deleteAll(Iterable<? extends T> entities) {
224+
225+
Assert.notNull(entities, "Entities must not be null.");
226+
225227
entities.forEach(this::delete);
226228
}
227229

230+
@Override
231+
public void deleteAllById(Iterable<? extends Name> names) {
232+
233+
Assert.notNull(names, "Names must not be null.");
234+
235+
names.forEach(this::deleteById);
236+
}
237+
228238
/* (non-Javadoc)
229239
* @see org.springframework.data.repository.CrudRepository#deleteAll()
230240
*/

0 commit comments

Comments
 (0)