mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
65735: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (4.3/Cloud) 65518: Merged DEV to V4.2-BUG-FIX (4.2.2) 62566 : MNT-8804 : CMIS and WebScript inconsistent behavior with corrupt indexes - Filter not existing nodes in CMIS layer git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@66265 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -31,10 +31,13 @@ import org.alfresco.cmis.CMISResultSet;
|
|||||||
import org.alfresco.cmis.CMISScope;
|
import org.alfresco.cmis.CMISScope;
|
||||||
import org.alfresco.cmis.CMISServices;
|
import org.alfresco.cmis.CMISServices;
|
||||||
import org.alfresco.cmis.CMISQueryOptions.CMISQueryMode;
|
import org.alfresco.cmis.CMISQueryOptions.CMISQueryMode;
|
||||||
|
import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet;
|
||||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryEngine;
|
import org.alfresco.repo.search.impl.querymodel.QueryEngine;
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryEngineResults;
|
import org.alfresco.repo.search.impl.querymodel.QueryEngineResults;
|
||||||
|
import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSet;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.search.LimitBy;
|
import org.alfresco.service.cmr.search.LimitBy;
|
||||||
import org.alfresco.service.cmr.search.ResultSet;
|
import org.alfresco.service.cmr.search.ResultSet;
|
||||||
@@ -133,7 +136,7 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
|||||||
ResultSet current = map.get(group);
|
ResultSet current = map.get(group);
|
||||||
for (String selector : group)
|
for (String selector : group)
|
||||||
{
|
{
|
||||||
wrapped.put(selector, current);
|
wrapped.put(selector, filterNotExistingNodes(current));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LimitBy limitBy = null;
|
LimitBy limitBy = null;
|
||||||
@@ -144,6 +147,32 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
|||||||
CMISResultSet cmis = new CMISResultSetImpl(wrapped, options, limitBy, nodeService, query, cmisDictionaryService, alfrescoDictionaryService);
|
CMISResultSet cmis = new CMISResultSetImpl(wrapped, options, limitBy, nodeService, query, cmisDictionaryService, alfrescoDictionaryService);
|
||||||
return cmis;
|
return cmis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MNT-8804 filter ResultSet for nodes with corrupted indexes */
|
||||||
|
private ResultSet filterNotExistingNodes(ResultSet resultSet)
|
||||||
|
{
|
||||||
|
if (resultSet instanceof PagingLuceneResultSet)
|
||||||
|
{
|
||||||
|
ResultSet wrapped = ((PagingLuceneResultSet)resultSet).getWrapped();
|
||||||
|
|
||||||
|
if (wrapped instanceof FilteringResultSet)
|
||||||
|
{
|
||||||
|
FilteringResultSet filteringResultSet = (FilteringResultSet)wrapped;
|
||||||
|
|
||||||
|
for (int i = 0; i < filteringResultSet.length(); i++)
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = filteringResultSet.getNodeRef(i);
|
||||||
|
/* filter node if it does not exist */
|
||||||
|
if (!nodeService.exists(nodeRef))
|
||||||
|
{
|
||||||
|
filteringResultSet.setIncluded(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultSet;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@@ -24,10 +24,13 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||||
import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode;
|
import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode;
|
||||||
|
import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet;
|
||||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryEngine;
|
import org.alfresco.repo.search.impl.querymodel.QueryEngine;
|
||||||
import org.alfresco.repo.search.impl.querymodel.QueryEngineResults;
|
import org.alfresco.repo.search.impl.querymodel.QueryEngineResults;
|
||||||
|
import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSet;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.LimitBy;
|
import org.alfresco.service.cmr.search.LimitBy;
|
||||||
@@ -110,7 +113,7 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
|||||||
ResultSet current = map.get(group);
|
ResultSet current = map.get(group);
|
||||||
for (String selector : group)
|
for (String selector : group)
|
||||||
{
|
{
|
||||||
wrapped.put(selector, current);
|
wrapped.put(selector, filterNotExistingNodes(current));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LimitBy limitBy = null;
|
LimitBy limitBy = null;
|
||||||
@@ -123,6 +126,32 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
|||||||
alfrescoDictionaryService);
|
alfrescoDictionaryService);
|
||||||
return cmis;
|
return cmis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MNT-8804 filter ResultSet for nodes with corrupted indexes */
|
||||||
|
private ResultSet filterNotExistingNodes(ResultSet resultSet)
|
||||||
|
{
|
||||||
|
if (resultSet instanceof PagingLuceneResultSet)
|
||||||
|
{
|
||||||
|
ResultSet wrapped = ((PagingLuceneResultSet)resultSet).getWrapped();
|
||||||
|
|
||||||
|
if (wrapped instanceof FilteringResultSet)
|
||||||
|
{
|
||||||
|
FilteringResultSet filteringResultSet = (FilteringResultSet)wrapped;
|
||||||
|
|
||||||
|
for (int i = 0; i < filteringResultSet.length(); i++)
|
||||||
|
{
|
||||||
|
NodeRef nodeRef = filteringResultSet.getNodeRef(i);
|
||||||
|
/* filter node if it does not exist */
|
||||||
|
if (!nodeService.exists(nodeRef))
|
||||||
|
{
|
||||||
|
filteringResultSet.setIncluded(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultSet;
|
||||||
|
}
|
||||||
|
|
||||||
public CMISResultSet query(String query, StoreRef storeRef)
|
public CMISResultSet query(String query, StoreRef storeRef)
|
||||||
{
|
{
|
||||||
|
@@ -64,7 +64,7 @@ public class FilteringResultSet extends ACLEntryAfterInvocationProvider implemen
|
|||||||
return unfiltered;
|
return unfiltered;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */void setIncluded(int i, boolean excluded)
|
public void setIncluded(int i, boolean excluded)
|
||||||
{
|
{
|
||||||
inclusionMask.set(i, excluded);
|
inclusionMask.set(i, excluded);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user