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


Java User.getId方法代码示例

本文整理汇总了Java中com.restfb.types.User.getId方法的典型用法代码示例。如果您正苦于以下问题:Java User.getId方法的具体用法?Java User.getId怎么用?Java User.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.restfb.types.User的用法示例。


在下文中一共展示了User.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launch

import com.restfb.types.User; //导入方法依赖的package包/类
@Override
public boolean launch(String arguments) {
    MY_ACCESS_TOKEN = arguments;
    Runnable facebookProcessor = new Runnable() {
        @Override
        public void run() {
            // Start by fetching the user's own posts first. Posts include statuses,
            // links, photos, videos. Once the user's own posts are completely processed,
            // the reporter will iteratively fetch posts for the user's friends.
            client = new DefaultFacebookClient(MY_ACCESS_TOKEN);
            User me = client.fetchObject("me", User.class);
            String myId = me.getId();
            Process myVertex = getUserVertex(myId);
            processUserPhotos(myId);
            processUserPosts(myId);
            Connection<User> myFriends = client.fetchConnection("me/friends", User.class);

            for (List<User> myFriend : myFriends) {
                for (User friend : myFriend) {
                    String friendId = friend.getId();
                    Process friendVertex = getUserVertex(friendId);
                    WasTriggeredBy wtb = new WasTriggeredBy(friendVertex, myVertex);
                    putEdge(wtb);
                    processUserPosts(friendId);
                    processUserPhotos(friendId);
                }
            }
        }
    };
    Thread facebookThread = new Thread(facebookProcessor, "Facebook-Thread");
    facebookThread.start();

    return true;
}
 
开发者ID:ashish-gehani,项目名称:SPADE,代码行数:35,代码来源:Facebook.java

示例2: main

import com.restfb.types.User; //导入方法依赖的package包/类
public static void main(String[] args) {
    FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN);
    Connection<User> myFriends = facebookClient.fetchConnection("me/friends", User.class, Parameter.with("limit", "500"));
    //Connection<Post> myFeed = facebookClient.fetchConnection("me/feed", Post.class);

    System.out.println("Count of my friends: " + myFriends.getData().size());
    //System.out.println("First item in my feed: " + myFeed.getData().get(0));
    int usersNumber = myFriends.getData().size();
    int arraySize = 1;
    String[] userArr;
    if (arraySize < usersNumber) {
        userArr = new String[arraySize];
    } else {
        userArr = new String[usersNumber];
    }
    usersNumber -= userArr.length;
    int count = 0;
    for (List<User> listUsers : myFriends) {
        for (User user : listUsers) {
            userArr[count] = user.getId();
            count++;
            if (count >= userArr.length) {
                DownloadData dd = new DownloadData();
                dd.userIds = userArr;
                new Thread(dd).start();
                count = 0;
                if (arraySize < usersNumber) {
                    userArr = new String[arraySize];
                } else {
                    userArr = new String[usersNumber];
                }
                usersNumber -= userArr.length;
            }
        }
    }
}
 
开发者ID:milenchechev,项目名称:RecommendedStream,代码行数:37,代码来源:DownloadData.java

示例3: fetchUserProfile

import com.restfb.types.User; //导入方法依赖的package包/类
public UserProfile fetchUserProfile(String uid) {
	FacebookClient facebookClient = new DefaultFacebookClient(tokenCache.getToken(uid));
	User user = facebookClient.fetchObject("me", User.class);
	UserProfile profile = new UserProfile(user.getId(), 
			user.getName() == null ? user.getFirstName() : user.getName(), user.getBirthday());
	return profile;
}
 
开发者ID:BappaMorya,项目名称:play-tech-demo,代码行数:8,代码来源:FBManager.java

示例4: getUserFromAPI

