Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

91880: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud)
      91761: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1)
         91686: Merged V4.2.4 (4.2.4) to V4.2-BUG-FIX (4.2.5)
            91643: Merged DEV to V4.2.4-PATCHES
               91252: MNT-12037: CLONE - User search does not return results with "<firstname> <lastname>" search in admin console users page.
                - Split entered pattern into parts and return users that match each part. 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94839 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 11:40:47 +00:00
parent 6538fd25d3
commit ff24f64c17
2 changed files with 21 additions and 10 deletions

View File

@@ -27,20 +27,23 @@
</if> </if>
where where
assoc.parent_node_id = #{parentNodeId} assoc.parent_node_id = #{parentNodeId}
<foreach item="item" index="index" collection="pattern" open=" " separator=" " close=" ">
<if test="prop1qnameId != null or prop2qnameId != null or prop3qnameId != null ">
and lower(concat(
</if>
<if test="prop1qnameId != null"> <if test="prop1qnameId != null">
and prop1.string_value, ' ',
(
lower(prop1.string_value) like lower(#{pattern}) <include refid="alfresco.util.escape"/>
</if> </if>
<if test="prop2qnameId != null"> <if test="prop2qnameId != null">
or lower(prop2.string_value) like lower(#{pattern}) <include refid="alfresco.util.escape"/> prop2.string_value, ' ',
</if> </if>
<if test="prop3qnameId != null"> <if test="prop3qnameId != null">
or lower(prop3.string_value) like lower(#{pattern}) <include refid="alfresco.util.escape"/> prop3.string_value, ' ',
</if> </if>
<if test="prop1qnameId != null"> <if test="prop1qnameId != null or prop2qnameId != null or prop3qnameId != null ">
) ' ')) like lower(#{item}) <include refid="alfresco.util.escape"/>
</if> </if>
</foreach>
<if test="includeAspectIds != null"> <if test="includeAspectIds != null">
and exists ( and exists (
select * select *

View File

@@ -18,6 +18,7 @@
*/ */
package org.alfresco.repo.security.person; package org.alfresco.repo.security.person;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -42,7 +43,7 @@ public class FilterSortPersonEntity
private Long prop3qnameId = null; private Long prop3qnameId = null;
private Boolean sort3asc = null; private Boolean sort3asc = null;
private String pattern; private List<String> pattern;
private List<Long> includeAspectIds; private List<Long> includeAspectIds;
private List<Long> excludeAspectIds; private List<Long> excludeAspectIds;
@@ -65,7 +66,7 @@ public class FilterSortPersonEntity
this.parentNodeId = parentNodeId; this.parentNodeId = parentNodeId;
} }
public String getPattern() public List<String> getPattern()
{ {
return pattern; return pattern;
} }
@@ -93,13 +94,20 @@ public class FilterSortPersonEntity
public void setPattern(String pattern) public void setPattern(String pattern)
{ {
this.pattern = new ArrayList<String>();
if (pattern != null) if (pattern != null)
{ {
// escape the '%' character with '\' (standard SQL escape character) // escape the '%' character with '\' (standard SQL escape character)
//pattern = escape(pattern, '%'); //pattern = escape(pattern, '%');
// replace the wildcard character '*' with the one used in database queries i.e. '%' // replace the wildcard character '*' with the one used in database queries i.e. '%'
this.pattern = pattern.replace('*', '%'); pattern = pattern.replace('*', '%');
String[] parts = pattern.split(" ");
for(String part:parts)
{
this.pattern.add("%" + part + "%");
}
} }
} }