private static Properties populateProperties(ServerMessage message)
{
Calendar calendar = Calendar.getInstance();
Properties properties = new Properties();
TypedProperties typedProperties = message.getTypedProperties();
properties.setMessageId(message.getMessageID());
if (message.getAddress() != null)
{
properties.setTo(message.getAddress().toString());
}
if (typedProperties.containsProperty(USER_ID_SS))
{
properties.setUserId(new Binary(typedProperties.getBytesProperty(USER_ID_SS)));
}
if (typedProperties.containsProperty(SUBJECT_SS))
{
properties.setSubject(typedProperties.getSimpleStringProperty(SUBJECT_SS).toString());
}
if (typedProperties.containsProperty(REPLY_TO_SS))
{
properties.setReplyTo(typedProperties.getSimpleStringProperty(REPLY_TO_SS).toString());
}
if (typedProperties.containsProperty(CORRELATION_ID_SS))
{
properties.setCorrelationId(typedProperties.getSimpleStringProperty(CORRELATION_ID_SS).toString());
}
if (typedProperties.containsProperty(CONTENT_TYPE_SS))
{
properties.setContentType(Symbol.getSymbol(typedProperties.getSimpleStringProperty(CONTENT_TYPE_SS).toString()));
}
if (typedProperties.containsProperty(CONTENT_ENCODING_SS))
{
properties.setContentEncoding(Symbol.getSymbol(typedProperties.getSimpleStringProperty(CONTENT_ENCODING_SS).toString()));
}
if (typedProperties.containsProperty(ABSOLUTE_EXPIRY_TIME_SS))
{
calendar.setTimeInMillis(typedProperties.getLongProperty(ABSOLUTE_EXPIRY_TIME_SS));
properties.setAbsoluteExpiryTime(calendar.getTime());
}
if (typedProperties.containsProperty(CREATION_TIME_SS))
{
calendar.setTimeInMillis(typedProperties.getLongProperty(CREATION_TIME_SS));
properties.setCreationTime(calendar.getTime());
}
if (typedProperties.containsProperty(GROUP_ID_SS))
{
properties.setGroupId(typedProperties.getSimpleStringProperty(GROUP_ID_SS).toString());
}
if (typedProperties.containsProperty(GROUP_SEQUENCE_SS))
{
properties.setGroupSequence(new UnsignedInteger(typedProperties.getIntProperty(GROUP_SEQUENCE_SS)));
}
if (typedProperties.containsProperty(REPLY_TO_GROUP_ID_SS))
{
properties.setReplyToGroupId(typedProperties.getSimpleStringProperty(REPLY_TO_GROUP_ID_SS).toString());
}
return properties;
}