* @param msgResource The registry resource to retrieve message attributes from
* @param fields The attributes of the message to be set
* @return
*/
private Message getPropertiesAddedMessageOjb(Resource msgResource, Set<String> fields) {
Message messageObj = new MessageImpl();
for (String field : fields) {
if (SocialImplConstants.MSG_APP_URL.equalsIgnoreCase(field.trim())) {
messageObj.setAppUrl(msgResource.getProperty(SocialImplConstants.MSG_APP_URL));
} else if (SocialImplConstants.MSG_BODY.equalsIgnoreCase(field.trim())) {
messageObj.setBody(msgResource.getProperty(SocialImplConstants.MSG_BODY));
} else if (SocialImplConstants.MSG_BODY_ID.equalsIgnoreCase(field.trim())) {
messageObj.setBodyId(msgResource.getProperty(SocialImplConstants.MSG_BODY_ID));
} else if (SocialImplConstants.MSG_ID.equalsIgnoreCase(field.trim())) {
messageObj.setId(msgResource.getProperty(SocialImplConstants.MSG_ID));
} else if (SocialImplConstants.MSG_IN_REPLY_TO.equalsIgnoreCase(field.trim())) {
messageObj.setInReplyTo(
msgResource.getProperty(SocialImplConstants.MSG_IN_REPLY_TO));
} else if (SocialImplConstants.MSG_SENDER_ID.equalsIgnoreCase(field.trim())) {
messageObj.setSenderId(msgResource.getProperty(SocialImplConstants.MSG_SENDER_ID));
} else if (SocialImplConstants.MSG_STATUS.equalsIgnoreCase(field.trim())) {
messageObj.setStatus(Message.Status.valueOf(
msgResource.getProperty(SocialImplConstants.MSG_STATUS)));
} else if (SocialImplConstants.MSG_TIME_SENT.equalsIgnoreCase(field.trim())) {
messageObj.setTimeSent(new Date(Long.valueOf(
msgResource.getProperty(SocialImplConstants.MSG_TIME_SENT))));
} else if (SocialImplConstants.MSG_TITLE.equalsIgnoreCase(field.trim())) {
messageObj.setTitle(msgResource.getProperty(SocialImplConstants.MSG_TITLE));
} else if (SocialImplConstants.MSG_TITLE_ID.equalsIgnoreCase(field.trim())) {
messageObj.setTitleId(msgResource.getProperty(SocialImplConstants.MSG_TITLE_ID));
} else if (SocialImplConstants.MSG_TYPE.equalsIgnoreCase(field.trim())) {
messageObj.setType(Message.Type.valueOf(
msgResource.getProperty(SocialImplConstants.MSG_TYPE)));
} else if (SocialImplConstants.MSG_UPDATED.equalsIgnoreCase(field.trim())) {
messageObj.setUpdated(new Date(Long.valueOf(
msgResource.getProperty(SocialImplConstants.MSG_UPDATED))));
}
}