mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
. Optimize ApplicationScriptUtils.toJSON() - threadlocal cache for namespace resolution to avoid DD access, smarter retrieval of cm:person properties - 40% quicker or more in some cases
. Convert short qnames to long qnames in our templates to avoid DD access to resolve full qnames . Optimize out N+1 queries from calling RatingService.getRating() unless the document has at least one Like (which is available in the rolled up property already present on the node) - up to 99% quicker when building "Likes" JSON structure...! . Added new optimized method to FileFolderService to retrieve a cm:name based path - only the String for each path element not the full FileInfo structure for each (avoid full getProperties() - 70% quicker to build webdav URL overall before/after to retrieve doclist2 script (8x concurrent threads x25 repeats etc.) Before: 1030ms After: 645ms Also improves original doclist script (used by dashlets) and single node retrievals. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@47448 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -267,7 +267,7 @@ function doclist_main()
|
|||||||
item.location = location;
|
item.location = location;
|
||||||
|
|
||||||
// Check: thumbnail type is registered && node is a cm:content subtype
|
// Check: thumbnail type is registered && node is a cm:content subtype
|
||||||
if (isThumbnailNameRegistered && item.node.isSubType("cm:content"))
|
if (isThumbnailNameRegistered && item.node.isSubType("{http://www.alfresco.org/model/content/1.0}content"))
|
||||||
{
|
{
|
||||||
// Make sure we have a thumbnail.
|
// Make sure we have a thumbnail.
|
||||||
thumbnail = item.node.getThumbnail(THUMBNAIL_NAME);
|
thumbnail = item.node.getThumbnail(THUMBNAIL_NAME);
|
||||||
|
@@ -57,12 +57,12 @@ var Evaluator =
|
|||||||
*/
|
*/
|
||||||
case "document":
|
case "document":
|
||||||
// Working Copy?
|
// Working Copy?
|
||||||
if (node.hasAspect("cm:workingcopy"))
|
if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}workingcopy"))
|
||||||
{
|
{
|
||||||
var wcNode = node.assocs["cm:original"][0];
|
var wcNode = node.assocs["cm:original"][0];
|
||||||
workingCopy["isWorkingCopy"] = true;
|
workingCopy["isWorkingCopy"] = true;
|
||||||
workingCopy["sourceNodeRef"] = wcNode.nodeRef;
|
workingCopy["sourceNodeRef"] = wcNode.nodeRef;
|
||||||
if (wcNode.hasAspect("cm:versionable"))
|
if (wcNode.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable"))
|
||||||
{
|
{
|
||||||
workingCopy["workingCopyVersion"] = wcNode.properties["cm:versionLabel"];
|
workingCopy["workingCopyVersion"] = wcNode.properties["cm:versionLabel"];
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ var Evaluator =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Locked?
|
// Locked?
|
||||||
else if (node.isLocked && !node.hasAspect("trx:transferred") && node.hasAspect("cm:checkedOut"))
|
else if (node.isLocked && !node.hasAspect("trx:transferred") && node.hasAspect("{http://www.alfresco.org/model/content/1.0}checkedOut"))
|
||||||
{
|
{
|
||||||
var srcNode = node.assocs["cm:workingcopylink"][0];
|
var srcNode = node.assocs["cm:workingcopylink"][0];
|
||||||
workingCopy["hasWorkingCopy"] = true;
|
workingCopy["hasWorkingCopy"] = true;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<#macro itemJSON item>
|
<#macro itemJSON item>
|
||||||
<#local node = item.node>
|
<#local node = item.node>
|
||||||
<#local version = "1.0">
|
<#local version = "1.0">
|
||||||
<#if node.hasAspect("cm:versionable")><#local version = node.properties["cm:versionLabel"]!""></#if>
|
<#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")><#local version = node.properties["cm:versionLabel"]!""></#if>
|
||||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"webdavUrl": "${node.webdavUrl}",
|
"webdavUrl": "${node.webdavUrl}",
|
||||||
|
@@ -168,8 +168,8 @@ var Common =
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
isLiked = ratingService.getRating(node, LIKES_SCHEME) !== -1;
|
|
||||||
totalLikes = ratingService.getRatingsCount(node, LIKES_SCHEME);
|
totalLikes = ratingService.getRatingsCount(node, LIKES_SCHEME);
|
||||||
|
isLiked = totalLikes === 0 ? false : ratingService.getRating(node, LIKES_SCHEME) !== -1;
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
|
@@ -151,7 +151,7 @@ var Evaluator =
|
|||||||
Evaluator.documentAndFolder(node, permissions, status, actionLabels);
|
Evaluator.documentAndFolder(node, permissions, status, actionLabels);
|
||||||
|
|
||||||
// Working Copy?
|
// Working Copy?
|
||||||
if (node.hasAspect("cm:workingcopy"))
|
if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}workingcopy"))
|
||||||
{
|
{
|
||||||
var wcStatus = "";
|
var wcStatus = "";
|
||||||
lockedBy = Common.getPerson(node.properties["cm:workingCopyOwner"]);
|
lockedBy = Common.getPerson(node.properties["cm:workingCopyOwner"]);
|
||||||
@@ -169,7 +169,7 @@ var Evaluator =
|
|||||||
var wcNode = node.assocs["cm:original"][0];
|
var wcNode = node.assocs["cm:original"][0];
|
||||||
custom["isWorkingCopy"] = true;
|
custom["isWorkingCopy"] = true;
|
||||||
custom["workingCopyOriginal"] = wcNode.nodeRef;
|
custom["workingCopyOriginal"] = wcNode.nodeRef;
|
||||||
if (wcNode.hasAspect("cm:versionable"))
|
if (wcNode.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable"))
|
||||||
{
|
{
|
||||||
custom["workingCopyVersion"] = wcNode.properties["cm:versionLabel"];
|
custom["workingCopyVersion"] = wcNode.properties["cm:versionLabel"];
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ var Evaluator =
|
|||||||
else if (node.isLocked && !node.hasAspect("trx:transferred"))
|
else if (node.isLocked && !node.hasAspect("trx:transferred"))
|
||||||
{
|
{
|
||||||
var lockStatus = "";
|
var lockStatus = "";
|
||||||
lockedBy = Common.getPerson(node.properties["cm:lockOwner"]);
|
lockedBy = Common.getPerson(node.properties["{http://www.alfresco.org/model/content/1.0}lockOwner"]);
|
||||||
lockOwnerUser = lockedBy.userName;
|
lockOwnerUser = lockedBy.userName;
|
||||||
if (lockOwnerUser == person.properties.userName)
|
if (lockOwnerUser == person.properties.userName)
|
||||||
{
|
{
|
||||||
@@ -210,7 +210,7 @@ var Evaluator =
|
|||||||
lockStatus = "locked " + lockedBy.displayName + "|" + lockedBy.userName;
|
lockStatus = "locked " + lockedBy.displayName + "|" + lockedBy.userName;
|
||||||
actionSet = "locked";
|
actionSet = "locked";
|
||||||
}
|
}
|
||||||
if (node.hasAspect("cm:checkedOut"))
|
if (node.hasAspect("{http://www.alfresco.org/model/content/1.0}checkedOut"))
|
||||||
{
|
{
|
||||||
var srcNode = node.assocs["cm:workingcopylink"][0];
|
var srcNode = node.assocs["cm:workingcopylink"][0];
|
||||||
custom["hasWorkingCopy"] = true;
|
custom["hasWorkingCopy"] = true;
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
<#local node = item.node>
|
<#local node = item.node>
|
||||||
<#local version = "1.0">
|
<#local version = "1.0">
|
||||||
<#if node.hasAspect("cm:versionable")><#local version = node.properties["cm:versionLabel"]!""></#if>
|
<#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}versionable")><#local version = node.properties["cm:versionLabel"]!""></#if>
|
||||||
<#if item.createdBy??>
|
<#if item.createdBy??>
|
||||||
<#local createdBy = item.createdBy.displayName>
|
<#local createdBy = item.createdBy.displayName>
|
||||||
<#local createdByUser = item.createdBy.userName>
|
<#local createdByUser = item.createdBy.userName>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"linkedNodeRef": "${item.linkedNode.nodeRef?string}",
|
"linkedNodeRef": "${item.linkedNode.nodeRef?string}",
|
||||||
</#if>
|
</#if>
|
||||||
"fileName": "<#if item.linkedNode??>${item.linkedNode.name}<#else>${node.name}</#if>",
|
"fileName": "<#if item.linkedNode??>${item.linkedNode.name}<#else>${node.name}</#if>",
|
||||||
"displayName": "<#if item.linkedNode??>${item.linkedNode.name}<#elseif node.hasAspect("cm:workingcopy")>${node.name?replace(workingCopyLabel, "")}<#else>${node.name}</#if>",
|
"displayName": "<#if item.linkedNode??>${item.linkedNode.name}<#elseif node.hasAspect("{http://www.alfresco.org/model/content/1.0}workingcopy")>${node.name?replace(workingCopyLabel, "")}<#else>${node.name}</#if>",
|
||||||
"status": "<#list item.status?keys as s><#if item.status[s]?is_boolean && item.status[s] == true>${s}<#if s_has_next>,</#if></#if></#list>",
|
"status": "<#list item.status?keys as s><#if item.status[s]?is_boolean && item.status[s] == true>${s}<#if s_has_next>,</#if></#if></#list>",
|
||||||
"title": "${node.properties.title!""}",
|
"title": "${node.properties.title!""}",
|
||||||
"description": "${node.properties.description!""}",
|
"description": "${node.properties.description!""}",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"modifiedOn": "<@dateFormat node.properties.modified />",
|
"modifiedOn": "<@dateFormat node.properties.modified />",
|
||||||
"modifiedBy": "${modifiedBy}",
|
"modifiedBy": "${modifiedBy}",
|
||||||
"modifiedByUser": "${modifiedByUser}",
|
"modifiedByUser": "${modifiedByUser}",
|
||||||
<#if node.hasAspect("cm:thumbnailModification")>
|
<#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}thumbnailModification")>
|
||||||
<#list node.properties.lastThumbnailModification as thumbnailMod>
|
<#list node.properties.lastThumbnailModification as thumbnailMod>
|
||||||
<#if thumbnailMod?contains("doclib")>
|
<#if thumbnailMod?contains("doclib")>
|
||||||
"lastThumbnailModification": "${thumbnailMod}",
|
"lastThumbnailModification": "${thumbnailMod}",
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
"webdavUrl": "${node.webdavUrl}",
|
"webdavUrl": "${node.webdavUrl}",
|
||||||
"actionSet": "${item.actionSet}",
|
"actionSet": "${item.actionSet}",
|
||||||
"tags": <#noescape>[${tags}]</#noescape>,
|
"tags": <#noescape>[${tags}]</#noescape>,
|
||||||
<#if node.hasAspect("cm:generalclassifiable")>
|
<#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}generalclassifiable")>
|
||||||
"categories": [<#list node.properties.categories![] as c>["${c.name}", "${c.displayPath?replace("/categories/General","")}"]<#if c_has_next>,</#if></#list>],
|
"categories": [<#list node.properties.categories![] as c>["${c.name}", "${c.displayPath?replace("/categories/General","")}"]<#if c_has_next>,</#if></#list>],
|
||||||
</#if>
|
</#if>
|
||||||
<#if item.activeWorkflows??>"activeWorkflows": "<#list item.activeWorkflows as aw>${aw}<#if aw_has_next>,</#if></#list>",</#if>
|
<#if item.activeWorkflows??>"activeWorkflows": "<#list item.activeWorkflows as aw>${aw}<#if aw_has_next>,</#if></#list>",</#if>
|
||||||
@@ -98,12 +98,12 @@
|
|||||||
</#if>
|
</#if>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
<#if node.hasAspect("cm:geographic")>"geolocation":
|
<#if node.hasAspect("{http://www.alfresco.org/model/content/1.0}geographic")>"geolocation":
|
||||||
{
|
{
|
||||||
"latitude": <@renderNumber node.properties["cm:latitude"] />,
|
"latitude": <@renderNumber node.properties["cm:latitude"] />,
|
||||||
"longitude": <@renderNumber node.properties["cm:longitude"] />
|
"longitude": <@renderNumber node.properties["cm:longitude"] />
|
||||||
},</#if>
|
},</#if>
|
||||||
<#if node.hasAspect("audio:audio")>"audio":
|
<#if node.hasAspect("{http://www.alfresco.org/model/audio/1.0}audio")>"audio":
|
||||||
{
|
{
|
||||||
"album": "${node.properties["audio:album"]!""}",
|
"album": "${node.properties["audio:album"]!""}",
|
||||||
"artist": "${node.properties["audio:artist"]!""}",
|
"artist": "${node.properties["audio:artist"]!""}",
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
"channelType": "${node.properties["audio:channelType"]!""}",
|
"channelType": "${node.properties["audio:channelType"]!""}",
|
||||||
"compressor": "${node.properties["audio:compressor"]!""}"
|
"compressor": "${node.properties["audio:compressor"]!""}"
|
||||||
},</#if>
|
},</#if>
|
||||||
<#if node.hasAspect("exif:exif")>"exif":
|
<#if node.hasAspect("{http://www.alfresco.org/model/exif/1.0}exif")>"exif":
|
||||||
{
|
{
|
||||||
"dateTimeOriginal": "<@dateFormat node.properties["exif:dateTimeOriginal"] />",
|
"dateTimeOriginal": "<@dateFormat node.properties["exif:dateTimeOriginal"] />",
|
||||||
"pixelXDimension": <@renderNumber node.properties["exif:pixelXDimension"] />,
|
"pixelXDimension": <@renderNumber node.properties["exif:pixelXDimension"] />,
|
||||||
|
@@ -294,8 +294,8 @@ var Common =
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
isLiked = ratingService.getRating(node, LIKES_SCHEME) !== -1;
|
|
||||||
totalLikes = ratingService.getRatingsCount(node, LIKES_SCHEME);
|
totalLikes = ratingService.getRatingsCount(node, LIKES_SCHEME);
|
||||||
|
isLiked = totalLikes === 0 ? false : ratingService.getRating(node, LIKES_SCHEME) !== -1;
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
|
@@ -56,9 +56,6 @@ import org.alfresco.service.cmr.security.PermissionService;
|
|||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
import org.alfresco.service.cmr.site.SiteService;
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.util.EqualsHelper;
|
|
||||||
import org.alfresco.util.Pair;
|
|
||||||
import org.apache.commons.lang.NotImplementedException;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.extensions.surf.util.URLDecoder;
|
import org.springframework.extensions.surf.util.URLDecoder;
|
||||||
@@ -538,14 +535,14 @@ public class WebDAVHelper
|
|||||||
FileFolderService fileFolderService = getFileFolderService();
|
FileFolderService fileFolderService = getFileFolderService();
|
||||||
|
|
||||||
// get the path elements
|
// get the path elements
|
||||||
List<FileInfo> pathInfos = fileFolderService.getNamePath(rootNodeRef, nodeRef);
|
List<String> pathInfos = fileFolderService.getNameOnlyPath(rootNodeRef, nodeRef);
|
||||||
|
|
||||||
// build the path string
|
// build the path string
|
||||||
StringBuilder sb = new StringBuilder(pathInfos.size() * 20);
|
StringBuilder sb = new StringBuilder(pathInfos.size() * 20);
|
||||||
for (FileInfo fileInfo : pathInfos)
|
for (String fileInfo : pathInfos)
|
||||||
{
|
{
|
||||||
sb.append(WebDAVHelper.PathSeperatorChar);
|
sb.append(WebDAVHelper.PathSeperatorChar);
|
||||||
sb.append(fileInfo.getName());
|
sb.append(fileInfo);
|
||||||
}
|
}
|
||||||
// done
|
// done
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
|
Reference in New Issue
Block a user