mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V4.1-BUG-FIX to HEAD
38869: Merged BRANCHES/DEV/AMILLER/CLOUD1 to BRANCHES/DEV/V4.1-BUG-FIX 38762: Site can not be created when (site count) quota exceeded Refactor core code to return "400 - Bad request," with indicative message, when a duplicate url is submitted. 38897: ALF-13969: Tomcat shutdown with WARNING: Problem with directory [/opt/alfresco-4.0.1/tomcat/shared/lib], exists: [false], isDirectory: [false], canRead: [false] - Removed ${catalina.base}/shared/lib/*.jar from shared.loader definition in catalina.properties - Will update Wiki next 38908: Fix for failing test since createSite change 38939: Moved schema version up to 5100 (and 5101 for 'patch.show.audit') 38941: Moved schema version up to 5110 (and 5111 for 'patch.show.audit') ... leave root for V4.1.0.x 38953: ALF-14766: Ensure that DocLib tree drop targets are correctly set after creating new folders 38954: Fix for ALF-14475: "CMIS : Wrong cmisra:numItems in folder sites and below with /cmisatom binding url" 38974: Minor: removed unused code 38987: ALF-13228 - updated manage permissions to handle custom group settings 39006: Fix for ALF-14475 part 2: "CMIS : Wrong cmisra:numItems in folder sites and below with /cmisatom binding url" 39022: Merge solution for ALF-13972 39038: ALF-14388: Merge V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.1) 39037: ALF-15069 CLONE - Edit Online option is not supported for '.docm', 'dotm', '.xlsm' files - Added "Online Edit" support for: docx docm dotx dotm - doc and docx were already supported pptm ppsx ppsm potx potm ppam sldx sldm - ppt and pptx were already supported xltx xlsm xltm xlam xlsb - xls and xlsx were already supported 39065: ALF-14861 SOLR to scale for non-admin users in 100k sites and a subgroup of each of 1000 independent groupings with 1000 subgroups - first round of fixes on the SOLR side - ACL lookup improved and reduced the number of Long objects created - Specific cache and configuration for PATH queries (with admin reporting) - Specfic cache and configuration for AUTHORITY queries (with admin reporting) - PATH and AUTHORITY queries cache the LEAF result (and not the AUX result which requires lots of extra work) - cache works better with lucene query implementation - AUTHORITY query supports AUTHORITIES separated by "|" 39135: Fix for ALF-15071 SOLR: Typographical offence in log output 39152: ALF-13211: Accepted path for preventing NPE when viewing JBPM sub-process which has no start-task 39175: Merge DEV to V4.1-BUG-FIX (4.1.1) 39161: ALF-14956 : Folder within a Folder navigation issue. Fix for browsing to folders from not first page of a parent folder. 39191: ALF-14863: no scope is available when ScriptNode is used from within Activiti expression, causes issue when scope is needed (eg. creating javascript-arrays) + fixed typo in activiti-source jars 39192: Fix for ALF-12209 Incorrect behavior on View Realtionship for the user who has no permissions - skip relationships to objects that can not be seen. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@40263 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -814,6 +814,7 @@
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
<property name="lockService" ref="LockService" />
|
||||
<property name="checkOutCheckInService" ref="CheckoutCheckinService" />
|
||||
<property name="policyBehaviourFilter" ref="policyBehaviourFilter" />
|
||||
</bean>
|
||||
|
||||
<bean id="checkedOutAspect" class="org.alfresco.repo.coci.CheckedOutAspect" init-method="init">
|
||||
|
@@ -80,7 +80,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean name="fileFolderGetChildrenCannedQueryFactory" class="org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory">
|
||||
<bean name="fileFolderGetChildrenCannedQueryFactory" class="org.alfresco.repo.model.filefolder.GetChildrenCannedQueryFactory">
|
||||
<property name="registry" ref="fileFolderCannedQueryRegistry"/>
|
||||
<property name="dictionaryService" ref="dictionaryService"/>
|
||||
<property name="tenantService" ref="tenantService"/>
|
||||
@@ -90,6 +90,7 @@
|
||||
<property name="contentDataDAO" ref="contentDataDAO"/>
|
||||
<property name="cannedQueryDAO" ref="cannedQueryDAO"/>
|
||||
<property name="methodSecurity" ref="FileFolderService_security_list"/>
|
||||
<property name="hiddenAspect" ref="hiddenAspect"/>
|
||||
</bean>
|
||||
|
||||
<bean id="mlTranslationInterceptor" class="org.alfresco.repo.model.filefolder.MLTranslationInterceptor" >
|
||||
|
@@ -61,6 +61,7 @@ import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.repo.security.permissions.PermissionReference;
|
||||
import org.alfresco.repo.security.permissions.impl.AccessPermissionImpl;
|
||||
import org.alfresco.repo.security.permissions.impl.ModelDAO;
|
||||
@@ -1618,6 +1619,15 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
{
|
||||
// ignore objects that have not been found (perhaps because their type is unknown to CMIS)
|
||||
}
|
||||
catch (AccessDeniedException e)
|
||||
{
|
||||
// skip
|
||||
}
|
||||
// TODO: Somewhere this has not been wrapped correctly
|
||||
catch (net.sf.acegisecurity.AccessDeniedException e)
|
||||
{
|
||||
// skip
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -264,6 +264,11 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
||||
{
|
||||
objecVariant = CMISObjectVariant.PERMISSION_DENIED;
|
||||
}
|
||||
// TODO: Somewhere this has not been wrapped correctly
|
||||
catch (net.sf.acegisecurity.AccessDeniedException e)
|
||||
{
|
||||
objecVariant = CMISObjectVariant.PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
protected void analyseNodeRef()
|
||||
|
@@ -20,6 +20,7 @@ package org.alfresco.repo.coci;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -462,6 +463,7 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
|
||||
*/
|
||||
public void testAutoCancelCheckOut()
|
||||
{
|
||||
Date modifiedDateBeforeCheckOut = (Date) this.nodeService.getProperty(this.nodeRef, ContentModel.PROP_MODIFIED);
|
||||
NodeRef workingCopy = checkout();
|
||||
assertNotNull(workingCopy);
|
||||
|
||||
@@ -475,9 +477,15 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
|
||||
// Good the original is locked
|
||||
}
|
||||
|
||||
try {Thread.sleep(2000); } catch (InterruptedException e) {}
|
||||
|
||||
// Delete the working copy
|
||||
nodeService.deleteNode(workingCopy);
|
||||
|
||||
//Make sure that modidied date wasn't changed
|
||||
Date modifiedDateAfterCheckOut = (Date) this.nodeService.getProperty(this.nodeRef, ContentModel.PROP_MODIFIED);
|
||||
assertEquals(modifiedDateBeforeCheckOut, modifiedDateAfterCheckOut);
|
||||
|
||||
// The original should no longer be locked
|
||||
this.lockService.checkForLock(this.nodeRef);
|
||||
|
||||
|
@@ -29,6 +29,7 @@ import org.alfresco.repo.copy.CopyDetails;
|
||||
import org.alfresco.repo.copy.CopyServicePolicies;
|
||||
import org.alfresco.repo.copy.DefaultCopyBehaviourCallback;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
@@ -44,6 +45,8 @@ public class WorkingCopyAspect implements CopyServicePolicies.OnCopyNodePolicy
|
||||
private NodeService nodeService;
|
||||
private LockService lockService;
|
||||
private CheckOutCheckInService checkOutCheckInService;
|
||||
private BehaviourFilter policyBehaviourFilter;
|
||||
|
||||
|
||||
/**
|
||||
* The working copy aspect copy behaviour callback.
|
||||
@@ -82,6 +85,14 @@ public class WorkingCopyAspect implements CopyServicePolicies.OnCopyNodePolicy
|
||||
this.checkOutCheckInService = checkOutCheckInService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param policyBehaviourFilter
|
||||
*/
|
||||
public void setPolicyBehaviourFilter(BehaviourFilter policyBehaviourFilter)
|
||||
{
|
||||
this.policyBehaviourFilter = policyBehaviourFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise method
|
||||
*/
|
||||
@@ -118,10 +129,18 @@ public class WorkingCopyAspect implements CopyServicePolicies.OnCopyNodePolicy
|
||||
{
|
||||
NodeRef checkedOutNodeRef = checkOutCheckInService.getCheckedOut(nodeRef);
|
||||
if (checkedOutNodeRef != null)
|
||||
{
|
||||
policyBehaviourFilter.disableBehaviour(checkedOutNodeRef, ContentModel.ASPECT_AUDITABLE);
|
||||
try
|
||||
{
|
||||
lockService.unlock(checkedOutNodeRef);
|
||||
nodeService.removeAspect(checkedOutNodeRef, ContentModel.ASPECT_CHECKED_OUT);
|
||||
}
|
||||
finally
|
||||
{
|
||||
policyBehaviourFilter.enableBehaviour(checkedOutNodeRef, ContentModel.ASPECT_AUDITABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -240,15 +240,10 @@ public class FileFolderServiceImpl implements FileFolderService
|
||||
private List<FileInfo> toFileInfo(List<NodeRef> nodeRefs) throws InvalidTypeException
|
||||
{
|
||||
List<FileInfo> results = new ArrayList<FileInfo>(nodeRefs.size());
|
||||
Client client = FileFilterMode.getClient();
|
||||
for (NodeRef nodeRef : nodeRefs)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(hiddenAspect.getVisibility(client, nodeRef) == Visibility.NotVisible)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
FileInfo fileInfo = toFileInfo(nodeRef, true);
|
||||
results.add(fileInfo);
|
||||
}
|
||||
@@ -396,14 +391,8 @@ public class FileFolderServiceImpl implements FileFolderService
|
||||
}
|
||||
|
||||
final List<FileInfo> nodeInfos = new ArrayList<FileInfo>(nodeRefs.size());
|
||||
final Client client = FileFilterMode.getClient();
|
||||
for (NodeRef nodeRef : nodeRefs)
|
||||
{
|
||||
if(hiddenAspect.getVisibility(client, nodeRef) == Visibility.NotVisible)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
nodeInfos.add(toFileInfo(nodeRef, true));
|
||||
}
|
||||
PermissionCheckedCollectionMixin.create(nodeInfos, nodeRefs);
|
||||
|
@@ -70,7 +70,10 @@ import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.alfresco.util.FileFilterMode;
|
||||
import org.alfresco.util.FileFilterMode.Client;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
@@ -1369,4 +1372,49 @@ public class FileFolderServiceImplTest extends TestCase
|
||||
assertNotNull(pagingResults.getPage());
|
||||
assertEquals(1, pagingResults.getPage().size());
|
||||
}
|
||||
|
||||
public void testListHiddenFiles()
|
||||
{
|
||||
// Test that hidden files are not returned for clients that should not be able to see them,
|
||||
// and that the total result count is correct.
|
||||
|
||||
Client saveClient = FileFilterMode.setClient(Client.webdav);
|
||||
try
|
||||
{
|
||||
// create some hidden files
|
||||
NodeRef nodeRef = fileFolderService.create(workingRootNodeRef, "" + System.currentTimeMillis(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
NodeRef nodeRef1 = fileFolderService.create(nodeRef, "parent", ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
fileFolderService.create(nodeRef1, ".child" + i, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
}
|
||||
|
||||
// and some visible files
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
fileFolderService.create(nodeRef1, "visiblechild" + i, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
}
|
||||
|
||||
// switch to a client that should not see the hidden files
|
||||
saveClient = FileFilterMode.setClient(Client.cmis);
|
||||
PagingRequest pagingRequest = new PagingRequest(0, Integer.MAX_VALUE);
|
||||
pagingRequest.setRequestTotalCountMax(10000); // need this so that total count is set
|
||||
|
||||
PagingResults<FileInfo> results = fileFolderService.list(nodeRef1, true, true, null, null, pagingRequest);
|
||||
Pair<Integer, Integer> totalResultCount = results.getTotalResultCount();
|
||||
assertNotNull(totalResultCount.getFirst());
|
||||
assertEquals("Total result lower count should be 10", 10, totalResultCount.getFirst().intValue());
|
||||
assertNotNull(totalResultCount.getSecond());
|
||||
assertEquals("Total result upper count should be 10", 10, totalResultCount.getSecond().intValue());
|
||||
for(FileInfo fileInfo : results.getPage())
|
||||
{
|
||||
assertTrue(fileInfo.getName().startsWith("visiblechild"));
|
||||
}
|
||||
assertEquals("Expected only 10 results", 10, results.getPage().size());
|
||||
}
|
||||
finally
|
||||
{
|
||||
FileFilterMode.setClient(saveClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.model.filefolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.query.CannedQueryParameters;
|
||||
import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.domain.node.NodePropertyHelper;
|
||||
import org.alfresco.repo.domain.qname.QNameDAO;
|
||||
import org.alfresco.repo.domain.query.CannedQueryDAO;
|
||||
import org.alfresco.repo.model.filefolder.HiddenAspect.Visibility;
|
||||
import org.alfresco.repo.node.getchildren.FilterProp;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.util.FileFilterMode;
|
||||
import org.alfresco.util.FileFilterMode.Client;
|
||||
|
||||
/**
|
||||
* GetChidren canned query for files and folders.
|
||||
*
|
||||
* To get paged list of files and folders of a parent folder filtered by child type.
|
||||
* Also optionally filtered and/or sorted by one or more properties (up to three).
|
||||
*
|
||||
* This is the same as the nodes getchildren canned query, except it takes into account hidden files and folders.
|
||||
*
|
||||
* @since 4.1.1
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class GetChildrenCannedQuery extends org.alfresco.repo.node.getchildren.GetChildrenCannedQuery
|
||||
{
|
||||
private HiddenAspect hiddenAspect;
|
||||
|
||||
public GetChildrenCannedQuery(
|
||||
NodeDAO nodeDAO,
|
||||
QNameDAO qnameDAO,
|
||||
CannedQueryDAO cannedQueryDAO,
|
||||
NodePropertyHelper nodePropertyHelper,
|
||||
TenantService tenantService,
|
||||
MethodSecurityBean<NodeRef> methodSecurity,
|
||||
CannedQueryParameters params,
|
||||
HiddenAspect hiddenAspect)
|
||||
{
|
||||
super(nodeDAO, qnameDAO, cannedQueryDAO, nodePropertyHelper, tenantService, methodSecurity, params);
|
||||
this.hiddenAspect = hiddenAspect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UnsortedChildQueryCallback getUnsortedChildQueryCallback(final List<NodeRef> rawResult, final int requestedCount)
|
||||
{
|
||||
UnsortedChildQueryCallback callback = new FileFolderUnsortedChildQueryCallback(rawResult, requestedCount);
|
||||
return callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FilterSortChildQueryCallback getFilterSortChildQuery(final List<FilterSortNode> children, final List<FilterProp> filterProps)
|
||||
{
|
||||
FilterSortChildQueryCallback callback = new FileFolderFilterSortChildQueryCallback(children, filterProps);
|
||||
return callback;
|
||||
}
|
||||
|
||||
private class FileFolderFilterSortChildQueryCallback extends DefaultFilterSortChildQueryCallback
|
||||
{
|
||||
public FileFolderFilterSortChildQueryCallback(List<FilterSortNode> children, List<FilterProp> filterProps)
|
||||
{
|
||||
super(children, filterProps);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean include(FilterSortNode node)
|
||||
{
|
||||
boolean ret = super.include(node);
|
||||
|
||||
// only visible files are returned, relative to the client type.
|
||||
try
|
||||
{
|
||||
final Client client = FileFilterMode.getClient();
|
||||
return ret && hiddenAspect.getVisibility(client, node.getNodeRef()) != Visibility.NotVisible;
|
||||
}
|
||||
catch(AccessDeniedException e)
|
||||
{
|
||||
// user may not have permission to determine the visibility of the node
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class FileFolderUnsortedChildQueryCallback extends DefaultUnsortedChildQueryCallback
|
||||
{
|
||||
public FileFolderUnsortedChildQueryCallback(List<NodeRef> rawResult,int requestedCount)
|
||||
{
|
||||
super(rawResult, requestedCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean include(NodeRef nodeRef)
|
||||
{
|
||||
boolean ret = super.include(nodeRef);
|
||||
|
||||
// only visible files are returned, relative to the client type.
|
||||
try
|
||||
{
|
||||
final Client client = FileFilterMode.getClient();
|
||||
return ret && hiddenAspect.getVisibility(client, nodeRef) != Visibility.NotVisible;
|
||||
}
|
||||
catch(AccessDeniedException e)
|
||||
{
|
||||
// user may not have permission to determine the visibility of the node
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.model.filefolder;
|
||||
|
||||
import org.alfresco.query.CannedQuery;
|
||||
import org.alfresco.query.CannedQueryParameters;
|
||||
import org.alfresco.repo.domain.node.NodePropertyHelper;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* GetChidren canned query factory for files and folders.
|
||||
*
|
||||
* @since 4.1.1
|
||||
* @author steveglover
|
||||
*
|
||||
*/
|
||||
public class GetChildrenCannedQueryFactory extends org.alfresco.repo.node.getchildren.GetChildrenCannedQueryFactory
|
||||
{
|
||||
private HiddenAspect hiddenAspect;
|
||||
|
||||
public void setHiddenAspect(HiddenAspect hiddenAspect)
|
||||
{
|
||||
this.hiddenAspect = hiddenAspect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CannedQuery<NodeRef> getCannedQuery(CannedQueryParameters parameters)
|
||||
{
|
||||
NodePropertyHelper nodePropertyHelper = new NodePropertyHelper(dictionaryService, qnameDAO, localeDAO, contentDataDAO);
|
||||
|
||||
return (CannedQuery<NodeRef>) new GetChildrenCannedQuery(nodeDAO, qnameDAO, cannedQueryDAO, nodePropertyHelper, tenantService, methodSecurity, parameters, hiddenAspect);
|
||||
}
|
||||
}
|
@@ -125,6 +125,18 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
}
|
||||
}
|
||||
|
||||
protected FilterSortChildQueryCallback getFilterSortChildQuery(final List<FilterSortNode> children, final List<FilterProp> filterProps)
|
||||
{
|
||||
FilterSortChildQueryCallback callback = new DefaultFilterSortChildQueryCallback(children, filterProps);
|
||||
return callback;
|
||||
}
|
||||
|
||||
protected UnsortedChildQueryCallback getUnsortedChildQueryCallback(final List<NodeRef> rawResult, final int requestedCount)
|
||||
{
|
||||
UnsortedChildQueryCallback callback = new DefaultUnsortedChildQueryCallback(rawResult, requestedCount);
|
||||
return callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<NodeRef> queryAndFilter(CannedQueryParameters parameters)
|
||||
{
|
||||
@@ -228,25 +240,8 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
{
|
||||
// filtered and/or sorted - note: permissions will be applied post query
|
||||
final List<FilterSortNode> children = new ArrayList<FilterSortNode>(100);
|
||||
|
||||
final boolean applyFilter = (filterProps.size() > 0);
|
||||
|
||||
FilterSortChildQueryCallback callback = new FilterSortChildQueryCallback()
|
||||
{
|
||||
public boolean handle(FilterSortNode node)
|
||||
{
|
||||
// filter, if needed
|
||||
if ((! applyFilter) || includeFilter(node.getPropVals(), filterProps))
|
||||
{
|
||||
children.add(node);
|
||||
}
|
||||
|
||||
// More results
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
FilterSortResultHandler resultHandler = new FilterSortResultHandler(callback);
|
||||
final FilterSortChildQueryCallback c = getFilterSortChildQuery(children, filterProps);
|
||||
FilterSortResultHandler resultHandler = new FilterSortResultHandler(c);
|
||||
cannedQueryDAO.executeQuery(QUERY_NAMESPACE, QUERY_SELECT_GET_CHILDREN_WITH_PROPS, params, 0, Integer.MAX_VALUE, resultHandler);
|
||||
resultHandler.done();
|
||||
|
||||
@@ -269,17 +264,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
final int requestedCount = parameters.getResultsRequired();
|
||||
|
||||
final List<NodeRef> rawResult = new ArrayList<NodeRef>(Math.min(1000, requestedCount));
|
||||
UnsortedChildQueryCallback callback = new UnsortedChildQueryCallback()
|
||||
{
|
||||
public boolean handle(NodeRef nodeRef)
|
||||
{
|
||||
rawResult.add(tenantService.getBaseName(nodeRef));
|
||||
|
||||
// More results ?
|
||||
return (rawResult.size() < requestedCount);
|
||||
}
|
||||
};
|
||||
|
||||
UnsortedChildQueryCallback callback = getUnsortedChildQueryCallback(rawResult, requestedCount);
|
||||
UnsortedResultHandler resultHandler = new UnsortedResultHandler(callback);
|
||||
cannedQueryDAO.executeQuery(QUERY_NAMESPACE, QUERY_SELECT_GET_CHILDREN_WITHOUT_PROPS, params, 0, Integer.MAX_VALUE, resultHandler);
|
||||
resultHandler.done();
|
||||
@@ -545,17 +530,78 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
}
|
||||
}
|
||||
|
||||
private interface FilterSortChildQueryCallback
|
||||
protected interface FilterSortChildQueryCallback
|
||||
{
|
||||
boolean handle(FilterSortNode node);
|
||||
}
|
||||
|
||||
private interface UnsortedChildQueryCallback
|
||||
protected class DefaultFilterSortChildQueryCallback implements FilterSortChildQueryCallback
|
||||
{
|
||||
private List<FilterSortNode> children;
|
||||
private List<FilterProp> filterProps;
|
||||
private boolean applyFilter;
|
||||
|
||||
public DefaultFilterSortChildQueryCallback(final List<FilterSortNode> children, final List<FilterProp> filterProps)
|
||||
{
|
||||
this.children = children;
|
||||
this.filterProps = filterProps;
|
||||
this.applyFilter = (filterProps.size() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(FilterSortNode node)
|
||||
{
|
||||
if(include(node))
|
||||
{
|
||||
children.add(node);
|
||||
}
|
||||
|
||||
// More results
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean include(FilterSortNode node)
|
||||
{
|
||||
// filter, if needed
|
||||
return(!applyFilter || includeFilter(node.getPropVals(), filterProps));
|
||||
}
|
||||
}
|
||||
|
||||
protected class DefaultUnsortedChildQueryCallback implements UnsortedChildQueryCallback
|
||||
{
|
||||
private List<NodeRef> rawResult;
|
||||
private int requestedCount;
|
||||
|
||||
public DefaultUnsortedChildQueryCallback(final List<NodeRef> rawResult, final int requestedCount)
|
||||
{
|
||||
this.rawResult = rawResult;
|
||||
this.requestedCount = requestedCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeRef nodeRef)
|
||||
{
|
||||
if(include(nodeRef))
|
||||
{
|
||||
rawResult.add(tenantService.getBaseName(nodeRef));
|
||||
}
|
||||
|
||||
// More results ?
|
||||
return (rawResult.size() < requestedCount);
|
||||
}
|
||||
|
||||
protected boolean include(NodeRef nodeRef)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected interface UnsortedChildQueryCallback
|
||||
{
|
||||
boolean handle(NodeRef nodeRef);
|
||||
}
|
||||
|
||||
private class FilterSortResultHandler implements CannedQueryDAO.ResultHandler<FilterSortNodeEntity>
|
||||
protected class FilterSortResultHandler implements CannedQueryDAO.ResultHandler<FilterSortNodeEntity>
|
||||
{
|
||||
private final FilterSortChildQueryCallback resultsCallback;
|
||||
private boolean more = true;
|
||||
@@ -656,7 +702,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
}
|
||||
}
|
||||
|
||||
private class FilterSortNode
|
||||
protected class FilterSortNode
|
||||
{
|
||||
private NodeRef nodeRef;
|
||||
private Map<QName, Serializable> propVals; // subset of nodes properties - used for filtering and/or sorting
|
||||
|
@@ -52,15 +52,15 @@ import org.alfresco.util.PropertyCheck;
|
||||
*/
|
||||
public class GetChildrenCannedQueryFactory extends AbstractCannedQueryFactory<NodeRef>
|
||||
{
|
||||
private DictionaryService dictionaryService;
|
||||
private NodeDAO nodeDAO;
|
||||
private QNameDAO qnameDAO;
|
||||
private LocaleDAO localeDAO;
|
||||
private ContentDataDAO contentDataDAO;
|
||||
private CannedQueryDAO cannedQueryDAO;
|
||||
private TenantService tenantService;
|
||||
protected DictionaryService dictionaryService;
|
||||
protected NodeDAO nodeDAO;
|
||||
protected QNameDAO qnameDAO;
|
||||
protected LocaleDAO localeDAO;
|
||||
protected ContentDataDAO contentDataDAO;
|
||||
protected CannedQueryDAO cannedQueryDAO;
|
||||
protected TenantService tenantService;
|
||||
|
||||
private MethodSecurityBean<NodeRef> methodSecurity;
|
||||
protected MethodSecurityBean<NodeRef> methodSecurity;
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
|
@@ -176,12 +176,10 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
|
||||
}
|
||||
|
||||
// put the server into read-only mode for the duration
|
||||
boolean allowWrite = !transactionService.isReadOnly();
|
||||
try
|
||||
{
|
||||
if (lockServer)
|
||||
{
|
||||
|
||||
// set the server into read-only mode
|
||||
transactionService.setAllowWrite(false, vetoName);
|
||||
}
|
||||
@@ -224,7 +222,6 @@ public class FullIndexRecoveryComponent extends AbstractReindexComponent
|
||||
// restore read-only state
|
||||
transactionService.setAllowWrite(true, vetoName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -155,7 +155,7 @@ public class SolrBackupClient implements InitializingBean
|
||||
}
|
||||
catch(SolrServerException e)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Bakup for core "+core+ " feailed .... ", e);
|
||||
throw new AlfrescoRuntimeException("Backup for core "+core+ " failed .... ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user