mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix a couple of minor issues with sites search REST API (no results were being returned)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29213 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -810,7 +810,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
|
|||||||
*/
|
*/
|
||||||
public List<SiteInfo> listSites(String nameFilter, String sitePresetFilter)
|
public List<SiteInfo> listSites(String nameFilter, String sitePresetFilter)
|
||||||
{
|
{
|
||||||
return listSites(nameFilter, sitePresetFilter, 0);
|
return listSites(nameFilter, sitePresetFilter, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -828,7 +828,7 @@ public class SiteServiceImpl extends AbstractLifecycleBean implements SiteServic
|
|||||||
|
|
||||||
List<Pair<QName, Boolean>> sortProps = null;
|
List<Pair<QName, Boolean>> sortProps = null;
|
||||||
|
|
||||||
PagingRequest pagingRequest = new PagingRequest(size == 0 ? Integer.MAX_VALUE : size);
|
PagingRequest pagingRequest = new PagingRequest(size <= 0 ? Integer.MAX_VALUE : size);
|
||||||
List<FilterProp> filterProps = new ArrayList<FilterProp>();
|
List<FilterProp> filterProps = new ArrayList<FilterProp>();
|
||||||
|
|
||||||
if (filterHasValue)
|
if (filterHasValue)
|
||||||
|
@@ -161,15 +161,15 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
|
|||||||
* If no filters are specified then all the available sites are returned.
|
* If no filters are specified then all the available sites are returned.
|
||||||
*
|
*
|
||||||
* @param filter inclusion filter for returned sites. Only sites whose cm:name OR cm:title
|
* @param filter inclusion filter for returned sites. Only sites whose cm:name OR cm:title
|
||||||
* OR cm:description CONTAIN the filter string will be returned.
|
* OR cm:description start with the filter string will be returned.
|
||||||
* @param sitePresetFilter site preset filter
|
* @param sitePresetFilter site preset filter
|
||||||
* @return Site[] a list of the site filtered as appropriate
|
* @return Site[] a list of the site filtered as appropriate
|
||||||
*
|
*
|
||||||
* @see SiteService#findSites(String, String, int) for a description of the limitations of this method.
|
* @see SiteService#listSites(String, String, int) for a description of the limitations of this method.
|
||||||
*/
|
*/
|
||||||
public Site[] listSites(String filter, String sitePresetFilter)
|
public Site[] listSites(String filter, String sitePresetFilter)
|
||||||
{
|
{
|
||||||
return listSites(filter, sitePresetFilter, 0);
|
return listSites(filter, sitePresetFilter, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,6 +179,26 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
|
|||||||
* If no filters are specified then all the available sites are returned.
|
* If no filters are specified then all the available sites are returned.
|
||||||
*
|
*
|
||||||
* @param filter inclusion filter for returned sites. Only sites whose cm:name OR cm:title
|
* @param filter inclusion filter for returned sites. Only sites whose cm:name OR cm:title
|
||||||
|
* OR cm:description start with the filter string will be returned.
|
||||||
|
* @param sitePresetFilter site preset filter
|
||||||
|
* @param size max results size crop if >0
|
||||||
|
* @return Site[] a list of the site filtered as appropriate
|
||||||
|
*
|
||||||
|
* @see SiteService#listSites(String, String, int) for a description of the limitations of this method.
|
||||||
|
*/
|
||||||
|
public Site[] listSites(String filter, String sitePresetFilter, int size)
|
||||||
|
{
|
||||||
|
List<SiteInfo> siteInfos = this.siteService.listSites(filter, sitePresetFilter, size);
|
||||||
|
return makeSitesArray(siteInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find (search) the sites available in the repository. The returned list can optionally be filtered by name and site
|
||||||
|
* preset.
|
||||||
|
* <p/>
|
||||||
|
* If no filters are specified then all the available sites are returned.
|
||||||
|
*
|
||||||
|
* @param filter inclusion filter for returned sites. Only sites whose cm:name OR cm:title
|
||||||
* OR cm:description CONTAIN the filter string will be returned.
|
* OR cm:description CONTAIN the filter string will be returned.
|
||||||
* @param sitePresetFilter site preset filter
|
* @param sitePresetFilter site preset filter
|
||||||
* @param size max results size crop if >0
|
* @param size max results size crop if >0
|
||||||
@@ -186,15 +206,29 @@ public class ScriptSiteService extends BaseScopableProcessorExtension
|
|||||||
* @return Site[] a list of the site filtered as appropriate
|
* @return Site[] a list of the site filtered as appropriate
|
||||||
*
|
*
|
||||||
* @see SiteService#findSites(String, String, int) for a description of the limitations of this method.
|
* @see SiteService#findSites(String, String, int) for a description of the limitations of this method.
|
||||||
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public Site[] listSites(String filter, String sitePresetFilter, int size)
|
public Site[] findSites(String filter, String sitePresetFilter, int size)
|
||||||
{
|
{
|
||||||
List<SiteInfo> siteInfos = this.siteService.findSites(filter, sitePresetFilter, size);
|
List<SiteInfo> siteInfos = this.siteService.findSites(filter, sitePresetFilter, size);
|
||||||
|
return makeSitesArray(siteInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given List of SiteInfo objects to a JavaScript friendly array
|
||||||
|
* of Site objects.
|
||||||
|
*
|
||||||
|
* @param siteInfos
|
||||||
|
* @return Array of Site objects
|
||||||
|
*/
|
||||||
|
protected Site[] makeSitesArray(List<SiteInfo> siteInfos)
|
||||||
|
{
|
||||||
List<Site> sites = new ArrayList<Site>(siteInfos.size());
|
List<Site> sites = new ArrayList<Site>(siteInfos.size());
|
||||||
for (SiteInfo siteInfo : siteInfos)
|
for (SiteInfo siteInfo : siteInfos)
|
||||||
{
|
{
|
||||||
sites.add(new Site(siteInfo, this.serviceRegistry, this.siteService, getScope()));
|
sites.add(new Site(siteInfo, this.serviceRegistry, this.siteService, getScope()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sites.toArray(new Site[sites.size()]);
|
return sites.toArray(new Site[sites.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,6 +57,24 @@ function testListSites()
|
|||||||
// TODO .. check the filters
|
// TODO .. check the filters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testFindSites()
|
||||||
|
{
|
||||||
|
// Find all the sites
|
||||||
|
var sites = siteService.findSites(null, null, -1);
|
||||||
|
test.assertEquals(preexistingSiteCount + 2, sites.length);
|
||||||
|
|
||||||
|
// find all sites with "short" in the name
|
||||||
|
sites = siteService.findSites("short", null, -1);
|
||||||
|
test.assertEquals(2, sites.length);
|
||||||
|
|
||||||
|
sites = siteService.findSites("short", null, 0);
|
||||||
|
test.assertEquals(2, sites.length);
|
||||||
|
|
||||||
|
// find just one site with "short" in the name
|
||||||
|
sites = siteService.findSites("short", null, 1);
|
||||||
|
test.assertEquals(1, sites.length);
|
||||||
|
}
|
||||||
|
|
||||||
function testMembership()
|
function testMembership()
|
||||||
{
|
{
|
||||||
var site = siteService.getSite("siteShortName");
|
var site = siteService.getSite("siteShortName");
|
||||||
@@ -207,6 +225,7 @@ function testSiteCustomProperties()
|
|||||||
// Execute test's
|
// Execute test's
|
||||||
testCRUD();
|
testCRUD();
|
||||||
testListSites();
|
testListSites();
|
||||||
|
testFindSites();
|
||||||
testMembership();
|
testMembership();
|
||||||
testContainer();
|
testContainer();
|
||||||
testPermissions();
|
testPermissions();
|
||||||
|
Reference in New Issue
Block a user