mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Implemented truncation of status update messages if they exceed the max status length for that channel.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29681 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -112,26 +112,38 @@ public class PublishingEventProcessor
|
||||
return;
|
||||
}
|
||||
String message = update.getMessage();
|
||||
NodeRef node = update.getNodeToLinkTo();
|
||||
if(node!= null)
|
||||
{
|
||||
String nodeUrl = publishChannel.getUrl(node);
|
||||
if(nodeUrl != null)
|
||||
{
|
||||
message += " " + urlShortener.shortenUrl(nodeUrl);
|
||||
}
|
||||
}
|
||||
String nodeUrl = getNodeUrl(publishChannel, update);
|
||||
Set<String> channels = update.getChannelIds();
|
||||
for (String channelId : channels)
|
||||
{
|
||||
Channel channel = channelService.getChannelById(channelId);
|
||||
if(channel != null && channel.getChannelType().canPublishStatusUpdates())
|
||||
if(channel != null)
|
||||
{
|
||||
channel.updateStatus(message);
|
||||
channel.updateStatus(message, nodeUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param publishChannel
|
||||
* @param update
|
||||
* @return
|
||||
*/
|
||||
private String getNodeUrl(Channel publishChannel, StatusUpdate update)
|
||||
{
|
||||
NodeRef node = update.getNodeToLinkTo();
|
||||
String nodeUrl = null;
|
||||
if(node!= null)
|
||||
{
|
||||
nodeUrl = publishChannel.getUrl(node);
|
||||
if(nodeUrl != null)
|
||||
{
|
||||
nodeUrl = " " + urlShortener.shortenUrl(nodeUrl);
|
||||
}
|
||||
}
|
||||
return nodeUrl;
|
||||
}
|
||||
|
||||
public void publishEvent(Channel channel, PublishingEvent event)
|
||||
{
|
||||
NodeRef eventNode = eventHelper.getPublishingEventNode(event.getId());
|
||||
@@ -155,6 +167,8 @@ public class PublishingEventProcessor
|
||||
if(NodeUtils.exists(publishedNode, nodeService))
|
||||
{
|
||||
channel.unPublish(publishedNode);
|
||||
// Need to set as temporary to delete node instead of archiving.
|
||||
nodeService.addAspect(publishedNode, ContentModel.ASPECT_TEMPORARY, null);
|
||||
nodeService.deleteNode(publishedNode);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user