From 672d23b2ee760fa67deee093e020c0daa6e3419b Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Thu, 18 Sep 2014 17:08:58 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud) 83542: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 82265: Merged DEV to V4.2-BUG-FIX (4.2.4) 82260: MNT-10766: User quotas diminished due to orphan, undetectable, non-deletable, temporary download files generated by "Download as Zip" - functionality that allows to configure excluded types, that will ignore user usage recalculation for these types. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@84562 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/usage-services-context.xml | 5 +++++ .../org/alfresco/repo/usage/ContentUsageImpl.java | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/config/alfresco/usage-services-context.xml b/config/alfresco/usage-services-context.xml index 95ec47f51a..0a49f83089 100644 --- a/config/alfresco/usage-services-context.xml +++ b/config/alfresco/usage-services-context.xml @@ -34,6 +34,11 @@ workspace://SpacesStore + + + {http://www.alfresco.org/model/download/1.0}download + + diff --git a/source/java/org/alfresco/repo/usage/ContentUsageImpl.java b/source/java/org/alfresco/repo/usage/ContentUsageImpl.java index 5b3af785f4..f00e0991fc 100644 --- a/source/java/org/alfresco/repo/usage/ContentUsageImpl.java +++ b/source/java/org/alfresco/repo/usage/ContentUsageImpl.java @@ -77,6 +77,8 @@ public class ContentUsageImpl implements ContentUsageService, private List stores; + private Set excludedTypes = new HashSet(); + public void setNodeService(NodeService nodeService) { this.nodeService = nodeService; @@ -122,6 +124,14 @@ public class ContentUsageImpl implements ContentUsageService, return this.stores; } + public void setExcludedTypes(List excludedTypes) + { + for (String exType : excludedTypes) + { + this.excludedTypes.add(QName.createQName(exType)); + } + } + /** * The initialise method */ @@ -431,7 +441,7 @@ public class ContentUsageImpl implements ContentUsageService, private void incrementUserUsage(String userName, long contentSize, NodeRef contentNodeRef) { - if (! authenticationContext.isSystemUserName(userName)) + if (!authenticationContext.isSystemUserName(userName) && !excludedTypes.contains(nodeService.getType(contentNodeRef))) { // increment usage - add positive delta if (logger.isDebugEnabled()) logger.debug("incrementUserUsage: username="+userName+", contentSize="+contentSize+", contentNodeRef="+contentNodeRef);