当前位置: 首页>>代码示例>>Java>>正文


Java Twitter类代码示例

本文整理汇总了Java中org.springframework.social.twitter.api.Twitter的典型用法代码示例。如果您正苦于以下问题:Java Twitter类的具体用法?Java Twitter怎么用?Java Twitter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Twitter类属于org.springframework.social.twitter.api包,在下文中一共展示了Twitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addProfile

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
/**
 * Add profile information to the model map.
 *
 * @param map
 *            the model map
 * @param principal
 *            the princial or <code>null</code>
 */
private void addProfile(ModelMap map, Principal principal) {
	if (principal != null) {
		Connection<?> connection = null;
		connection = connectionRepository.findPrimaryConnection(Twitter.class);
		if (connection == null)
			connection = connectionRepository.findPrimaryConnection(Google.class);
		if (connection == null)
			connection = connectionRepository.findPrimaryConnection(GitHub.class);
		if (connection != null) {
			map.addAttribute("profileImage", connection.getImageUrl());
			map.addAttribute("profile", connection.getProfileUrl());
		}
		Account findAccountByUsername = accountRepository.findOne(principal.getName());
		map.addAttribute(findAccountByUsername);
	}
}
 
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:25,代码来源:AbstractController.java

示例2: expectTwitterConfigurationOnly

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void expectTwitterConfigurationOnly() throws Exception {
	setupContext("spring.social.twitter.appId:12345",
			"spring.social.twitter.appSecret:secret");
	assertConnectionFrameworkBeans();
	assertThat(this.context.getBean(Twitter.class)).isNotNull();
	assertMissingBean(Facebook.class);
	assertMissingBean(LinkedIn.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:MultiApiAutoConfigurationTests.java

示例3: expectFacebookConfigurationOnly

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void expectFacebookConfigurationOnly() throws Exception {
	setupContext("spring.social.facebook.appId:12345",
			"spring.social.facebook.appSecret:secret");
	assertConnectionFrameworkBeans();
	assertThat(this.context.getBean(Facebook.class)).isNotNull();
	assertMissingBean(Twitter.class);
	assertMissingBean(LinkedIn.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:MultiApiAutoConfigurationTests.java

示例4: expectLinkedInConfigurationOnly

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void expectLinkedInConfigurationOnly() throws Exception {
	setupContext("spring.social.linkedin.appId:12345",
			"spring.social.linkedin.appSecret:secret");
	assertConnectionFrameworkBeans();
	assertThat(this.context.getBean(LinkedIn.class)).isNotNull();
	assertMissingBean(Twitter.class);
	assertMissingBean(Facebook.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:MultiApiAutoConfigurationTests.java

示例5: expectFacebookAndLinkedInConfigurationOnly

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void expectFacebookAndLinkedInConfigurationOnly() throws Exception {
	setupContext("spring.social.facebook.appId:54321",
			"spring.social.facebook.appSecret:shhhhh",
			"spring.social.linkedin.appId:12345",
			"spring.social.linkedin.appSecret:secret");
	assertConnectionFrameworkBeans();
	assertThat(this.context.getBean(Facebook.class)).isNotNull();
	assertThat(this.context.getBean(LinkedIn.class)).isNotNull();
	assertMissingBean(Twitter.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MultiApiAutoConfigurationTests.java

示例6: expectFacebookAndTwitterConfigurationOnly

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void expectFacebookAndTwitterConfigurationOnly() throws Exception {
	setupContext("spring.social.facebook.appId:54321",
			"spring.social.facebook.appSecret:shhhhh",
			"spring.social.twitter.appId:12345",
			"spring.social.twitter.appSecret:secret");
	assertConnectionFrameworkBeans();
	assertThat(this.context.getBean(Facebook.class)).isNotNull();
	assertThat(this.context.getBean(Twitter.class)).isNotNull();
	assertMissingBean(LinkedIn.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MultiApiAutoConfigurationTests.java

示例7: expectLinkedInAndTwitterConfigurationOnly

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void expectLinkedInAndTwitterConfigurationOnly() throws Exception {
	setupContext("spring.social.linkedin.appId:54321",
			"spring.social.linkedin.appSecret:shhhhh",
			"spring.social.twitter.appId:12345",
			"spring.social.twitter.appSecret:secret");
	assertConnectionFrameworkBeans();
	assertThat(this.context.getBean(LinkedIn.class)).isNotNull();
	assertThat(this.context.getBean(Twitter.class)).isNotNull();
	assertMissingBean(Facebook.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MultiApiAutoConfigurationTests.java

示例8: noSocialBeansCreatedWhenPropertiesArentSet

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void noSocialBeansCreatedWhenPropertiesArentSet() throws Exception {
	setupContext();
	assertNoConnectionFrameworkBeans();
	assertMissingBean(Twitter.class);
	assertMissingBean(Facebook.class);
	assertMissingBean(LinkedIn.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:MultiApiAutoConfigurationTests.java

示例9: storeUserTimelinePiece

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@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;
}
 
开发者ID:Glamdring,项目名称:computoser,代码行数:23,代码来源:TimelineToMusicService.java

示例10: TwitterController

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Autowired
public TwitterController(Twitter twitter, ConnectionRepository connectionRepository,
                         AnalysisProcessing analysisProcessing, GraphService graphService, OfferDataService offerDataService, MaxSatSolver maxSatSolver) {
    this.twitter = twitter;
    this.connectionRepository = connectionRepository;
    this.analysisProcessing = analysisProcessing;
    this.graphService = graphService;
    this.offerDataService = offerDataService;
    this.maxSatSolver = maxSatSolver;
}
 
开发者ID:Vapsel,项目名称:social-media-analytic-system,代码行数:11,代码来源:TwitterController.java

示例11: helloTwitter

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
/**
 * /connect/twitter path is handled by ConnectController.
 * It will kick off the OAuth authorization code flow. -->
 * @param model
 * @return
 */
@RequestMapping(method= RequestMethod.GET)
public String helloTwitter(Model model) {
    if (connectionRepository.findPrimaryConnection(Twitter.class) == null) {
        return "redirect:/connect/twitter";
    }
    Set<String> favoriteTexts = getFavoriteTexts();
    Map<NotionNodeData, Long> preferenceToProbability = analysisProcessing.findKeywordsInSentences(favoriteTexts);
    List<Integer> userPreferenceIds = preferenceToProbability.entrySet().stream()
        .map(e -> e.getKey().getId().intValue())
        .collect(Collectors.toList());
    int[] userPrefIds = convertListToArray(userPreferenceIds);


    Map<Long, List<Integer>> offerIdToRelatedNodeIds = offerDataService.findAll().stream()
        .collect(Collectors.toMap(o -> o.getId(),
            o -> o.getRelatedNodes().stream()
                .map(n -> n.getId().intValue())
                .collect(Collectors.toList())));

    Map<Long, Integer> offerIdToMaxResult = offerIdToRelatedNodeIds.entrySet().stream()
        .collect(Collectors.toMap(e -> e.getKey(),
            e -> maxSatSolver.iloscDopasowan(userPrefIds, convertListToArray(e.getValue()))))
        .entrySet().stream()
        .sorted((e1, e2) -> e2.getValue().compareTo(e1.getValue()))
        .collect(Collectors.toMap(e -> e.getKey(),
            e -> e.getValue(), (e1, e2) -> e2, LinkedHashMap::new));

    model.addAttribute(twitter.userOperations().getUserProfile());
    CursoredList<TwitterProfile> friends = twitter.friendOperations().getFriends();
    model.addAttribute("friends", friends);
    model.addAttribute("preferences", preferenceToProbability);
    model.addAttribute("offers", offerIdToMaxResult);
    return "html/hello";
}
 
开发者ID:Vapsel,项目名称:social-media-analytic-system,代码行数:41,代码来源:TwitterController.java

示例12: twitter

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Bean
// Params injected from application.properties file:
public Twitter twitter(final @Value("${spring.social.twitter.appId}") String appId,
                       final @Value("${spring.social.twitter.appSecret}") String appSecret,
                       final @Value("${spring.social.twitter.accessToken}") String accessToken,
                       final @Value("${spring.social.twitter.accessTokenSecret}") String accessTokenSecret) {
    return new TwitterTemplate(appId, appSecret, accessToken, accessTokenSecret);
}
 
开发者ID:thinksky-sourcecode,项目名称:microservices-prototype,代码行数:9,代码来源:TwitterConfig.java

示例13: twitter

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Twitter twitter(ConnectionRepository repository) {
    Connection<Twitter> connection = repository
            .findPrimaryConnection(Twitter.class);
    if (connection != null) {
        return connection.getApi();
    }
    return new TwitterTemplate(this.properties.getAppId(),
            this.properties.getAppSecret());
}
 
开发者ID:Turbots,项目名称:SpringOne2016,代码行数:13,代码来源:TwitterRedisAutoConfiguration.java

示例14: twitter

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Twitter twitter(ConnectionRepository repository) {
	Connection<Twitter> connection = repository
			.findPrimaryConnection(Twitter.class);
	if (connection != null) {
		return connection.getApi();
	}
	return new TwitterTemplate(this.properties.getAppId(),
			this.properties.getAppSecret());
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:TwitterAutoConfiguration.java

示例15: expectedSocialBeansCreated

import org.springframework.social.twitter.api.Twitter; //导入依赖的package包/类
@Test
public void expectedSocialBeansCreated() throws Exception {
	this.context = new AnnotationConfigWebApplicationContext();
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.social.twitter.appId:12345");
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.social.twitter.appSecret:secret");
	this.context.register(TwitterAutoConfiguration.class);
	this.context.register(SocialWebAutoConfiguration.class);
	this.context.refresh();
	assertConnectionFrameworkBeans();
	assertThat(this.context.getBean(Twitter.class)).isNotNull();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:TwitterAutoConfigurationTests.java


注:本文中的org.springframework.social.twitter.api.Twitter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。