Package twitter4j

Examples of twitter4j.Status


        @Override
        public void run() {
            while (true) {
                try {
                    Status status = messageQueue.take();
                    Event event = new Event();
                    event.put("statusText", String.class, status.getText());
                    getRemoteStream().put(event);
                } catch (Exception e) {

                }
            }
View Full Code Here


  // Afegeix un tweet
  public static void updateWhatAreYouDoing(String latestStatus)
  {
    // The factory instance is re-useable and thread safe.
      twitter = new TwitterFactory().getInstance();
      Status status;
    try {
      status = twitter.updateStatus(latestStatus);
      System.out.println("Successfully updated the status to [" + status.getText() + "].");
    } catch (TwitterException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
View Full Code Here

        simulateInputMessage();
    }

    private void simulateInputMessage() throws ParseException {
        Status fakeStatus = fakeTwitterStatus("2013/01/05 12:34", "ippontech", "a first tweet");
        template.sendBody("direct:twitterRouteTest", fakeStatus);
    }
View Full Code Here

    private Status fakeTwitterStatus(String createdAtAsStr, String screenName, String text) throws ParseException {
        // cf {@link TwitterConverter.toString} : we only need date, user and text at the moment
        User user = mock(User.class);
        when(user.getScreenName()).thenReturn(screenName);
        Status status = mock(Status.class);
        Date createdAt = new SimpleDateFormat("yyyy/MM/dd HH:mm").parse(createdAtAsStr);
        when(status.getUser()).thenReturn(user);
        when(status.getCreatedAt()).thenReturn(createdAt);
        when(status.getText()).thenReturn(text);

        return status;
    }
View Full Code Here

     * @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);
View Full Code Here

        if (tweet.getUserMentionEntities() != null) {
            extractMentionedAccounts(tweet, contents);
        }

        // retweeted account
        Status retweeted = tweet.getRetweetedStatus();
        if (retweeted != null) {
            extractRetweetedAccounts(tweet, contents, retweeted);
            extractRetweetedStatuses(tweet, contents, retweeted);
        }
View Full Code Here

*/
public class ExtractLocation extends BaseFunction {

    @Override
    public void execute(TridentTuple tuple, TridentCollector collector) {
        Status status = (Status) tuple.get(0);
        Content content = (Content) tuple.get(1);

        collector.emit(new Values(status.getPlace().getCountryCode(), content.getContentName()));
    }
View Full Code Here

    @Override
    public void execute(TridentTuple tuple, TridentCollector collector) {
        if(extracter == null) extracter = new ContentExtracter();

        String rawTweetJson = (String)tuple.get(0);
        Status parsed = parse(rawTweetJson);
        User user = parsed.getUser();

        for (Content content : extracter.extract(parsed)) {
            collector.emit(new Values(parsed, content, user));
        }
    }
View Full Code Here

        }
    }

    private Status parse(String rawJson){
        try {
            Status parsed = DataObjectFactory.createStatus(rawJson);
            return parsed;
        } catch (TwitterException e) {
            log.warn("Invalid tweet json -> " + rawJson, e);
            return null;
        }
View Full Code Here

* @author Enno Shioji (enno.shioji@peerindex.com)
*/
public class OnlyGeo extends BaseFilter {
    @Override
    public boolean isKeep(TridentTuple tuple) {
        Status status = (Status) tuple.get(0);
        return !(null == status.getPlace() || null == status.getPlace().getCountryCode());
    }
View Full Code Here

TOP

Related Classes of twitter4j.Status

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.