use of org.alfresco.sync.events.types.Event in project alfresco-repository by Alfresco.
the class EventsServiceImpl method contentWrite.
@Override
public void contentWrite(NodeRef nodeRef, QName propertyQName, ContentData value) {
NodeInfo nodeInfo = getNodeInfo(nodeRef, NodeContentPutEvent.EVENT_TYPE);
if (nodeInfo.checkNodeInfo()) {
String username = AuthenticationUtil.getFullyAuthenticatedUser();
String networkId = TenantUtil.getCurrentDomain();
String name = nodeInfo.getName();
String objectId = nodeInfo.getNodeId();
String siteId = nodeInfo.getSiteId();
String txnId = AlfrescoTransactionSupport.getTransactionId();
List<String> nodePaths = nodeInfo.getPaths();
List<List<String>> pathNodeIds = nodeInfo.getParentNodeIds();
long timestamp = System.currentTimeMillis();
Long modificationTime = nodeInfo.getModificationTimestamp();
long size;
String mimeType;
String encoding;
if (value != null) {
size = value.getSize();
mimeType = value.getMimetype();
encoding = value.getEncoding();
} else {
size = 0;
mimeType = "";
encoding = "";
}
String nodeType = nodeInfo.getType().toPrefixString(namespaceService);
Client alfrescoClient = getAlfrescoClient(nodeInfo.getClient());
Set<String> aspects = nodeInfo.getAspectsAsStrings();
Map<String, Serializable> properties = nodeInfo.getProperties();
Event event = new NodeContentPutEvent(nextSequenceNumber(), name, txnId, timestamp, networkId, siteId, objectId, nodeType, nodePaths, pathNodeIds, username, modificationTime, size, mimeType, encoding, alfrescoClient, aspects, properties);
sendEvent(event);
}
}
use of org.alfresco.sync.events.types.Event in project alfresco-repository by Alfresco.
the class FavouritesServiceImpl method removeFavouriteNode.
private boolean removeFavouriteNode(String userName, Type type, NodeRef nodeRef) {
boolean exists = false;
Map<PersonFavouriteKey, PersonFavourite> personFavourites = getFavouriteNodes(userName, type);
PersonFavouriteKey personFavouriteKey = new PersonFavouriteKey(userName, null, type, nodeRef);
PersonFavourite personFavourite = personFavourites.remove(personFavouriteKey);
exists = personFavourite != null;
updateFavouriteNodes(userName, type, personFavourites);
QName nodeClass = nodeService.getType(nodeRef);
final String finalRef = nodeRef.getId();
final QName nodeType = nodeClass;
eventPublisher.publishEvent(new EventPreparator() {
@Override
public Event prepareEvent(String user, String networkId, String transactionId) {
return new ActivityEvent("favorite.removed", transactionId, networkId, user, finalRef, null, nodeType == null ? null : nodeType.toString(), Client.asType(ClientType.script), null, null, null, 0l, null);
}
});
OnRemoveFavouritePolicy policy = onRemoveFavouriteDelegate.get(nodeRef, nodeClass);
policy.onRemoveFavourite(userName, nodeRef);
return exists;
}
use of org.alfresco.sync.events.types.Event in project alfresco-repository by Alfresco.
the class EventsServiceImpl method secondaryAssociationDeleted.
@Override
public void secondaryAssociationDeleted(final ChildAssociationRef secAssociation) {
NodeInfo nodeInfo = getNodeInfo(secAssociation.getChildRef(), NodeRemovedEvent.EVENT_TYPE);
if (nodeInfo.checkNodeInfo()) {
String username = AuthenticationUtil.getFullyAuthenticatedUser();
String networkId = TenantUtil.getCurrentDomain();
String name = nodeInfo.getName();
String objectId = nodeInfo.getNodeId();
String siteId = nodeInfo.getSiteId();
String txnId = AlfrescoTransactionSupport.getTransactionId();
NodeRef secParentNodeRef = secAssociation.getParentRef();
String secParentNodeName = (String) nodeService.getProperty(secAssociation.getParentRef(), ContentModel.PROP_NAME);
List<Path> secParentPath = nodeService.getPaths(secParentNodeRef, true);
List<String> nodePaths = getPaths(secParentPath, Arrays.asList(secParentNodeName, name));
List<List<String>> pathNodeIds = this.getNodeIds(secParentPath);
long timestamp = System.currentTimeMillis();
Long modificationTime = nodeInfo.getModificationTimestamp();
String nodeType = nodeInfo.getType().toPrefixString(namespaceService);
Client alfrescoClient = getAlfrescoClient(nodeInfo.getClient());
Set<String> aspects = nodeInfo.getAspectsAsStrings();
Map<String, Serializable> properties = nodeInfo.getProperties();
Event event = new NodeRemovedEvent(nextSequenceNumber(), name, txnId, timestamp, networkId, siteId, objectId, nodeType, nodePaths, pathNodeIds, username, modificationTime, alfrescoClient, aspects, properties);
sendEvent(event);
}
}
use of org.alfresco.sync.events.types.Event in project alfresco-repository by Alfresco.
the class EventsServiceImpl method fileUnclassified.
@Override
public void fileUnclassified(NodeRef nodeRef) {
NodeInfo nodeInfo = getNodeInfo(nodeRef, FileUnclassifiedEvent.EVENT_TYPE);
if (nodeInfo.checkNodeInfo()) {
Event event = FileUnclassifiedEvent.builder().seqNumber(nextSequenceNumber()).name(nodeInfo.getName()).txnId(AlfrescoTransactionSupport.getTransactionId()).timestamp(System.currentTimeMillis()).networkId(TenantUtil.getCurrentDomain()).siteId(nodeInfo.getSiteId()).nodeId(nodeInfo.getNodeId()).nodeType(nodeInfo.getType().toPrefixString(namespaceService)).paths(nodeInfo.getPaths()).parentNodeIds(nodeInfo.getParentNodeIds()).username(AuthenticationUtil.getFullyAuthenticatedUser()).nodeModificationTime(nodeInfo.getModificationTimestamp()).client(getAlfrescoClient(nodeInfo.getClient())).aspects(nodeInfo.getAspectsAsStrings()).nodeProperties(nodeInfo.getProperties()).build();
sendEvent(event);
}
}
use of org.alfresco.sync.events.types.Event in project alfresco-repository by Alfresco.
the class EventsServiceImpl method nodeLiked.
@Override
public void nodeLiked(final NodeRef nodeRef) {
NodeInfo nodeInfo = getNodeInfo(nodeRef, NodeLikedEvent.EVENT_TYPE);
if (nodeInfo.checkNodeInfo()) {
String username = AuthenticationUtil.getFullyAuthenticatedUser();
String networkId = TenantUtil.getCurrentDomain();
String name = nodeInfo.getName();
String objectId = nodeInfo.getNodeId();
String siteId = nodeInfo.getSiteId();
String txnId = AlfrescoTransactionSupport.getTransactionId();
List<String> nodePaths = nodeInfo.getPaths();
List<List<String>> pathNodeIds = nodeInfo.getParentNodeIds();
long timestamp = System.currentTimeMillis();
Long modificationTime = nodeInfo.getModificationTimestamp();
String nodeType = nodeInfo.getType().toPrefixString(namespaceService);
Set<String> aspects = nodeInfo.getAspectsAsStrings();
Map<String, Serializable> properties = nodeInfo.getProperties();
Client alfrescoClient = getAlfrescoClient(nodeInfo.getClient());
Event event = new NodeLikedEvent(nextSequenceNumber(), name, txnId, timestamp, networkId, siteId, objectId, nodeType, nodePaths, pathNodeIds, username, modificationTime, alfrescoClient, aspects, properties);
sendEvent(event);
}
}
Aggregations