Example usage for twitter4j Status getId

List of usage examples for twitter4j Status getId

Introduction

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

Prototype

long getId();

Source Link

Document

Returns the id of the status

Usage

From source file:org.botlibre.sense.twitter.Twitter.java

License:Open Source License

/**
 * Check search keywords.//w ww.  java 2s .co  m
 */
public void checkAutoFollowSearch(int friendCount) {
    if (getAutoFollowSearch().isEmpty()) {
        return;
    }
    log("Processing autofollow search", Level.FINE, getAutoFollowSearch());
    try {
        Network memory = getBot().memory().newMemory();
        Vertex twitter = memory.createVertex(getPrimitive());
        Vertex vertex = twitter.getRelationship(Primitive.LASTAUTOFOLLOWSEARCH);
        long last = 0;
        long max = 0;
        int count = 0;
        if (vertex != null) {
            last = ((Number) vertex.getData()).longValue();
        }
        for (String followSearch : getAutoFollowSearch()) {
            Query query = new Query(followSearch);
            if (vertex != null) {
                query.setSinceId(last);
            }
            SearchResource search = getConnection().search();
            QueryResult result = search.search(query);
            List<Status> tweets = result.getTweets();
            if (tweets != null) {
                for (Status tweet : tweets) {
                    if (count > this.maxSearch) {
                        break;
                    }
                    if (tweet.getId() > last) {
                        log("Autofollow search", Level.FINE, tweet.getText(), tweet.getUser().getScreenName(),
                                followSearch);
                        if (checkFriendship(tweet.getUser().getId(), false)) {
                            friendCount++;
                            if (friendCount >= getMaxFriends()) {
                                log("Max friend limit", Level.FINE, getMaxFriends());
                                return;
                            }
                        }
                        count++;
                        if (tweet.getId() > max) {
                            max = tweet.getId();
                        }
                    }
                }
            }
            if (count > this.maxSearch) {
                break;
            }
        }
        if (max != 0) {
            twitter.setRelationship(Primitive.LASTAUTOFOLLOWSEARCH, memory.createVertex(max));
            memory.save();
        }
    } catch (Exception exception) {
        log(exception);
    }
}

From source file:org.botlibre.sense.twitter.Twitter.java

License:Open Source License

/**
 * Retweet the tweet.//from   ww  w . j a  va  2s  . c  o  m
 */
public void retweet(Status tweet) {
    if (tweet.isRetweet()) {
        tweet = tweet.getRetweetedStatus();
    }
    if (tweet.getUser().isProtected()) {
        log("Cannot retweet protected user", Level.INFO, tweet.getUser().getScreenName(), tweet.getText());
        return;
    }
    this.retweets++;
    log("Retweeting:", Level.INFO, tweet.getText(), tweet.getUser().getScreenName());
    try {
        if (getConnection() == null) {
            connect();
        }
        getConnection().retweetStatus(tweet.getId());
    } catch (Exception exception) {
        if (exception.getMessage() != null && exception.getMessage().contains("authorized")
                && exception.getMessage().contains("endpoint")) {
            this.errors = this.errors + 5;
        }
        this.errors++;
        log(exception.toString(), Level.WARNING, tweet.getText());
    }
}

From source file:org.botlibre.sense.twitter.Twitter.java

License:Open Source License

/**
 * Process the email message./*from   ww  w. j av a2  s . c  om*/
 */
