Class TweetUtility

java.lang.Object
org.opensextant.data.social.TweetUtility

public class TweetUtility extends Object
Author:
ubaldino
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static Geocoding
    getGeo(jodd.json.JsonObject attrs, boolean isUser)
    TOOD: validate available data for this schema.
    protected static void
    insertGeo(jodd.json.JsonObject o, Geocoding geo, boolean isUser)
    TOOD: validate available data for this schema.
    static void
    insertMention(jodd.json.JsonArray a, String u, String id)
    Serialize a user screen name / ID pairing., e.g.
    static void
    insertMention(jodd.json.JsonArray a, Tweet.Mention m)
    Variation on insertMention(a, name, uid)
    static boolean
     
    static jodd.json.JsonObject
     
    static jodd.json.JsonObject
    toJSON(Tweet tw, boolean includeGeo, boolean formatDate)
    Objective of this is to create a FLAT key/value map for a JSON or a simple HashMap to use.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TweetUtility

      public TweetUtility()
  • Method Details

    • isValue

      public static boolean isValue(String str)
    • toJSON

      public static jodd.json.JsonObject toJSON(Tweet tw)
    • toJSON

      public static jodd.json.JsonObject toJSON(Tweet tw, boolean includeGeo, boolean formatDate)
      Objective of this is to create a FLAT key/value map for a JSON or a simple HashMap to use.
      Parameters:
      tw - tweet obj
      includeGeo - include geo* fields
      formatDate - true if date should be in both text and epoch
      Returns:
      JSON
    • insertGeo

      protected static void insertGeo(jodd.json.JsonObject o, Geocoding geo, boolean isUser)
      TOOD: validate available data for this schema.
      Parameters:
      o -
      geo -
      isUser -
    • getGeo

      protected static Geocoding getGeo(jodd.json.JsonObject attrs, boolean isUser)
      TOOD: validate available data for this schema.
      Parameters:
      attrs - given attributes
      isUser - if attributes represent user profile
      Returns:
      geocoding object populated with attribute data
    • insertMention

      public static void insertMention(jodd.json.JsonArray a, String u, String id)
      Serialize a user screen name / ID pairing., e.g. a mention of a friend. If just screen name or ID is available, then each item is added separately.
      Parameters:
      a - target array
      u - user name
      id - mention
    • insertMention

      public static void insertMention(jodd.json.JsonArray a, Tweet.Mention m)
      Variation on insertMention(a, name, uid)