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

@@ -113,9 +113,20 @@ public class ChannelImpl implements Channel
/**
* {@inheritDoc}
*/
public void updateStatus(String status)
public void updateStatus(String status, String nodeUrl)
{
channelType.updateStatus(this, status, getProperties());
if(channelType.canPublishStatusUpdates())
{
int urlLength = nodeUrl == null ? 0 : nodeUrl.length();
int maxLength = channelType.getMaximumStatusLength() - urlLength;
if (maxLength > 0)
{
int endpoint = Math.min(maxLength, status.length());
status = status.substring(0, endpoint );
}
String msg = nodeUrl==null ? status : status + nodeUrl;
channelType.updateStatus(this, msg, getProperties());
}
}
/**