branch develop-1.1.x updated (6c11f3cf -> eef56902)
This is an automated email from the git hooks/post-receive script. New change to branch develop-1.1.x in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from 6c11f3cf Code coverage back into place new eef56902 Fixes #10165 - 2000 parameters in SQL Query in AD update The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit eef56902c1d7edb63be3d02ef0f9db88d4be5742 Author: jcouteau <couteau@codelutin.com> Date: Mon Dec 3 16:13:58 2018 +0100 Fixes #10165 - 2000 parameters in SQL Query in AD update Summary of changes: .../services/service/LdapServiceImpl.java | 66 +++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop-1.1.x in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit eef56902c1d7edb63be3d02ef0f9db88d4be5742 Author: jcouteau <couteau@codelutin.com> Date: Mon Dec 3 16:13:58 2018 +0100 Fixes #10165 - 2000 parameters in SQL Query in AD update --- .../services/service/LdapServiceImpl.java | 66 +++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java index 023992bb..80567837 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapServiceImpl.java @@ -44,6 +44,7 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; +import java.util.AbstractList; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -125,7 +126,11 @@ public class LdapServiceImpl extends FaxToMailServiceSupport implements LdapServ } // make remaining user and groups in database as 'hidden' - Collection<FaxToMailUser> usersToHide = faxtomailUserDao.forNotIn(userCache.values()); + List<List<FaxToMailUser>> partitionedUserCache = partition(new ArrayList<>(userCache.values()), 1990); + Collection<FaxToMailUser> usersToHide = new ArrayList<>(); + for (List<FaxToMailUser> userCacheValues:partitionedUserCache){ + usersToHide.addAll(faxtomailUserDao.forNotIn(userCacheValues)); + } for (FaxToMailUser userToHide : usersToHide) { userToHide.setHidden(true); faxtomailUserDao.update(userToHide); @@ -443,4 +448,63 @@ public class LdapServiceImpl extends FaxToMailServiceSupport implements LdapServ return result; } + + public List<FaxToMailUser> getUsersForGroup(FaxToMailUserGroup group){ + FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao(); + + List<FaxToMailUser> users = faxtomailUserDao.forUserGroupsContains(group).findAll(); + return users; + + } + + public static <T> List<List<T>> partition(List<T> list, int size) { + + if (list == null) + throw new NullPointerException( + "'list' must not be null"); + if (!(size > 0)) + throw new IllegalArgumentException( + "'size' must be greater than 0"); + + return new Partition<>(list, size); + } + + private static class Partition<T> extends AbstractList<List<T>> { + + final List<T> list; + final int size; + + Partition(List<T> list, int size) { + this.list = list; + this.size = size; + } + + @Override + public List<T> get(int index) { + int listSize = size(); + if (listSize < 0) + throw new IllegalArgumentException("negative size: " + listSize); + if (index < 0) + throw new IndexOutOfBoundsException( + "index " + index + " must not be negative"); + if (index >= listSize) + throw new IndexOutOfBoundsException( + "index " + index + " must be less than size " + listSize); + int start = index * size; + int end = Math.min(start + size, list.size()); + return list.subList(start, end); + } + + @Override + public int size() { + return (list.size() + size - 1) / size; + } + + @Override + public boolean isEmpty() { + return list.isEmpty(); + } + } } + + -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm