mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
75070: Merged WAT2 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 72987: Raise an event when sharing via quickshare: ACE-1709 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@75400 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,16 +20,21 @@ package org.alfresco.repo.quickshare;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.events.types.ActivityEvent;
|
||||
import org.alfresco.events.types.Event;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.model.QuickShareModel;
|
||||
import org.alfresco.repo.copy.CopyBehaviourCallback;
|
||||
import org.alfresco.repo.copy.CopyDetails;
|
||||
import org.alfresco.repo.copy.CopyServicePolicies;
|
||||
import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback;
|
||||
import org.alfresco.repo.events.EventPreparator;
|
||||
import org.alfresco.repo.events.EventPublisher;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
@@ -59,6 +64,7 @@ import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.EqualsHelper;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.util.FileFilterMode.Client;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -90,6 +96,7 @@ public class QuickShareServiceImpl implements QuickShareService, NodeServicePoli
|
||||
private PolicyComponent policyComponent;
|
||||
private TenantService tenantService;
|
||||
private ThumbnailService thumbnailService;
|
||||
private EventPublisher eventPublisher;
|
||||
|
||||
/**
|
||||
* Enable or disable this service.
|
||||
@@ -163,6 +170,14 @@ public class QuickShareServiceImpl implements QuickShareService, NodeServicePoli
|
||||
this.thumbnailService = thumbnailService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the eventPublisher
|
||||
*/
|
||||
public void setEventPublisher(EventPublisher eventPublisher)
|
||||
{
|
||||
this.eventPublisher = eventPublisher;
|
||||
}
|
||||
|
||||
/**
|
||||
* The initialise method. Register our policies.
|
||||
*/
|
||||
@@ -188,7 +203,7 @@ public class QuickShareServiceImpl implements QuickShareService, NodeServicePoli
|
||||
checkEnabled();
|
||||
|
||||
//Check the node is the correct type
|
||||
QName typeQName = nodeService.getType(nodeRef);
|
||||
final QName typeQName = nodeService.getType(nodeRef);
|
||||
if (isSharable(typeQName) == false)
|
||||
{
|
||||
throw new InvalidNodeRefException(nodeRef);
|
||||
@@ -228,6 +243,19 @@ public class QuickShareServiceImpl implements QuickShareService, NodeServicePoli
|
||||
}
|
||||
});
|
||||
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
sb.append("{").append("\"sharedId\":\"").append(sharedId).append("\"").append("}");
|
||||
|
||||
eventPublisher.publishEvent(new EventPreparator(){
|
||||
@Override
|
||||
public Event prepareEvent(String user, String networkId, String transactionId)
|
||||
{
|
||||
return new ActivityEvent("quickshare", transactionId, networkId, new Date().getTime(),
|
||||
user, nodeRef.toString(),
|
||||
null, typeQName.toString(), Client.webclient, sb.toString());
|
||||
}
|
||||
});
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("QuickShare - shared content: "+sharedId+" ["+nodeRef+"]");
|
||||
@@ -531,4 +559,5 @@ public class QuickShareServiceImpl implements QuickShareService, NodeServicePoli
|
||||
}, tenantDomain);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user