Merged HEAD (5.2) to 5.2.N (5.2.1)

126569 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      124565 gjames: RA-884: Posting DOWNLOAD activities in a new (non-readonly) transaction


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126914 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 12:10:20 +00:00
parent b2a48bde95
commit ef82a92254
2 changed files with 25 additions and 1 deletions

View File

@@ -64,6 +64,7 @@ import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.thumbnail.ThumbnailDefinition;
import org.alfresco.repo.thumbnail.ThumbnailHelper;
import org.alfresco.repo.thumbnail.ThumbnailRegistry;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.rest.antlr.WhereClauseParser;
import org.alfresco.rest.api.Nodes;
@@ -190,6 +191,7 @@ public class NodesImpl implements Nodes
private ThumbnailService thumbnailService;
private SiteService siteService;
private ActivityPoster poster;
private RetryingTransactionHelper retryingTransactionHelper;
private enum Activity_Type
{
@@ -233,6 +235,7 @@ public class NodesImpl implements Nodes
this.authorityService = sr.getAuthorityService();
this.thumbnailService = sr.getThumbnailService();
this.siteService = sr.getSiteService();
this.retryingTransactionHelper = sr.getRetryingTransactionHelper();
if (defaultIgnoreTypesAndAspects != null)
{
@@ -1920,6 +1923,19 @@ public class NodesImpl implements Nodes
}
String attachFileName = (attach ? name : null);
final ActivityInfo activityInfo = getActivityInfo(getParentNodeRef(nodeRef), nodeRef);
//Activity posting needs a transaction
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
postActivity(Activity_Type.DOWNLOADED, activityInfo);
return null;
}
}, false, true);
return new NodeBinaryResource(nodeRef, ContentModel.PROP_CONTENT, ci, attachFileName);
}