@Override
public void input(Object input, Network network) {
    if (!isEnabled()) {
        return;
    }
    try {
        if (input instanceof Status) {
            Status tweet = (Status) input;
            log("Processing status", Bot.FINE, tweet.getText(), tweet.getId());
            if ((System.currentTimeMillis() - tweet.getCreatedAt().getTime()) > DAY) {
                log("Day old status", Bot.FINE, tweet.getId(), tweet.getCreatedAt().getTime());
                return;
            }
            if (this.processedTweets.contains(tweet.getId())) {
                log("Already processed status", Bot.FINE, tweet.getText(), tweet.getId());
                return;
            }
            this.processedTweets.add(tweet.getId());
            String name = tweet.getUser().getScreenName();
            String replyTo = tweet.getInReplyToScreenName();
            String text = tweet.getText().trim();
            TextStream stream = new TextStream(text);
            String firstWord = null;
            if (getIgnoreReplies()) {
                if (stream.peek() == '@') {
                    stream.next();
                    String replyTo2 = stream.nextWord();
                    firstWord = stream.peekWord();
                    text = stream.upToEnd().trim();
                    if (!replyTo2.equals(replyTo)) {
                        log("Reply to does not match:", Bot.FINE, replyTo2, replyTo);
                    }
                    replyTo = replyTo2;
                    if (replyTo.equals(this.userName) && getFollowMessages()) {
                        if ("follow".equals(firstWord)) {
                            log("Adding friend", Level.INFO, tweet.getUser().getScreenName());
                            getConnection().createFriendship(tweet.getUser().getId());
                        } else if ("unfollow".equals(firstWord)) {
                            log("Removing friend", Level.INFO, tweet.getUser().getScreenName());
                            getConnection().destroyFriendship(tweet.getUser().getId());
                        }
                    }
                }
            } else {
                // Ignore the reply user, force the bot to reply.
                replyTo = null;
            }
            if (!tweet.isRetweet() && !tweet.getUser().isProtected()) {
                stream.reset();
                List<String> words = stream.allWords();
                for (String keywords : getRetweet()) {
                    List<String> keyWords = new TextStream(keywords).allWords();
                    if (!keyWords.isEmpty()) {
                        if (words.containsAll(keyWords)) {
                            retweet(tweet);
                            break;
                        }
                    }
                }
            }
            log("Input status", Level.FINE, tweet.getText(), name, replyTo);
            this.tweetsProcessed++;
            inputSentence(text, name, replyTo, tweet, network);
        }
    } catch (Exception exception) {
        log(exception);
    }
}

From source file:org.botlibre.sense.twitter.Twitter.java

License:Open Source License

/**
 * Process the text sentence.//from   w  ww . j  a v  a2s . c  om
 */
public void inputSentence(String text, String userName, String targetUserName, Status status, Network network) {
    Vertex input = createInput(text.trim(), network);
    Vertex sentence = input.getRelationship(Primitive.INPUT);
    Vertex id = network.createVertex(status.getId());
    if (sentence.hasRelationship(Primitive.TWEET, id)) {
        log("Status already processed", Bot.FINE, status.getId(), status.getCreatedAt().getTime());
        return;
    }
    sentence.addRelationship(Primitive.TWEET, id);
    input.addRelationship(Primitive.INSTANTIATION, Primitive.TWEET);
    input.addRelationship(Primitive.CREATEDAT, network.createVertex(status.getCreatedAt().getTime()));
    input.addRelationship(Primitive.ID, id);
    Vertex conversation = network.createInstance(Primitive.CONVERSATION);
    conversation.addRelationship(Primitive.TYPE, Primitive.TWEET);
    Language.addToConversation(input, conversation);
    Vertex user = network.createSpeaker(userName);
    conversation.addRelationship(Primitive.SPEAKER, user);
    input.addRelationship(Primitive.SPEAKER, user);
    if (targetUserName != null) {
        Vertex targetUser = null;
        if (targetUserName.equals(getUserName())) {
            targetUser = network.createVertex(Primitive.SELF);
        } else {
            targetUser = network.createSpeaker(targetUserName);
        }
        input.addRelationship(Primitive.TARGET, targetUser);
        conversation.addRelationship(Primitive.SPEAKER, targetUser);
    }

    network.save();
    getBot().memory().addActiveMemory(input);
}

From source file:org.codice.ddf.catalog.twitter.source.TwitterSource.java

License:Open Source License

