osnap.api.model
Class SocialNetworkMessage

java.lang.Object
  extended by osnap.api.model.SocialNetworkMessage
All Implemented Interfaces:
java.io.Serializable, MessageInterface

public class SocialNetworkMessage
extends java.lang.Object
implements MessageInterface, java.io.Serializable

A universal message object to be used with all modules and Core

See Also:
Serialized Form

Field Summary
private  java.lang.String _description
           
private  java.util.ArrayList<java.lang.String> _hashtags
           
private  java.lang.String _id
           
private  java.lang.String _notes
           
private  java.lang.String _osnapUsername
           
private  java.lang.String _realname
           
private  java.util.Date _timestamp
           
private  java.lang.String _URL
           
private  java.lang.String _username
           
private static long serialVersionUID
           
 
Constructor Summary
SocialNetworkMessage()
          Creates a parameterless version of this object
SocialNetworkMessage(java.lang.String description, java.util.Date timestamp, java.lang.String osnapUsername)
          Creates a universal message object which is to be used for all message handling in modules and Core
SocialNetworkMessage(java.lang.String description, java.util.Date timestamp, java.lang.String osnapUsername, java.lang.String id, java.lang.String userName, java.lang.String realName)
          Creates a universal message object which is to be used for all message handling in modules, core and messagehandler
 
Method Summary
 java.lang.String getDescription()
          Gets the description of the message
 java.util.ArrayList<java.lang.String> getHashTags()
          Gets the hashtags attached to the message
 java.lang.String getID()
          Returns the id of the message from the social network
 java.lang.String getNotes()
          Get any notes contained in this message
 java.lang.String getOSNAPUsername()
          Gets the OSNAP Username this message came from
 java.util.Date getPosted()
          Gets the date this message was posted
 java.lang.String getRealname()
          Gets the Realname attached to the message
 java.lang.String getURL()
          Returns the URL the message originated from
 java.lang.String getUsername()
          Returns the username attached to the message
 boolean hasHashTags()
          Checks if the message has hashtags attached to it
 boolean hasID()
          Checks if the message has an id attached to it
 boolean hasRealname()
          Checks if the message has a realname attached to it
 boolean hasURL()
          Checks if the message has a URL attached to it
 boolean hasUsername()
          Checks if the message has a username attached to it
 void setDescription(java.lang.String description)
          Sets the description of the message
 void setHashTags(java.util.ArrayList<java.lang.String> hashtags)
          Sets the hashtags attached to the message
 void setID(java.lang.String id)
          Sets the ID of the message
 void setNotes(java.lang.String notes)
          Set notes in this message
 void setPosted(java.util.Date posted)
          Sets the date this message was posted
 void setRealname(java.lang.String realname)
          Sets the Realname of the message
 void setSocialNetworkName(java.lang.String osnapUsername)
          Sets the OSNAP Username this message came from
 void setURL(java.lang.String URL)
          Sets the URL from where the message originated from
 void setUsername(java.lang.String username)
          Sets the username of the message
 java.lang.String toString()
          Returns the message in a readable form Contains the date, description and network the message came from
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

_username

private java.lang.String _username

_realname

private java.lang.String _realname

_timestamp

private java.util.Date _timestamp

_description

private java.lang.String _description

_hashtags

private java.util.ArrayList<java.lang.String> _hashtags

_osnapUsername

private java.lang.String _osnapUsername

_URL

private java.lang.String _URL

_notes

private java.lang.String _notes

_id

private java.lang.String _id
Constructor Detail

SocialNetworkMessage

public SocialNetworkMessage(java.lang.String description,
                            java.util.Date timestamp,
                            java.lang.String osnapUsername)
Creates a universal message object which is to be used for all message handling in modules and Core

Parameters:
timestamp - Date of posting, set to null if there is no date
description - Description of the problem/answer
osnapUsername - OSNAP Username

SocialNetworkMessage

