branch develop updated (64360fdc -> 5e632aa0)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from 64360fdc [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 5e632aa0 fixes #9794 - Dans la partie recherche la recherche de code client prend plus de temps que dans l’autre menu. 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 5e632aa094ae48bacd34713d02006fda62553eaa Author: jcouteau <couteau@codelutin.com> Date: Wed Jun 6 17:22:05 2018 +0200 fixes #9794 - Dans la partie recherche la recherche de code client prend plus de temps que dans l’autre menu. A tester sur l'env de test FF Summary of changes: .../persistence/entities/ClientTopiaDao.java | 22 ++++++++++++++ .../faxtomail/services/service/ClientService.java | 2 ++ .../services/service/ClientServiceImpl.java | 24 +++++++++++++++ .../ui/swing/content/search/SearchUIHandler.java | 35 +++++++++++++++++++--- 4 files changed, 79 insertions(+), 4 deletions(-) -- 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 in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 5e632aa094ae48bacd34713d02006fda62553eaa Author: jcouteau <couteau@codelutin.com> Date: Wed Jun 6 17:22:05 2018 +0200 fixes #9794 - Dans la partie recherche la recherche de code client prend plus de temps que dans l’autre menu. A tester sur l'env de test FF --- .../persistence/entities/ClientTopiaDao.java | 22 ++++++++++++++ .../faxtomail/services/service/ClientService.java | 2 ++ .../services/service/ClientServiceImpl.java | 24 +++++++++++++++ .../ui/swing/content/search/SearchUIHandler.java | 35 +++++++++++++++++++--- 4 files changed, 79 insertions(+), 4 deletions(-) diff --git a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java index b18b1086..2fff4f96 100644 --- a/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java +++ b/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java @@ -30,6 +30,7 @@ import org.apache.commons.lang3.StringUtils; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; public class ClientTopiaDao extends AbstractClientTopiaDao<Client> { @@ -75,6 +76,27 @@ public class ClientTopiaDao extends AbstractClientTopiaDao<Client> { return findAll(query, args); } + public List<Client> forCompanyInFiltered(Set<String> companies, String filter) { + String query = "FROM " + Client.class.getName() + + " WHERE " + Client.PROPERTY_COMPANY + " IN ( :companyValues ) " + + " AND (UPPER(" + Client.PROPERTY_NAME + ") LIKE :propValue" + + " OR UPPER(" + Client.PROPERTY_CODE + ") LIKE :propValue )"; + + StringBuilder companyValuesBuilder = new StringBuilder(); + + for (String company:companies){ + companyValuesBuilder.append(company).append(","); + } + + companyValuesBuilder.deleteCharAt(companyValuesBuilder.length()-1); + + + Map<String, Object> args = new HashMap<>(); + args.put("propValue", "%" + filter.toUpperCase() + "%"); + args.put("companyValues", companyValuesBuilder.toString()); + return findAll(query, args); + } + public List<Client> forEmailAddressOrCodeLike(String searchQuery) { Preconditions.checkArgument(StringUtils.isNotBlank(searchQuery), "Empty query can produce unexcepted results"); diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java index c2ddd45a..aa3fc4a5 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java @@ -49,5 +49,7 @@ public interface ClientService extends FaxToMailService { List<Client> getAllClientsForUser(FaxToMailUser currentUser); + List<Client> getAllClientsForUserFilter(FaxToMailUser user, String filter); + List<Client> getAllClientsForEmailOrFax(String query); } diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java index 73199c3e..6a24ed5a 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java @@ -347,6 +347,30 @@ public class ClientServiceImpl extends FaxToMailServiceSupport implements Client return result; } + @Override + public List<Client> getAllClientsForUserFilter(FaxToMailUser user, String filter) { + List<MailFolder> folders = getMailFolderService().getRootMailFoldersWithReadingRights(user); + Set<String> companies = new HashSet<>(); + + for (MailFolder folder : folders) { + + MailFolder folderWithCompany = folder; + while (!folderWithCompany.isUseCurrentLevelCompany() && folderWithCompany != null) { + folderWithCompany = folderWithCompany.getParent(); + } + + if (folderWithCompany != null) { + companies.add(folderWithCompany.getCompany()); + } + } + + fetchCompaniesFromFolders(folders, companies); + + ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); + List<Client> result = clientDao.forCompanyInFiltered(companies,filter); + return result; + } + @Override public List<Client> getAllClientsForEmailOrFax(String query) { return getPersistenceContext().getClientDao().forEmailAddressOrCodeLike(query); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java index 9ecbaf3e..cfefa1e9 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java @@ -28,6 +28,7 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.HasLabel; import com.franciaflex.faxtomail.persistence.entities.MailField; import com.franciaflex.faxtomail.persistence.entities.SearchFilter; +import com.franciaflex.faxtomail.services.FaxToMailServiceContext; import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext; import com.franciaflex.faxtomail.ui.swing.actions.ShowDemandeListAction; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; @@ -56,6 +57,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Arrays; import java.util.Calendar; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -130,10 +132,35 @@ public class SearchUIHandler extends AbstractFaxToMailDemandListHandler<SearchUI users, model.getReplyBy()); - BeanFilterableComboBox<Client> clientComboBox = ui.getClientComboBox(); - initBeanFilterableComboBox(clientComboBox, - model.getAllowedClients(), - model.getClient()); + final BeanFilterableComboBox<Client> clientComboBox = ui.getClientComboBox(); + clientComboBox.getComboBoxModel().setWildcardCharacter(null); + initBeanFilterableComboBox(clientComboBox, Collections.singletonList(model.getClient()), model.getClient()); + + KeyAdapter clientComboBoxKeyAdapter = new KeyAdapter() { + + @Override + public void keyTyped(KeyEvent e) { + String text = clientComboBox.getComboBoxModel().getFilterText(); + text+=e.getKeyChar(); + + int filterStartChars = getConfig().getClientComboBoxFilterStartChars(); + + if (text.length()==filterStartChars){ + //init list when x chars entered + FaxToMailServiceContext serviceContext = getContext().newServiceContext(); + List<Client> clients = serviceContext.getClientService().getAllClientsForUserFilter(getContext().getCurrentUser(),text); + clientComboBox.getComboBoxModel().removeAllElements(); + clientComboBox.getComboBoxModel().addAllElements(clients); + } else if (text.length()<filterStartChars){ + //empty list if less than x chars + clientComboBox.getComboBoxModel().removeAllElements(); + } else { + // do nothing if more than x chars entered + } + } + }; + + clientComboBox.getCombobox().getEditor().getEditorComponent().addKeyListener(clientComboBoxKeyAdapter); initCheckBoxComboBox(ui.getDocTypeComboBox(), getContext().getDemandTypeCache(), -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm