mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged BRANCHES/DEV/V4.1-BUG-FIX to HEAD
39201: Fix for ALF-15097 - Recently Modified Document fails to load - doclist.get.js - Cannot read property 'isWorkingCopy' from undefined 39525: Merged BRANCHES/DEV/V4.1-BUG-FIX to BRANCHES/DEV/V3.4-BUG-FIX 39524: Merged BRANCHES/PATCHES/V3.4.6 to BRANCHES/DEV/V3.4-BUG-FIX 39491: ALF-13404: Another attempt. Still not performing. Giving up on the cm:* idea altogether. 39522: ALF-15215: Missing synchronization in RepositoryContainer.getRegistry() - Possible for multiple threads to all try to reinitialize the web script registry at the same time, resulting in many lucene searches and server overload Hand merged ALF-13404 changes to 4.0 doclib2 scripts. 39600: Fix for ALF-14218 - Fixes the tricky-to-track-down 'WARNING: Parameters: Invalid chunk ignored' message in tomcat logs. 39611: It appears that "-moz-border-radius" has gone the way of the dodo and no longer works in FireFox. So the more correct "border-radius" can now be safely used instead, as Chrome no longer requires "-webkit-border-radius" either. 39660: Fix for ALF-14244 - Sort options are not appropriate for some pre-canned Document Library queries and need disabling in the UI as they can confuse the user. Implemented by Valery Shikunets. 39678: Merged BRANCHES/DEV/V3.4-BUG-FIX to BRANCHES/DEV/V4.1-BUG-FIX 39672: Merged PATCHES/V3.4.6 to BRANCHES/DEV/V3.4-BUG-FIX 39534: ALF-13404: Now we understand it! Content I'm Editing dashlet is non-site specific so should use cm:* in its queries. However, site filters and dashlets should NOT. Hand merged above changes to documentlibrary-v2 filter scripts. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@39874 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -264,7 +264,7 @@ function doclist_main()
|
||||
*/
|
||||
for each (item in items)
|
||||
{
|
||||
if (item.workingCopy.isWorkingCopy)
|
||||
if (item.workingCopy && item.workingCopy.isWorkingCopy)
|
||||
{
|
||||
var workingCopySource = String(item.workingCopy.sourceNodeRef);
|
||||
for (var i = 0, ii = items.length; i < ii; i++)
|
||||
|
@@ -162,6 +162,7 @@ var Filters =
|
||||
|
||||
case "editingOthers":
|
||||
filterQuery = this.constructPathQuery(parsedArgs);
|
||||
filterQuery += " +ASPECT:\"workingcopy\"";
|
||||
filterQuery += " +((-@cm\\:workingCopyOwner:\"" + person.properties.userName + '")';
|
||||
filterQuery += " OR (-@cm\\:lockOwner:\"" + person.properties.userName + '"';
|
||||
filterQuery += " +@cm\\:lockType:\"WRITE_LOCK\"))";
|
||||
@@ -184,7 +185,7 @@ var Filters =
|
||||
// no need to specify path here for all sites - IDs are exact matches
|
||||
if (parsedArgs.nodeRef != "alfresco://sites/home" && parsedArgs.nodeRef != "alfresco://company/home")
|
||||
{
|
||||
filterQuery += ' +PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"';
|
||||
filterQuery += ' +PATH:"' + parsedArgs.rootNode.qnamePath + '//*"';
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -246,13 +247,18 @@ var Filters =
|
||||
constructPathQuery: function constructPathQuery(parsedArgs)
|
||||
{
|
||||
var pathQuery = "";
|
||||
if (parsedArgs.libraryRoot != companyhome)
|
||||
if (parsedArgs.libraryRoot != companyhome || parsedArgs.nodeRef != "alfresco://company/home")
|
||||
{
|
||||
pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"';
|
||||
}
|
||||
else if (parsedArgs.nodeRef != "alfresco://company/home")
|
||||
{
|
||||
pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"';
|
||||
if (parsedArgs.nodeRef == "alfresco://sites/home")
|
||||
{
|
||||
// all sites query - better with //cm:*
|
||||
pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"';
|
||||
}
|
||||
else
|
||||
{
|
||||
// site specific query - better with //*
|
||||
pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//*"';
|
||||
}
|
||||
}
|
||||
return pathQuery;
|
||||
}
|
||||
|
@@ -271,7 +271,7 @@ function getDoclist()
|
||||
*/
|
||||
for each (item in items)
|
||||
{
|
||||
if (item.customObj.isWorkingCopy)
|
||||
if (item.customObj && item.customObj.isWorkingCopy)
|
||||
{
|
||||
var workingCopyOriginal = String(item.customObj.workingCopyOriginal);
|
||||
for (var i = 0, ii = items.length; i < ii; i++)
|
||||
|
@@ -288,8 +288,7 @@ var Evaluator =
|
||||
activeWorkflows: activeWorkflows,
|
||||
custom: jsonUtils.toJSONString(custom),
|
||||
customObj: custom,
|
||||
actionLabels: actionLabels,
|
||||
|
||||
actionLabels: actionLabels
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@@ -152,7 +152,7 @@ var Filters =
|
||||
break;
|
||||
|
||||
case "editingMe":
|
||||
filterQuery = this.constructPathQuery(parsedArgs, true);
|
||||
filterQuery = this.constructPathQuery(parsedArgs);
|
||||
filterQuery += " +((+@cm\\:workingCopyOwner:\"" + person.properties.userName + '")';
|
||||
filterQuery += " OR (+@cm\\:lockOwner:\"" + person.properties.userName + '"';
|
||||
filterQuery += " +@cm\\:lockType:\"WRITE_LOCK\"))";
|
||||
@@ -160,7 +160,8 @@ var Filters =
|
||||
break;
|
||||
|
||||
case "editingOthers":
|
||||
filterQuery = this.constructPathQuery(parsedArgs, true);
|
||||
filterQuery = this.constructPathQuery(parsedArgs);
|
||||
filterQuery += " +ASPECT:\"workingcopy\"";
|
||||
filterQuery += " +((-@cm\\:workingCopyOwner:\"" + person.properties.userName + '")';
|
||||
filterQuery += " OR (-@cm\\:lockOwner:\"" + person.properties.userName + '"';
|
||||
filterQuery += " +@cm\\:lockType:\"WRITE_LOCK\"))";
|
||||
@@ -183,7 +184,7 @@ var Filters =
|
||||
// no need to specify path here for all sites - IDs are exact matches
|
||||
if (parsedArgs.nodeRef != "alfresco://sites/home" && parsedArgs.nodeRef != "alfresco://company/home")
|
||||
{
|
||||
filterQuery += ' +PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"';
|
||||
filterQuery += ' +PATH:"' + parsedArgs.rootNode.qnamePath + '//*"';
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -236,12 +237,21 @@ var Filters =
|
||||
return filterParams;
|
||||
},
|
||||
|
||||
constructPathQuery: function constructPathQuery(parsedArgs, cmonly)
|
||||
constructPathQuery: function constructPathQuery(parsedArgs)
|
||||
{
|
||||
var pathQuery = "";
|
||||
if (parsedArgs.nodeRef != "alfresco://company/home")
|
||||
{
|
||||
pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//' + (cmonly ? 'cm:' : '') + '*"';
|
||||
if (parsedArgs.nodeRef == "alfresco://sites/home")
|
||||
{
|
||||
// all sites query - better with //cm:*
|
||||
pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//cm:*"';
|
||||
}
|
||||
else
|
||||
{
|
||||
// site specific query - better with //*
|
||||
pathQuery = '+PATH:"' + parsedArgs.rootNode.qnamePath + '//*"';
|
||||
}
|
||||
}
|
||||
return pathQuery;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -30,6 +30,8 @@ import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Status;
|
||||
@@ -44,8 +46,8 @@ import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.repo.tenant.TenantDeployer;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.TooBusyException;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.repo.transaction.TooBusyException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.TemplateService;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
@@ -63,6 +65,11 @@ import org.springframework.extensions.webscripts.AbstractRuntimeContainer;
|
||||
import org.springframework.extensions.webscripts.Authenticator;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Description;
|
||||
import org.springframework.extensions.webscripts.Description.FormatStyle;
|
||||
import org.springframework.extensions.webscripts.Description.RequiredAuthentication;
|
||||
import org.springframework.extensions.webscripts.Description.RequiredTransaction;
|
||||
import org.springframework.extensions.webscripts.Description.RequiredTransactionParameters;
|
||||
import org.springframework.extensions.webscripts.Description.TransactionCapability;
|
||||
import org.springframework.extensions.webscripts.Match;
|
||||
import org.springframework.extensions.webscripts.Registry;
|
||||
import org.springframework.extensions.webscripts.Runtime;
|
||||
@@ -73,11 +80,6 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
import org.springframework.extensions.webscripts.WebScriptResponse;
|
||||
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
|
||||
import org.springframework.extensions.webscripts.WrappingWebScriptResponse;
|
||||
import org.springframework.extensions.webscripts.Description.FormatStyle;
|
||||
import org.springframework.extensions.webscripts.Description.RequiredAuthentication;
|
||||
import org.springframework.extensions.webscripts.Description.RequiredTransaction;
|
||||
import org.springframework.extensions.webscripts.Description.RequiredTransactionParameters;
|
||||
import org.springframework.extensions.webscripts.Description.TransactionCapability;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
|
||||
@@ -101,6 +103,7 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
|
||||
private TenantAdminService tenantAdminService;
|
||||
private ObjectFactory registryFactory;
|
||||
private SimpleCache<String, Registry> webScriptsRegistryCache;
|
||||
private ReadWriteLock webScriptsRegistryLock = new ReentrantReadWriteLock();
|
||||
private boolean initialized;
|
||||
|
||||
/**
|
||||
@@ -534,16 +537,40 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten
|
||||
public Registry getRegistry()
|
||||
{
|
||||
String tenantDomain = tenantAdminService.getCurrentUserDomain();
|
||||
Registry registry = webScriptsRegistryCache.get(tenantDomain);
|
||||
Registry registry;
|
||||
webScriptsRegistryLock.readLock().lock();
|
||||
try
|
||||
{
|
||||
registry = webScriptsRegistryCache.get(tenantDomain);
|
||||
}
|
||||
finally
|
||||
{
|
||||
webScriptsRegistryLock.readLock().unlock();
|
||||
}
|
||||
if (registry == null)
|
||||
{
|
||||
registry = (Registry)registryFactory.getObject();
|
||||
// We only need to reset the registry if the superclass thinks its already initialized
|
||||
if (initialized)
|
||||
webScriptsRegistryLock.writeLock().lock();
|
||||
try
|
||||
{
|
||||
registry.reset();
|
||||
// Double check now we have write lock
|
||||
registry = webScriptsRegistryCache.get(tenantDomain);
|
||||
|
||||
// Initialize / reinitialize the registry in this thread only
|
||||
if (registry == null)
|
||||
{
|
||||
registry = (Registry) registryFactory.getObject();
|
||||
// We only need to reset the registry if the superclass thinks its already initialized
|
||||
if (initialized)
|
||||
{
|
||||
registry.reset();
|
||||
}
|
||||
webScriptsRegistryCache.put(tenantDomain, registry);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
webScriptsRegistryLock.writeLock().unlock();
|
||||
}
|
||||
webScriptsRegistryCache.put(tenantDomain, registry);
|
||||
}
|
||||
return registry;
|
||||
}
|
||||
|
Reference in New Issue
Block a user