Project

General

Profile

« Previous | Next » 

Revision f4935f27

Added by Patrick Plitzner about 5 years ago

ref #8041 Use CdmUtils.quoteRegExWithWildcard(pattern) for search string

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/GrantedAuthoritySelectionDialog.java
17 17
import org.springframework.security.core.GrantedAuthority;
18 18

  
19 19
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
20
import eu.etaxonomy.cdm.common.CdmUtils;
20 21
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
21 22
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
22 23
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
......
61 62
		model = new ArrayList<>();
62 63

  
63 64
		for(GrantedAuthorityImpl authority : authorities){
64
		    if ( pattern == null || authority.getAuthority().matches(pattern +".*")){
65
		    if ( pattern == null || authority.getAuthority().matches(CdmUtils.quoteRegExWithWildcard(pattern) +".*")){
65 66
		        model.add(new UuidAndTitleCache<>(GrantedAuthorityImpl.class, authority.getUuid(), authority.getId(), String.format("%s", GrantedAuthorityLabelTextProvider.getText(authority))));
66 67
		    }
67 68
		}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/GroupSelectionDialog.java
16 16
import org.eclipse.swt.widgets.Shell;
17 17

  
18 18
import eu.etaxonomy.cdm.api.service.IGroupService;
19
import eu.etaxonomy.cdm.common.CdmUtils;
19 20
import eu.etaxonomy.cdm.model.common.Group;
20 21
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
21 22
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
......
62 63
		model = new ArrayList<UuidAndTitleCache<Group>>();
63 64

  
64 65
		for(Group group : groups){
65
		    if (pattern == null || group.getName().matches("(?i)"+pattern + ".*")){
66
		    if (pattern == null || group.getName().matches("(?i)"+CdmUtils.quoteRegExWithWildcard(pattern) + ".*")){
66 67
		        model.add(new UuidAndTitleCache<Group>(Group.class, group.getUuid(), group.getId(), String.format("%s", group.getName())));
67 68
		    }
68 69
		}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/UserSelectionDialog.java
16 16
import org.eclipse.swt.widgets.Shell;
17 17

  
18 18
import eu.etaxonomy.cdm.api.service.IUserService;
19
import eu.etaxonomy.cdm.common.CdmUtils;
19 20
import eu.etaxonomy.cdm.model.common.User;
20 21
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
21 22
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
......
68 69
		model = new ArrayList<UuidAndTitleCache<User>>();
69 70

  
70 71
		for(User user : users){
71
		    if (pattern == null || user.getUsername().matches(pattern + ".*")) {
72
		    if (pattern == null || user.getUsername().matches(CdmUtils.quoteRegExWithWildcard(pattern) + ".*")) {
72 73
                model.add(new UuidAndTitleCache<User>(User.class, user.getUuid(), user.getId(), String.format("%s, %s", user.getUsername(), user.getPerson())));
73 74
            }
74 75
		}

Also available in: Unified diff