Example usage for twitter4j Status getSymbolEntities

List of usage examples for twitter4j Status getSymbolEntities

Introduction

In this page you can find the example usage for twitter4j Status getSymbolEntities.

Prototype

SymbolEntity[] getSymbolEntities();

Source Link

Document

Returns an array of SymbolEntities if medias are available in the tweet.

Usage

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

public static void convert(Status status, Struct struct) {
    struct.put("CreatedAt", status.getCreatedAt()).put("Id", status.getId()).put("Text", status.getText())
            .put("Source", status.getSource()).put("Truncated", status.isTruncated())
            .put("InReplyToStatusId", status.getInReplyToStatusId())
            .put("InReplyToUserId", status.getInReplyToUserId())
            .put("InReplyToScreenName", status.getInReplyToScreenName()).put("Favorited", status.isFavorited())
            .put("Retweeted", status.isRetweeted()).put("FavoriteCount", status.getFavoriteCount())
            .put("Retweet", status.isRetweet()).put("RetweetCount", status.getRetweetCount())
            .put("RetweetedByMe", status.isRetweetedByMe())
            .put("CurrentUserRetweetId", status.getCurrentUserRetweetId())
            .put("PossiblySensitive", status.isPossiblySensitive()).put("Lang", status.getLang());

    Struct userStruct;//from  w ww  . j a v  a 2s  .  c o  m
    if (null != status.getUser()) {
        userStruct = new Struct(USER_SCHEMA);
        convert(status.getUser(), userStruct);
    } else {
        userStruct = null;
    }
    struct.put("User", userStruct);

    Struct placeStruct;
    if (null != status.getPlace()) {
        placeStruct = new Struct(PLACE_SCHEMA);
        convert(status.getPlace(), placeStruct);
    } else {
        placeStruct = null;
    }
    struct.put("Place", placeStruct);

    Struct geoLocationStruct;
    if (null != status.getGeoLocation()) {
        geoLocationStruct = new Struct(GEO_LOCATION_SCHEMA);
        convert(status.getGeoLocation(), geoLocationStruct);
    } else {
        geoLocationStruct = null;
    }
    struct.put("GeoLocation", geoLocationStruct);
    List<Long> contributers = new ArrayList<>();

    if (null != status.getContributors()) {
        for (Long l : status.getContributors()) {
            contributers.add(l);
        }
    }
    struct.put("Contributors", contributers);

    List<String> withheldInCountries = new ArrayList<>();
    if (null != status.getWithheldInCountries()) {
        for (String s : status.getWithheldInCountries()) {
            withheldInCountries.add(s);
        }
    }
    struct.put("WithheldInCountries", withheldInCountries);

    struct.put("HashtagEntities", convert(status.getHashtagEntities()));
    struct.put("UserMentionEntities", convert(status.getUserMentionEntities()));
    struct.put("MediaEntities", convert(status.getMediaEntities()));
    struct.put("SymbolEntities", convert(status.getSymbolEntities()));
    struct.put("URLEntities", convert(status.getURLEntities()));
}

From source file:net.lacolaco.smileessence.viewmodel.StatusViewModel.java

License:Open Source License

public StatusViewModel(Status status, Account account) {
    if (status.isRetweet()) {
        retweetedStatus = new StatusViewModel(status.getRetweetedStatus(), account);
    }//from   w  w  w.j  a va 2s  .c om
    id = status.getId();
    text = TwitterUtils.replaceURLEntities(status.getText(), status.getURLEntities(), false);
    createdAt = status.getCreatedAt();
    source = status.getSource();
    mentions = status.getUserMentionEntities();
    hashtags = status.getHashtagEntities();
    media = status.getMediaEntities();
    urls = status.getURLEntities();
    symbols = status.getSymbolEntities();
    User user = status.getUser();
    UserCache.getInstance().put(user);
    userID = user.getId();
    screenName = user.getScreenName();
    name = user.getName();
    iconURL = user.getProfileImageURLHttps();
    isProtected = user.isProtected();
    setMention(isMention(account.screenName));
    setMyStatus(isMyStatus(account.userID));
    setRetweetOfMe(isRetweetOfMe(account.userID));
}

From source file:net.nokok.twitduke.core.twitter.StatusParser.java

License:Open Source License

/**
 * ???????//  w ww .  j  a v  a2  s .com
 *
 * @param status 
 *
 * @return ?
 */
public List<SymbolEntity> createSymbolEntityList(Status status) {
    return Stream.of(status.getSymbolEntities()).collect(Collectors.toCollection(ArrayList::new));
}