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