private Metacard getMetacard(Status status) {
    MetacardImpl metacard = new MetacardImpl();
    metacard.setSourceId(id);//from  w w w  . j  a  v  a2s  .  c  o m
    metacard.setId(String.valueOf(status.getId()));
    metacard.setTitle(status.getText());
    metacard.setMetadata("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<Resource>"
            + "<name>" + status.getText() + "</name>" + "</Resource>");
    metacard.setCreatedDate(status.getCreatedAt());
    metacard.setModifiedDate(status.getCreatedAt());
    metacard.setEffectiveDate(status.getCreatedAt());
    metacard.setPointOfContact(status.getUser().getName());
    if (status.getURLEntities() != null && status.getURLEntities().length > 0) {
        try {
            metacard.setResourceURI(new URI(status.getURLEntities()[0].getExpandedURL()));
        } catch (URISyntaxException e) {
            LOGGER.error("Unable to set resource URI.", e);
        }
    } else if (status.getMediaEntities() != null && status.getMediaEntities().length > 0) {
        try {
            metacard.setResourceURI(new URI(status.getMediaEntities()[0].getExpandedURL()));
        } catch (URISyntaxException e) {
            LOGGER.error("Unable to set resource URI.", e);
        }
    } else if (status.getExtendedMediaEntities() != null && status.getExtendedMediaEntities().length > 0) {
        try {
            metacard.setResourceURI(new URI(status.getExtendedMediaEntities()[0].getExpandedURL()));
        } catch (URISyntaxException e) {
            LOGGER.error("Unable to set resource URI.", e);
        }
    }
    GeoLocation geoLocation = status.getGeoLocation();
    if (geoLocation != null) {
        metacard.setLocation("POINT (" + geoLocation.getLongitude() + " " + geoLocation.getLatitude() + ")");
    }

    return metacard;
}

From source file:org.encuestame.social.api.templates.TwitterAPITemplate.java

License:Apache License

/**
 * OAuth Public Tweet.//w  ww .  j  a v a2  s .c  om
 * @param socialTwitterAccount
 * @param tweet
 * @return
 * @throws TwitterException
 */
public TweetPublishedMetadata updateTwitterStatus(final String tweet) throws TwitterException {
    log.debug("twitter update status 2--> " + tweet);
    final Twitter twitter = this.getTwitterInstance();
    final Status twitterStatus = twitter.updateStatus(tweet);
    log.debug("twitter update status " + twitterStatus);
    TweetPublishedMetadata status = createStatus(tweet);
    status.setTweetId(String.valueOf(twitterStatus.getId()));
    //statusTweet.set status.g
    status.setDatePublished(twitterStatus.getCreatedAt());
    status.setProvider(this.socialAccount.getAccounType().name());
    status.setSocialAccountId(this.socialAccount.getId());
    status.setSocialAccountName(this.socialAccount.getSocialAccountName());
    //statusTweet.setProvider(SocialProvider.TWITTER);
    log.debug("twitter update statusTweet " + status);
    return status;
}

From source file:org.example.osgi.mailbox.twitter.FriendsTimeline.java

License:Open Source License

public long getInitialTimeline(Collection<? super Message> into) throws TwitterException {
    long highestStatusSeen = 0;

    List<Status> statuses = twitter.getFriendsTimeline();
    for (Status status : statuses) {
        long id = status.getId();

        highestStatusSeen = (id > highestStatusSeen) ? id : highestStatusSeen;
        into.add(new TweetMessage(status));
    }/*  w  w w. j a v  a  2  s . c o m*/

    return highestStatusSeen;
}

From source file:org.example.osgi.mailbox.twitter.FriendsTimeline.java

License:Open Source License

public long getTimelineSinceId(long sinceId, Collection<? super Message> into) throws TwitterException {
    long highestStatusSeen = 0;

    int page = 1;
    boolean done = false;

    while (!done) {
        List<Status> statuses = twitter.getFriendsTimelineByPage(page++);
        for (Status status : statuses) {
            long id = status.getId();

            highestStatusSeen = (id > highestStatusSeen) ? id : highestStatusSeen;
            if (id > sinceId) {
                into.add(new TweetMessage(status));
            } else {
                done = true;//from  w  ww . ja  v  a2 s.  com
                break;
            }
        }
    }

    return highestStatusSeen;
}

From source file:org.examproject.tweet.service.SimpleTweetService.java

License:Apache License

