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

The following examples show how to use org.springframework.social.twitter.api.Twitter. 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
Source File: TimelineToMusicService.java    From computoser with GNU Affero General Public License v3.0 6 votes vote down vote up
@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
Source File: TwitterProviderConfig.java    From AIDR with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected ConnectInterceptor<Twitter> getConnectInterceptor() {

              if( twitterConnectInterceptor == null ) {
                       twitterConnectInterceptor = new TwitterConnectInterceptor();
               }
               return twitterConnectInterceptor;
           //return twitterConnectInterceptor;
}
 
Example #3
Source File: TwitterProviderConfig.java    From AIDR with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected ConnectInterceptor<Twitter> getConnectInterceptor() {

              if( twitterConnectInterceptor == null ) {
                       twitterConnectInterceptor = new TwitterConnectInterceptor();
               }
               return twitterConnectInterceptor;
           //return twitterConnectInterceptor;
}
 
Example #4
Source File: SocialZwitscherConfiguration.java    From cloud-native-zwitscher with MIT License 4 votes vote down vote up
@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
Source File: ZwitscherServiceApplicationTests.java    From cloud-native-zwitscher with MIT License 4 votes vote down vote up
@Bean
public Twitter twitter() {
    return Mockito.mock(Twitter.class);
}
 
Example #6
Source File: TwitterClient.java    From lemonaid with MIT License 4 votes vote down vote up
@Inject
public TwitterClient(Twitter twitter, ConnectionRepository connectionRepository) {
    this.twitter = twitter;
    this.connectionRepository = connectionRepository;
}
 
Example #7
Source File: TwitterClient.java    From lemonaid with MIT License 4 votes vote down vote up
public boolean isAuthenticated() {
	return connectionRepository.findPrimaryConnection(Twitter.class) != null;
}
 
Example #8
Source File: TwitterProviderConfig.java    From AIDR with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected ConnectionFactory<Twitter> createConnectionFactory() {
	return new TwitterConnectionFactory(
			twitterConsumerKey, twitterConsumerSecret);
}
 
Example #9
Source File: TwitterProviderConfig.java    From AIDR with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected ConnectionFactory<Twitter> createConnectionFactory() {
	return new TwitterConnectionFactory(
			twitterConsumerKey, twitterConsumerSecret);
}