use of org.alfresco.sync.events.types.NodeRenamedEvent in project alfresco-repository by Alfresco.
the class EventsServiceImpl method nodeRenamed.
@Override
public void nodeRenamed(NodeRef nodeRef, String oldName, String newName) {
NodeInfo nodeInfo = getNodeInfo(nodeRef, NodeRenamedEvent.EVENT_TYPE);
if (nodeInfo.checkNodeInfo()) {
NodeRenamedEvent nodeRenamedEvent = nodeRenamedEvent(nodeInfo, oldName, newName);
sendEvent(nodeRenamedEvent);
}
}
use of org.alfresco.sync.events.types.NodeRenamedEvent in project alfresco-repository by Alfresco.
the class EventsServiceImpl method nodeRenamedEvent.
private NodeRenamedEvent nodeRenamedEvent(NodeInfo nodeInfo, String oldName, String newName) {
String username = AuthenticationUtil.getFullyAuthenticatedUser();
String networkId = TenantUtil.getCurrentDomain();
String objectId = nodeInfo.getNodeId();
String siteId = nodeInfo.getSiteId();
String txnId = AlfrescoTransactionSupport.getTransactionId();
long timestamp = System.currentTimeMillis();
Long modificationTime = nodeInfo.getModificationTimestamp();
QName nodeTypeQName = nodeInfo.getType();
String nodeType = nodeTypeQName.toPrefixString(namespaceService);
List<List<String>> parentNodeIds = nodeInfo.getParentNodeIds();
List<String> newPaths = nodeInfo.getPaths();
List<String> paths = null;
// For site display name (title) rename events we don't want the path to be changed to the display name (title); leave it to name (id)
if (nodeTypeQName.equals(SiteModel.TYPE_SITE)) {
paths = newPaths;
} else {
nodeInfo.updateName(oldName);
paths = nodeInfo.getPaths();
}
Set<String> aspects = nodeInfo.getAspectsAsStrings();
Map<String, Serializable> properties = nodeInfo.getProperties();
Client alfrescoClient = getAlfrescoClient(nodeInfo.getClient());
NodeRenamedEvent event = new NodeRenamedEvent(nextSequenceNumber(), oldName, newName, txnId, timestamp, networkId, siteId, objectId, nodeType, paths, parentNodeIds, username, modificationTime, newPaths, alfrescoClient, aspects, properties);
return event;
}
Aggregations