Skip to content

Commit

Permalink
Errors on delete site, if folder has quota #8
Browse files Browse the repository at this point in the history
NodeRef existence control for quota folder
  • Loading branch information
angelborroy-ks committed Dec 21, 2015
1 parent f7740c9 commit 2fce1c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion alfresco-folder-quota-repo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>alfresco-folder-quota</artifactId>
<groupId>es.keensoft.alfresco</groupId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,16 @@ public String doWork() throws Exception {
RetryingTransactionCallback<Long> callback = new RetryingTransactionCallback<Long>() {

public Long execute() throws Throwable {
Long currentSize = (Long) nodeService.getProperty(quotaFolder, FolderQuotaModel.PROP_FQ_SIZE_CURRENT);
if (currentSize == null) {
currentSize=0L;
Long newSize = 0L;
if (nodeService.exists(quotaFolder)) {
Long currentSize = (Long) nodeService.getProperty(quotaFolder, FolderQuotaModel.PROP_FQ_SIZE_CURRENT);
if (currentSize == null) {
currentSize=0L;
}
newSize = currentSize + sizeChange;
if (newSize < 0) newSize = 0L;
nodeService.setProperty(quotaFolder, FolderQuotaModel.PROP_FQ_SIZE_CURRENT, newSize);
}
Long newSize = currentSize + sizeChange;
if (newSize < 0) newSize = 0L;
nodeService.setProperty(quotaFolder, FolderQuotaModel.PROP_FQ_SIZE_CURRENT, newSize);
return newSize;
}

Expand All @@ -325,7 +328,7 @@ public Long execute() throws Throwable {
txnHelper.doInTransaction(callback, false, true);

} catch (Throwable e) {
logger.error("Failed to update folder size on quota folder node: " + quotaFolder);
logger.error("Failed to update folder size on quota folder node: " + quotaFolder, e);
}
return "";
}
Expand Down
2 changes: 1 addition & 1 deletion alfresco-folder-quota-share/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>alfresco-folder-quota</artifactId>
<groupId>es.keensoft.alfresco</groupId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>es.keensoft.alfresco</groupId>
<artifactId>alfresco-folder-quota</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<name>alfresco-folder-quota project</name>
<packaging>pom</packaging>

Expand Down

0 comments on commit 2fce1c2

Please sign in to comment.