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
This commit is contained in:
Alan Davis
2014-09-18 17:08:58 +00:00
parent 7426972237
commit 672d23b2ee
2 changed files with 16 additions and 1 deletions

View File

@@ -34,6 +34,11 @@
<value>workspace://SpacesStore</value> <value>workspace://SpacesStore</value>
</list> </list>
</property> </property>
<property name="excludedTypes">
<list>
<value>{http://www.alfresco.org/model/download/1.0}download</value>
</list>
</property>
</bean> </bean>
<bean id="usageQuotaProtector" class="org.alfresco.repo.usage.UsageQuotaProtector" init-method="init"> <bean id="usageQuotaProtector" class="org.alfresco.repo.usage.UsageQuotaProtector" init-method="init">

View File

@@ -77,6 +77,8 @@ public class ContentUsageImpl implements ContentUsageService,
private List<String> stores; private List<String> stores;
private Set<QName> excludedTypes = new HashSet<QName>();
public void setNodeService(NodeService nodeService) public void setNodeService(NodeService nodeService)
{ {
this.nodeService = nodeService; this.nodeService = nodeService;
@@ -122,6 +124,14 @@ public class ContentUsageImpl implements ContentUsageService,
return this.stores; return this.stores;
} }
public void setExcludedTypes(List<String> excludedTypes)
{
for (String exType : excludedTypes)
{
this.excludedTypes.add(QName.createQName(exType));
}
}
/** /**
* The initialise method * The initialise method
*/ */
@@ -431,7 +441,7 @@ public class ContentUsageImpl implements ContentUsageService,
private void incrementUserUsage(String userName, long contentSize, NodeRef contentNodeRef) 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 // increment usage - add positive delta
if (logger.isDebugEnabled()) logger.debug("incrementUserUsage: username="+userName+", contentSize="+contentSize+", contentNodeRef="+contentNodeRef); if (logger.isDebugEnabled()) logger.debug("incrementUserUsage: username="+userName+", contentSize="+contentSize+", contentNodeRef="+contentNodeRef);