import com.restfb.types.User; //导入方法依赖的package包/类
@Deprecated
private FacebookProfile getUserFromAPI(String userN) {
	User auser = null;
	try {
		auser = apiConnection.fetchObject(userN, User.class);
		FacebookProfile fbp = new FacebookProfile(auser.getUsername(), auser.getId());
		fbp.setName(auser.getFirstName(), auser.getLastName());
		fbp.setLink(auser.getLink());
		fbp.setLocales(auser.getLocale());
		return fbp;
	} catch (FacebookException e) {
		// do nothing
	}
	return null;
}
 
开发者ID:fabiogermann,项目名称:zhaw-facepath,代码行数:16,代码来源:FacebookFacade.java

示例5: FacebookAccount

import com.restfb.types.User; //导入方法依赖的package包/类
/**
 * Maps the information of a facebook user
 *
 * @param user - Facebook's user
 */
public FacebookAccount(User user) {

    if (user == null) return;

    //Id
    setId(Sources.FACEBOOK + "#" + user.getId());

    //The id of the user in the network
    //username = user.getId();

    //The name of the user
    if (user.getFirstName() == null && user.getLastName() == null)
        name = user.getName();
    else if (user.getMiddleName() != null)
        name = user.getFirstName() + " " + user.getMiddleName() + " " + user.getLastName();
    else
        name = user.getFirstName() + " " + user.getLastName();

    //The username of the user
    username = user.getUsername();

    //streamId
    source = Sources.FACEBOOK;

    //The description of the user
    description = user.getAbout();

    //The link to the user's profile
    pageUrl = user.getLink();
    if (pageUrl == null) {
        pageUrl = username == null ? ("https://www.facebook.com/profile.php?id=" + user.getId()) : ("http://www.facebook.com/" + username);
    }

    avatarBig = "https://graph.facebook.com/" + user.getId() + "/picture";

    //Last time user's profile was updated
    //if (user.getUpdatedTime() != null)
    //= user.getUpdatedTime().getTime();

    //Location
    if (user.getLocation() != null)
        location = user.getLocation().getName();

    //Is the user a verified user
    if (user.getVerified() != null)
        isVerified = user.getVerified();


}
 
开发者ID:MKLab-ITI,项目名称:simmo,代码行数:55,代码来源:FacebookAccount.java

示例6: FacebookStreamUser

import com.restfb.types.User; //导入方法依赖的package包/类
/**
 * Maps the information of a facebook user
 * @param user
 */
public FacebookStreamUser(User user) {
	super(SocialNetworkSource.Facebook.toString(), Operation.NEW);
	
	if (user == null) return;
	
	//Id
	id = SocialNetworkSource.Facebook+"#"+user.getId();
	
	//The id of the user in the network
	userid = user.getId();
	
	//The name of the user
	if(user.getFirstName() == null && user.getLastName() == null)
		name = user.getName();
	else if(user.getMiddleName() != null) 
		name = user.getFirstName()+" "+user.getMiddleName()+" "+user.getLastName();
	else
		name = user.getFirstName()+" "+user.getLastName();
	
	//The username of the user
	username = user.getUsername();
	
	//streamId
	streamId =  SocialNetworkSource.Facebook.toString();
	
	//The description of the user
	description = user.getAbout();
	
	//The link to the user's profile
	pageUrl = user.getLink(); 
	if(pageUrl == null) {
		pageUrl = username==null ? ("https://www.facebook.com/profile.php?id="+userid) : ("http://www.facebook.com/"+username);
	}
	
	profileImage = "https://graph.facebook.com/" + userid + "/picture";
	imageUrl = profileImage;
	
	//Last time user's profile was updated
	if(user.getUpdatedTime() != null)
		lastUpdated = user.getUpdatedTime().getTime();
	
	//Location
	if(user.getLocation()!= null)
		location = user.getLocation().getName();
	
	//Is the user a verified user
	if(user.getVerified() != null)
		verified = user.getVerified();
	
	
}
 
开发者ID:socialsensor,项目名称:socialmedia-abstractions,代码行数:56,代码来源:FacebookStreamUser.java


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