public class TwitterActivityUtil extends Object
Constructor and Description |
---|
TwitterActivityUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addLocationExtension(Activity activity,
Tweet tweet)
Adds the location extension and populates with teh twitter data.
|
static void |
addTwitterExtension(Activity activity,
com.fasterxml.jackson.databind.node.ObjectNode event)
Adds the given Twitter event to the activity as an extension.
|
static void |
addTwitterExtensions(Activity activity,
Tweet tweet)
Takes various parameters from the twitter object that are currently not part of the
activity schema and stores them in a generic extensions attribute.
|
static List<Double> |
boundingBoxCenter(Place place)
Compute central coordinates from bounding box.
|
static ActivityObject |
buildActivityObject(Delete delete)
Builds the ActivityObject for the delete event.
|
static ActivityObject |
buildActivityObject(Tweet tweet)
Creates an
ActivityObject for the tweet. |
static ActivityObject |
buildActor(Delete delete)
Builds the actor for a delete event.
|
static ActivityObject |
buildActor(Tweet tweet)
Builds the activity
ActivityObject actor from the tweet. |
static ActivityObject |
buildActor(User user)
Builds the activity
ActivityObject actor from the User. |
static ActivityObject |
buildTarget(Tweet tweet)
Builds the
TargetObject from the tweet. |
static String |
formatId(String... idparts)
Formats the ID to conform with the Apache Streams activity ID convention.
|
static List<String> |
getLinks(Tweet tweet)
Gets the links from the Twitter event
|
static Provider |
getProvider()
Gets the common twitter
Provider object |
static void |
updateActivity(Delete delete,
Activity activity)
Updates the activity for a delete event.
|
static void |
updateActivity(Tweet tweet,
Activity activity)
Updates the given Activity object with the values from the Tweet.
|
static void |
updateActivity(User user,
Activity activity)
Updates the given Activity object with the values from the User
|
static void |
updateActivityContent(Activity activity,
Tweet tweet,
String verb)
Updates the content, and associated fields, with those from the given tweet
|
public static void updateActivity(Tweet tweet, Activity activity) throws ActivityConversionException
tweet
- the object to use as the sourceactivity
- the target of the updates. Will receive all values from the tweet.ActivityConversionException
- ActivityConversionExceptionpublic static void updateActivity(User user, Activity activity)
user
- the object to use as the sourceactivity
- the target of the updates. Will receive all values from the tweet.public static void updateActivity(Delete delete, Activity activity) throws ActivityConversionException
delete
- the delete eventactivity
- the Activity object to updateActivityConversionException
- ActivityConversionExceptionpublic static ActivityObject buildActor(Tweet tweet)
ActivityObject
actor from the tweet.tweet
- the object to use as the sourcepublic static ActivityObject buildActor(User user)
ActivityObject
actor from the User.user
- the object to use as the sourcepublic static ActivityObject buildActor(Delete delete)
delete
- the delete eventpublic static ActivityObject buildActivityObject(Tweet tweet)
ActivityObject
for the tweet.tweet
- the object to use as the sourcepublic static ActivityObject buildActivityObject(Delete delete)
delete
- the delete eventpublic static void updateActivityContent(Activity activity, Tweet tweet, String verb)
activity
- the target of the updates. Will receive all values from the tweet.tweet
- the object to use as the sourceverb
- the verb for the given activity's typepublic static List<String> getLinks(Tweet tweet)
tweet
- the object to use as the sourcepublic static ActivityObject buildTarget(Tweet tweet)
TargetObject
from the tweet.tweet
- the object to use as the sourcepublic static void addLocationExtension(Activity activity, Tweet tweet)
activity
- the Activity object to updatetweet
- the object to use as the sourcepublic static Provider getProvider()
Provider
objectpublic static void addTwitterExtension(Activity activity, com.fasterxml.jackson.databind.node.ObjectNode event)
activity
- the Activity object to updateevent
- the Twitter event to add as the extensionpublic static String formatId(String... idparts)
idparts
- the parts of the ID to joinpublic static void addTwitterExtensions(Activity activity, Tweet tweet)
activity
- Activitytweet
- TweetCopyright © 2018 The Apache Software Foundation. All rights reserved.