public SocialNetworkMessage(java.lang.String description,
                            java.util.Date timestamp,
                            java.lang.String osnapUsername,
                            java.lang.String id,
                            java.lang.String userName,
                            java.lang.String realName)
Creates a universal message object which is to be used for all message handling in modules, core and messagehandler

Parameters:
description - Description of the problem/answer
timestamp - Date of posting
osnapUsername - OSNAP Username
id - Message ID from Social Network
userName - Username of the user who posted the message
realName - Realname of the user who posted the message

SocialNetworkMessage

public SocialNetworkMessage()
Creates a parameterless version of this object

Method Detail

hasUsername

public boolean hasUsername()
Checks if the message has a username attached to it

Returns:
boolean Returns a value indicating if this message has a username attached to it

getUsername

public java.lang.String getUsername()
Returns the username attached to the message

Returns:
String Returns the username attached to the message

setUsername

public void setUsername(java.lang.String username)
Sets the username of the message

Parameters:
username - Username of the user who posted the message

hasRealname

public boolean hasRealname()
Checks if the message has a realname attached to it

Returns:
boolean Returns a value indicating if this message has a realname attached to it

getRealname

public java.lang.String getRealname()
Gets the Realname attached to the message

Returns:
String Returns the realname contained in the message

setRealname

public void setRealname(java.lang.String realname)
Sets the Realname of the message

Parameters:
realname - Realname of the user who posted the message

getPosted

public java.util.Date getPosted()
Gets the date this message was posted

Returns:
Date Returns the date of the message

setPosted

public void setPosted(java.util.Date posted)
Sets the date this message was posted

Parameters:
posted - Date the message was posted

getDescription

public java.lang.String getDescription()
Gets the description of the message

Specified by:
getDescription in interface MessageInterface
Returns:
String Returns the description contained in the message

setDescription

public void setDescription(java.lang.String description)
Sets the description of the message

Specified by:
setDescription in interface MessageInterface
Parameters:
description - Description of the message

getOSNAPUsername

public java.lang.String getOSNAPUsername()
Gets the OSNAP Username this message came from

Specified by:
getOSNAPUsername in interface MessageInterface
Returns:
Network the message came from

setSocialNetworkName

public void setSocialNetworkName(java.lang.String osnapUsername)
Sets the OSNAP Username this message came from

Parameters:
osnapUsername - OSNAP Username this message came from

hasHashTags

public boolean hasHashTags()
Checks if the message has hashtags attached to it

Returns:
boolean

getHashTags

public java.util.ArrayList<java.lang.String> getHashTags()
Gets the hashtags attached to the message

Returns:
Hashtags attached to the message

setHashTags

public void setHashTags(java.util.ArrayList<java.lang.String> hashtags)
Sets the hashtags attached to the message

Parameters:
hashtags - ArrayList hashtags

hasURL

public boolean hasURL()
Checks if the message has a URL attached to it

Returns:
boolean Returns a value indicating if this message has an URL attached to it

getURL

public java.lang.String getURL()
Returns the URL the message originated from

Returns:
Returns the URL the message originated from

setURL

public void setURL(java.lang.String URL)
Sets the URL from where the message originated from

Parameters:
URL - URL to where the message originated from

hasID

public boolean hasID()
Checks if the message has an id attached to it

Returns:
boolean Returns a value indicating if this message has an ID attached to it

getID

public java.lang.String getID()
Returns the id of the message from the social network

Returns:
String Returns the message ID of this message

setID

public void setID(java.lang.String id)
Sets the ID of the message

Parameters:
id - ID of the message

toString

public java.lang.String toString()
Returns the message in a readable form Contains the date, description and network the message came from

Overrides:
toString in class java.lang.Object

getNotes

public java.lang.String getNotes()
Get any notes contained in this message

Returns:
Returns notes contained in this message

setNotes

public void setNotes(java.lang.String notes)
Set notes in this message

Parameters:
notes - Notes to be attached to this message