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:
N Smith
2011-08-11 09:57:56 +00:00
parent ce5a0480e3
commit 0b171e0f40
6 changed files with 154 additions and 17 deletions

View File

@@ -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);
}
}