mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
PR comments requested change
This commit is contained in:
@@ -3,7 +3,7 @@ function main()
|
||||
// Get the args
|
||||
var siteShortName = url.templateArgs.shortname,
|
||||
site = siteService.getSite(siteShortName),
|
||||
filter = (args.filter != null) ? args.filter + " [hint:useCQ]" : (args.shortNameFilter != null) ? args.shortNameFilter : "",
|
||||
filter = ((args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "" )+ " [hint:useCQ]",
|
||||
maxResults = (args.maxResults == null) ? 10 : parseInt(args.maxResults, 10),
|
||||
authorityType = args.authorityType,
|
||||
zone = args.zone,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -316,7 +316,7 @@ public class People extends BaseScopableProcessorExtension implements Initializi
|
||||
* could not be created
|
||||
*/
|
||||
public ScriptNode createPerson(String userName, String firstName, String lastName, String emailAddress,
|
||||
String password, boolean setAccountEnabled, boolean notifyByEmail)
|
||||
String password, boolean setAccountEnabled, boolean notifyByEmail)
|
||||
{
|
||||
ParameterCheck.mandatory("firstName", firstName);
|
||||
ParameterCheck.mandatory("emailAddress", emailAddress);
|
||||
@@ -677,21 +677,21 @@ public class People extends BaseScopableProcessorExtension implements Initializi
|
||||
List<Pair<QName,Boolean>> sort = new ArrayList<Pair<QName,Boolean>>();
|
||||
if ("lastName".equals(sortBy))
|
||||
{
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_LASTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_FIRSTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_USERNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_LASTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_FIRSTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_USERNAME, sortAsc));
|
||||
}
|
||||
else if ("firstName".equals(sortBy))
|
||||
{
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_FIRSTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_LASTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_USERNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_FIRSTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_LASTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_USERNAME, sortAsc));
|
||||
}
|
||||
else
|
||||
{
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_USERNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_FIRSTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_LASTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_USERNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_FIRSTNAME, sortAsc));
|
||||
sort.add(new Pair<QName, Boolean>(ContentModel.PROP_LASTNAME, sortAsc));
|
||||
}
|
||||
|
||||
return personService.getPeople(filter, filterProps, sort, pagingRequest).getPage();
|
||||
@@ -791,7 +791,7 @@ public class People extends BaseScopableProcessorExtension implements Initializi
|
||||
// fts-alfresco property search i.e. "location:maidenhead"
|
||||
propIndex = token.lastIndexOf(':');
|
||||
query.append(token.substring(0, propIndex + 1)).append('"')
|
||||
.append(token.substring(propIndex + 1)).append('"').append(' ');
|
||||
.append(token.substring(propIndex + 1)).append('"').append(' ');
|
||||
|
||||
propertySearch = true;
|
||||
}
|
||||
@@ -810,18 +810,18 @@ public class People extends BaseScopableProcessorExtension implements Initializi
|
||||
}
|
||||
query.append(")");
|
||||
|
||||
// define the search parameters
|
||||
params.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
||||
params.addStore(this.storeRef);
|
||||
params.setQuery(query.toString());
|
||||
// define the search parameters
|
||||
params.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
|
||||
params.addStore(this.storeRef);
|
||||
params.setQuery(query.toString());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
if ((sortBy != null) && (! sortBy.isEmpty()))
|
||||
{
|
||||
logger.debug("getPeopleImplSearch: ignoring sortBy ("+sortBy+")- not yet supported by model for search");
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
if ((sortBy != null) && (! sortBy.isEmpty()))
|
||||
{
|
||||
logger.debug("getPeopleImplSearch: ignoring sortBy ("+sortBy+")- not yet supported by model for search");
|
||||
}
|
||||
}
|
||||
|
||||
/* not yet supported (default property index tokenisation mode = true)
|
||||
if ("lastName".equals(sortBy))
|
||||
@@ -844,47 +844,47 @@ public class People extends BaseScopableProcessorExtension implements Initializi
|
||||
}
|
||||
*/
|
||||
|
||||
if (maxResults > 0)
|
||||
{
|
||||
params.setLimitBy(LimitBy.FINAL_SIZE);
|
||||
params.setLimit(maxResults);
|
||||
}
|
||||
if (maxResults > 0)
|
||||
{
|
||||
params.setLimitBy(LimitBy.FINAL_SIZE);
|
||||
params.setLimit(maxResults);
|
||||
}
|
||||
|
||||
if (skipCount > 0)
|
||||
{
|
||||
params.setSkipCount(skipCount);
|
||||
}
|
||||
if (skipCount > 0)
|
||||
{
|
||||
params.setSkipCount(skipCount);
|
||||
}
|
||||
|
||||
ResultSet results = null;
|
||||
try
|
||||
{
|
||||
results = services.getSearchService().query(params);
|
||||
ResultSet results = null;
|
||||
try
|
||||
{
|
||||
results = services.getSearchService().query(params);
|
||||
|
||||
personRefs = getSortedPeopleObjects(results.getNodeRefs(), sortBy, sortAsc);
|
||||
personRefs = getSortedPeopleObjects(results.getNodeRefs(), sortBy, sortAsc);
|
||||
|
||||
if (start != null)
|
||||
{
|
||||
logger.debug("getPeople: search - "+personRefs.size()+" items (in "+(System.currentTimeMillis()-start)+" msecs)");
|
||||
}
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Failed to execute people search: " + query.toString(), err);
|
||||
}
|
||||
if (start != null)
|
||||
{
|
||||
logger.debug("getPeople: search - "+personRefs.size()+" items (in "+(System.currentTimeMillis()-start)+" msecs)");
|
||||
}
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Failed to execute people search: " + query.toString(), err);
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (results != null)
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (results != null)
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
|
||||
return personRefs;
|
||||
return personRefs;
|
||||
}
|
||||
|
||||
private List<NodeRef> getSortedPeopleObjects(List<NodeRef> peopleRefs, final String sortBy, Boolean sortAsc)
|
||||
@@ -974,16 +974,16 @@ public class People extends BaseScopableProcessorExtension implements Initializi
|
||||
*/
|
||||
public ScriptNode getPerson(final String username)
|
||||
{
|
||||
NodeRef personRef = null;
|
||||
NodeRef personRef = null;
|
||||
|
||||
ParameterCheck.mandatory("Username", username);
|
||||
try
|
||||
{
|
||||
personRef = personService.getPersonOrNull(username);
|
||||
personRef = personService.getPersonOrNull(username);
|
||||
}
|
||||
catch(AccessDeniedException e)
|
||||
{
|
||||
// ok, just return null to indicate not found
|
||||
// ok, just return null to indicate not found
|
||||
}
|
||||
|
||||
return personRef == null ? null : new ScriptNode(personRef, services, getScope());
|
||||
|
Reference in New Issue
Block a user