Java Code Examples for org.springframework.social.twitter.api.Twitter

The following examples show how to use org.springframework.social.twitter.api.Twitter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Transactional
public TimelineMusic storeUserTimelinePiece(User user) {
    if (user == null) {
        return null;
    }

    SocialAuthentication auth = userDao.getTwitterAuthentication(user);

    if (auth == null) {
        return null;
    }

    Twitter twitter = provider.getApi(auth.getToken(), auth.getSecret());
    List<Tweet> tweets = twitter.timelineOperations().getUserTimeline(200);

    TimelineMusic meta = getUserTimelinePiece(tweets);
    meta.setTwitterHandle(twitter.userOperations().getScreenName());
    meta.setUser(user);

    meta = pieceDao.persist(meta);
    return meta;
}
 
Example 2
@Override
protected ConnectInterceptor<Twitter> getConnectInterceptor() {

              if( twitterConnectInterceptor == null ) {
                       twitterConnectInterceptor = new TwitterConnectInterceptor();
               }
               return twitterConnectInterceptor;
           //return twitterConnectInterceptor;
}
 
Example 3
@Override
protected ConnectInterceptor<Twitter> getConnectInterceptor() {

              if( twitterConnectInterceptor == null ) {
                       twitterConnectInterceptor = new TwitterConnectInterceptor();
               }
               return twitterConnectInterceptor;
           //return twitterConnectInterceptor;
}
 
Example 4
@Bean
public Twitter twitter(final @Value("${spring.social.twitter.appId}") String appId,
                       final @Value("${spring.social.twitter.appSecret}") String appSecret) {
    return new TwitterTemplate(appId, appSecret);
}
 
Example 5
@Bean
public Twitter twitter() {
    return Mockito.mock(Twitter.class);
}
 
Example 6
Source Project: lemonaid   Source File: TwitterClient.java    License: MIT License 4 votes vote down vote up
@Inject
public TwitterClient(Twitter twitter, ConnectionRepository connectionRepository) {
    this.twitter = twitter;
    this.connectionRepository = connectionRepository;
}
 
Example 7
Source Project: lemonaid   Source File: TwitterClient.java    License: MIT License 4 votes vote down vote up
public boolean isAuthenticated() {
	return connectionRepository.findPrimaryConnection(Twitter.class) != null;
}
 
Example 8
@Override
protected ConnectionFactory<Twitter> createConnectionFactory() {
	return new TwitterConnectionFactory(
			twitterConsumerKey, twitterConsumerSecret);
}
 
Example 9
@Override
protected ConnectionFactory<Twitter> createConnectionFactory() {
	return new TwitterConnectionFactory(
			twitterConsumerKey, twitterConsumerSecret);
}