private TweetDto mapStatus(Status status) {
    TweetDto tweetDto = new TweetDto();
    tweetDto.setUserProfileImageURL(status.getUser().getProfileImageURL().toString());
    tweetDto.setUserName(status.getUser().getScreenName());
    tweetDto.setText(status.getText());/*from  w  w w . j a v  a  2  s  .c o  m*/
    tweetDto.setStatusId(String.valueOf(status.getId()));
    tweetDto.setCreated(status.getCreatedAt());
    tweetDto.setIsFavorited(status.isFavorited());
    tweetDto.setIsRetweetedByMe(status.isRetweetedByMe());
    return tweetDto;
}

From source file:org.gabrielebaldassarre.twitter.stream.tweet.TalendRowTweetBehaviour.java

License:Open Source License

public void visit(TalendFlow target) {
    ResourceBundle rb = ResourceBundle.getBundle("tTwitterStreamInput", Locale.getDefault());
    valid = false;//w ww  .j a  v a2s. c o  m

    if (status != null) {

        TalendRowFactory rowFactory = target.getModel().getRowFactory();
        Status tweet = status;
        status = null;
        TalendRow current = rowFactory.newRow(target);

        Iterator<Entry<TalendColumn, TweetField>> col = associations.entrySet().iterator();
        while (col.hasNext()) {
            List<String> h;
            List<Long> l;

            Map.Entry<TalendColumn, TweetField> row = (Map.Entry<TalendColumn, TweetField>) col.next();

            if (target != null && !row.getKey().getFlow().equals(target)) {
                throw new IllegalArgumentException(String.format(rb.getString("exception.columnNotInFlow"),
                        row.getKey().getName(), target.getName()));
            }

            switch (row.getValue()) {
            case CREATION_DATE:
                String literalDate = (new StringBuilder(
                        TalendRowTweetBehaviour.DATEFORMAT.format(tweet.getCreatedAt()))).toString();

                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(literalDate));
                case LONG:
                    current.setValue(row.getKey(), Long.parseLong(literalDate));
                case DOUBLE:
                    current.setValue(row.getKey(), Double.parseDouble(literalDate));
                case FLOAT:
                    current.setValue(row.getKey(), Float.parseFloat(literalDate));
                case INTEGER:
                    current.setValue(row.getKey(), Integer.parseInt(literalDate));
                case DATE:
                    current.setValue(row.getKey(), tweet.getCreatedAt());
                    break;
                case STRING:
                    current.setValue(row.getKey(), literalDate);
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case FROM_NAME:
                switch (row.getKey().getType()) {
                case STRING:
                    current.setValue(row.getKey(), tweet.getUser().getName());
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case FROM_USERID:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.getUser().getId()));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), new Double(tweet.getUser().getId()));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), new Float(tweet.getUser().getId()));
                    break;
                case LONG:
                    current.setValue(row.getKey(), new Long(tweet.getUser().getId()));
                    break;
                case STRING:
                    current.setValue(row.getKey(), String.valueOf((tweet.getUser().getId())));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case FROM_SCREEN_NAME:
                switch (row.getKey().getType()) {
                case STRING:
                    current.setValue(row.getKey(), tweet.getUser().getScreenName());
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case HASHTAGS:
                List<HashtagEntity> hashtags = Arrays.asList(tweet.getHashtagEntities());
                h = new ArrayList<String>(hashtags.size());

                for (HashtagEntity hashtag : hashtags) {
                    h.add((includeHash() ? "#" : "") + hashtag.getText());
                }
                switch (row.getKey().getType()) {
                case STRING:
                case LIST:
                    current.setValue(row.getKey(), !TalendType.STRING.equals(row.getKey().getType()) ? h
                            : Joiner.on(getEntitiesSeparator()).join(h));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case IS_FAVORITED:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.isFavorited() ? 1 : 0));
                    break;
                case BOOLEAN:
                    current.setValue(row.getKey(), tweet.isFavorited());
                    break;
                case BYTE:
                    current.setValue(row.getKey(), (byte) (tweet.isFavorited() ? 1 : 0));
                    break;
                case CHARACTER:
                    current.setValue(row.getKey(), (tweet.isFavorited() ? '1' : '0'));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), (double) (tweet.isFavorited() ? 1d : 0d));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), (float) (tweet.isFavorited() ? 1f : 0f));
                    break;
                case INTEGER:
                    current.setValue(row.getKey(), (tweet.isFavorited() ? 1 : 0));
                    break;
                case LONG:
                    current.setValue(row.getKey(), (long) (tweet.isFavorited() ? 1l : 0l));
                    break;
                case SHORT:
                    current.setValue(row.getKey(), (short) (tweet.isFavorited() ? (short) 1 : (short) 0));
                    break;
                case STRING:
                    current.setValue(row.getKey(), (tweet.isFavorited() ? "1" : "0"));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));

                }
                break;
            case IS_POSSIBLY_SENSITIVE:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.isPossiblySensitive() ? 1 : 0));
                    break;
                case BOOLEAN:
                    current.setValue(row.getKey(), tweet.isPossiblySensitive());
                    break;
                case BYTE:
                    current.setValue(row.getKey(), (byte) (tweet.isPossiblySensitive() ? 1 : 0));
                    break;
                case CHARACTER:
                    current.setValue(row.getKey(), (tweet.isPossiblySensitive() ? '1' : '0'));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), (double) (tweet.isPossiblySensitive() ? 1d : 0d));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), (float) (tweet.isPossiblySensitive() ? 1f : 0f));
                    break;
                case INTEGER:
                    current.setValue(row.getKey(), (tweet.isPossiblySensitive() ? 1 : 0));
                    break;
                case LONG:
                    current.setValue(row.getKey(), (long) (tweet.isPossiblySensitive() ? 1l : 0l));
                    break;
                case SHORT:
                    current.setValue(row.getKey(),
                            (short) (tweet.isPossiblySensitive() ? (short) 1 : (short) 0));
                    break;
                case STRING:
                    current.setValue(row.getKey(), (tweet.isPossiblySensitive() ? "1" : "0"));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case IS_RETWEET:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.isRetweet() ? 1 : 0));
                    break;
                case BOOLEAN:
                    current.setValue(row.getKey(), tweet.isRetweet());
                    break;
                case BYTE:
                    current.setValue(row.getKey(), (byte) (tweet.isRetweet() ? 1 : 0));
                    break;
                case CHARACTER:
                    current.setValue(row.getKey(), (tweet.isRetweet() ? '1' : '0'));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), (double) (tweet.isRetweet() ? 1d : 0d));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), (float) (tweet.isRetweet() ? 1f : 0f));
                    break;
                case INTEGER:
                    current.setValue(row.getKey(), (tweet.isRetweet() ? 1 : 0));
                    break;
                case LONG:
                    current.setValue(row.getKey(), (long) (tweet.isRetweet() ? 1l : 0l));
                    break;
                case SHORT:
                    current.setValue(row.getKey(), (short) (tweet.isRetweet() ? (short) 1 : (short) 0));
                    break;
                case STRING:
                    current.setValue(row.getKey(), (tweet.isRetweet() ? "1" : "0"));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                current.setValue(row.getKey(), tweet.isRetweet());
                break;
            case LOCATION:
                GeoLocation g = tweet.getGeoLocation();
                switch (row.getKey().getType()) {
                case STRING:
                    current.setValue(row.getKey(),
                            g != null
                                    ? String.valueOf(g.getLatitude()) + getEntitiesSeparator()
                                            + String.valueOf(g.getLongitude())
                                    : null);
                    break;
                case OBJECT:
                    current.setValue(row.getKey(), g);
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case REPLYTO_SCREEN_NAME:
                switch (row.getKey().getType()) {
                case STRING:
                    current.setValue(row.getKey(), tweet.getInReplyToScreenName());
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case REPLYTO_STATUSID:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.getInReplyToStatusId()));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), new Double(tweet.getInReplyToStatusId()));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), new Float(tweet.getInReplyToStatusId()));
                    break;
                case LONG:
                    current.setValue(row.getKey(), new Long(tweet.getInReplyToStatusId()));
                    break;
                case STRING:
                    current.setValue(row.getKey(), String.valueOf((tweet.getInReplyToStatusId())));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case REPLYTO_USERID:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.getInReplyToUserId()));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), new Double(tweet.getInReplyToUserId()));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), new Float(tweet.getInReplyToUserId()));
                    break;
                case LONG:
                    current.setValue(row.getKey(), new Long(tweet.getInReplyToUserId()));
                    break;
                case STRING:
                    current.setValue(row.getKey(), String.valueOf((tweet.getInReplyToUserId())));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case RETWEET_COUNT:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.getRetweetCount()));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), new Double(tweet.getRetweetCount()));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), new Float(tweet.getRetweetCount()));
                    break;
                case LONG:
                    current.setValue(row.getKey(), new Long(tweet.getRetweetCount()));
                    break;
                case STRING:
                    current.setValue(row.getKey(), String.valueOf((tweet.getRetweetCount())));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case SOURCE:
                switch (row.getKey().getType()) {
                case STRING:
                    current.setValue(row.getKey(), tweet.getSource());
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case STATUS_ID:
                switch (row.getKey().getType()) {
                case BIGDECIMAL:
                    current.setValue(row.getKey(), new BigDecimal(tweet.getId()));
                    break;
                case DOUBLE:
                    current.setValue(row.getKey(), new Double(tweet.getId()));
                    break;
                case FLOAT:
                    current.setValue(row.getKey(), new Float(tweet.getId()));
                    break;
                case LONG:
                    current.setValue(row.getKey(), new Long(tweet.getId()));
                    break;
                case STRING:
                    current.setValue(row.getKey(), String.valueOf((tweet.getId())));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case TEXT:
                switch (row.getKey().getType()) {
                case STRING:
                    current.setValue(row.getKey(), tweet.getText());
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case URL_ENTITIES:
            case URL_ENTITIES_STRING:
                List<URLEntity> urlEntities = Arrays.asList(tweet.getURLEntities());
                h = new ArrayList<String>(urlEntities.size());

                for (URLEntity urlEntity : urlEntities) {
                    h.add(urlEntity.getExpandedURL());
                }
                switch (row.getKey().getType()) {
                case STRING:
                case LIST:
                    current.setValue(row.getKey(), !TalendType.STRING.equals(row.getKey().getType()) ? h
                            : Joiner.on(getEntitiesSeparator()).join(h));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case USER_MENTIONS:
                List<UserMentionEntity> userMentionsEntities = Arrays.asList(tweet.getUserMentionEntities());
                l = new ArrayList<Long>(userMentionsEntities.size());

                for (UserMentionEntity userMention : userMentionsEntities) {
                    l.add(userMention.getId());
                }
                switch (row.getKey().getType()) {
                case STRING:
                case LIST:
                    current.setValue(row.getKey(), !TalendType.STRING.equals(row.getKey().getType()) ? l
                            : Joiner.on(getEntitiesSeparator()).join(l));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            case USER_MENTIONS_SCREEN_NAME:
                List<UserMentionEntity> userMentionsScreen = Arrays.asList(tweet.getUserMentionEntities());
                h = new ArrayList<String>(userMentionsScreen.size());

                for (UserMentionEntity userMention : userMentionsScreen) {
                    h.add((includeHash() ? "@" : "") + userMention.getScreenName());
                }
                switch (row.getKey().getType()) {
                case STRING:
                case LIST:
                    current.setValue(row.getKey(), !TalendType.STRING.equals(row.getKey().getType()) ? h
                            : Joiner.on(getEntitiesSeparator()).join(h));
                    break;
                default:
                    throw new IllegalArgumentException(String.format(rb.getString("exception.uncastableColumn"),
                            row.getKey().getType().getTypeString(), row.getKey().getName()));
                }
                break;
            default:
                throw new IllegalArgumentException(
                        String.format(rb.getString("exception.unparseableColumn"), row.getKey().getName()));

            }
        }

    }

    valid = true;
}