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


Java TwitterProfile类代码示例

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


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

示例1: findOrCreate

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
private UserEntity findOrCreate(final TwitterProfile twitterProfile) {

		UserEntity user = userRepository.findUserByTwitterId(twitterProfile.getId() + "");
		if (user != null) {
			return user;
		}

		user = new UserEntity();
		user.setCreatedDate(twitterProfile.getCreatedDate());
		user.setDescription(twitterProfile.getDescription());
		user.setLocation(twitterProfile.getLocation());
		user.setName(twitterProfile.getName());
		user.setProfileUrl(twitterProfile.getProfileUrl());
		user.setProfilImageUrl(twitterProfile.getProfileImageUrl());
		user.setScreenName(twitterProfile.getScreenName());
		user.setTwitterId(twitterProfile.getId() + "");

		user = userRepository.save(user);
		return user;
	}
 
开发者ID:ivanvs,项目名称:elasticsearch-spring-demo,代码行数:21,代码来源:TweetService.java

示例2: getRainUsernames

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
/**
 * parse user names in a tip rain command
 * @param userNames
 * @return
 */
List<String> getRainUsernames(String userNames){
    String[] splitted = userNames.split("@");
    String userName;
    List<String> result = new ArrayList<String>();
    for (String part : splitted){
        if (part.length() > 0){
            userName = part.trim();
            //verify if user exist
            TwitterProfile profile = twitterTemplate.userOperations().getUserProfile(userName);
            if (profile!=null){
                result.add(userName);
            }
        }
    }
    return result;
}
 
开发者ID:gill3s,项目名称:opentipbot,代码行数:22,代码来源:OpenTipBotService.java

示例3: helloTwitter

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的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

示例4: saveEs

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
private TweetEsEntity saveEs(final Tweet tweetEntity) {
	final TwitterProfile twitterProfile = tweetEntity.getUser();

	final UserEsEntity user = new UserEsEntity();
	user.setCreatedDate(twitterProfile.getCreatedDate());
	user.setDescription(twitterProfile.getDescription());
	user.setLocation(twitterProfile.getLocation());
	user.setName(twitterProfile.getName());
	user.setProfileUrl(twitterProfile.getProfileUrl());
	user.setProfilImageUrl(twitterProfile.getProfileImageUrl());
	user.setScreenName(twitterProfile.getScreenName());
	user.setTwitterId(twitterProfile.getId() + "");

	TweetEsEntity esTweet = new TweetEsEntity();
	esTweet.setCreatedAt(tweetEntity.getCreatedAt());
	esTweet.setLanguageCode(tweetEntity.getLanguageCode());
	esTweet.setSource(tweetEntity.getSource());
	esTweet.setText(tweetEntity.getText());
	esTweet.setUser(user);

	if (tweetEsRepository != null) {
		esTweet = tweetEsRepository.save(esTweet);
		return esTweet;
	}

	return null;
}
 
开发者ID:ivanvs,项目名称:elasticsearch-spring-demo,代码行数:28,代码来源:TweetService.java

示例5: User

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
public User(TwitterProfile twitterProfile) {
    this.profileId = twitterProfile.getId();
    this.createdDate = twitterProfile.getCreatedDate();
    this.screenName = twitterProfile.getScreenName();
    this.name = twitterProfile.getName();
    this.url = twitterProfile.getUrl();
    this.description = twitterProfile.getDescription();
    this.location = twitterProfile.getLocation();
    this.profileImageUrl = twitterProfile.getProfileImageUrl();
    this.followerCount = twitterProfile.getFollowersCount();
    this.followsCount = twitterProfile.getFriendsCount();
}
 
开发者ID:kbastani,项目名称:spring-boot-graph-processing-example,代码行数:13,代码来源:User.java

示例6: validateUserExists

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
private String validateUserExists(String toUserName) {
    try {
        TwitterProfile profile = twitterTemplate.userOperations().getUserProfile(toUserName);
        if (profile != null) {
            logger.info("user found : "+ profile.getScreenName());
            return profile.getScreenName();

        }
        else return null;
    } catch (ResourceNotFoundException e){
        return null;
    }
}
 
开发者ID:gill3s,项目名称:opentipbot,代码行数:14,代码来源:OpenTipBotService.java

示例7: findRandomFollower

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
/**
 * select a random follower of a given twitterTemplate user
 * @param fromUser
 * @return
 */
String findRandomFollower(long fromUser) {
    logger.debug("Searching a random follower of " + fromUser);
    List<TwitterProfile> followers = twitterTemplate.friendOperations().getFollowers(fromUser);

    Random generator = new Random();
    int choseOne = generator.nextInt(followers.size());

    TwitterProfile chosenProfile = followers.get(choseOne);
    logger.debug("Found :  @" + chosenProfile.getScreenName());
    return chosenProfile.getScreenName();
}
 
开发者ID:gill3s,项目名称:opentipbot,代码行数:17,代码来源:OpenTipBotService.java

示例8: User

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
public User(TwitterProfile user) {
    this.userId = user.getId();
    this.user = user.getScreenName();
    this.name = user.getName();
    createdDate = user.getCreatedDate();
    followers = user.getFollowersCount();
    friends = user.getFriendsCount();
    url = user.getUrl();
    image = user.getProfileImageUrl();
    language = user.getLanguage();
}
 
开发者ID:joshlong,项目名称:graphconnect-2014,代码行数:12,代码来源:User.java

示例9: getUserProfile

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
@RequestMapping(value = "/profile/{twitterUser}")
public TwitterProfile getUserProfile(@PathVariable String twitterUser) {
    return twitterService.getUserProfile(twitterUser);
}
 
开发者ID:tspannhw,项目名称:hive,代码行数:5,代码来源:DataController.java

示例10: getUserProfile

import org.springframework.social.twitter.api.TwitterProfile; //导入依赖的package包/类
/**
 * 
 * @param twitterUser
 * @return
 */
public TwitterProfile getUserProfile(String twitterUser) {
    UserOperations userOperations = twitter.userOperations();
    TwitterProfile userProfile = userOperations.getUserProfile(twitterUser);
    return userProfile;
}
 
开发者ID:tspannhw,项目名称:hive,代码行数:11,代码来源:TwitterService.java


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