本文整理汇总了Java中com.restfb.types.Page类的典型用法代码示例。如果您正苦于以下问题:Java Page类的具体用法?Java Page怎么用?Java Page使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Page类属于com.restfb.types包,在下文中一共展示了Page类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: collectFeed
import com.restfb.types.Page; //导入依赖的package包/类
private Connection<Post> collectFeed(String pagename) {
AccessToken accessToken = new DefaultFacebookClient(Version.VERSION_2_3).obtainAppAccessToken(ConfigurationObject.MY_APP_ID, ConfigurationObject.MY_APP_SECRET);
FacebookClient facebookClient23 = new DefaultFacebookClient(accessToken.getAccessToken(), Version.VERSION_2_3);
//User user = facebookClient23.fetchObject("me", User.class);
Page page = facebookClient23.fetchObject(pagename, Page.class, Parameter.with("fields","name,id, picture, likes"));
return facebookClient23.fetchConnection(page.getId()+"/feed", Post.class, Parameter.with("fields", "comments, full_picture")); //message,picture, likes, from,
}
开发者ID:chenav,项目名称:orufeo,代码行数:10,代码来源:FacebookBoImpl.java
示例2: SearchFacebookPages
import com.restfb.types.Page; //导入依赖的package包/类
public void SearchFacebookPages(String queryPar, Integer PageSize) {
Connection<Page> publicSearch;
if (queryPar != null) {
resultPages = new ArrayList();
facebookClient = new DefaultFacebookClient();
publicSearch = facebookClient.fetchConnection("search", Page.class,
Parameter.with("q", queryPar),
Parameter.with("type", "page"),
Parameter.with("limit", PageSize));
for (int i = 0; i < publicSearch.getData().size(); i++) {
if (publicSearch.getData().get(i).getName() != null) {
resultPages.add(new FacebookPageData(publicSearch.getData()
.get(i)));
}
}
}
}
开发者ID:SmartSearch,项目名称:Edge-Node,代码行数:21,代码来源:FacebookDriver.java
示例3: mapNamedType
import com.restfb.types.Page; //导入依赖的package包/类
protected Topic mapNamedType(NamedFacebookType type, TopicMap tm) throws TopicMapException{
Topic t;
// ToDo: resolve appropriate wrapper automatically
if(type instanceof Place){
Place place = (Place)type;
PlaceWrapper placeWrapper = new PlaceWrapper(place);
t = placeWrapper.mapToTopicMap(tm);
} else if (type instanceof Page){
Page page = (Page)type;
PageWrapper pageWrapper = new PageWrapper(page);
t = pageWrapper.mapToTopicMap(tm);
} else {
StubWrapper stub = new StubWrapper(type);
t = stub.mapToTopicMap(tm);
}
return t;
}
开发者ID:wandora-team,项目名称:wandora,代码行数:19,代码来源:AbstractFBWrapper.java
示例4: initOrganization
import com.restfb.types.Page; //导入依赖的package包/类
@Override
public void initOrganization(Organization org, String fbPageName) {
DefaultFacebookClient fbClient = new DefaultFacebookClient(getAppCredentials().getToken());
// Getting age_range unfortunately requires explicitly specifiying the fields.
Page fbPage = fetchObject(fbClient, fbPageName, Page.class);
// Relying on fb page name uniqueness
org.setName(Organization.orgIdToName(fbPageName));
org.setOrgName(fbPage.getName());
org.setPage(PageRef.create(fbPageName, PAGE_BASE_URL + fbPageName,
SocialNetworkProviderType.FACEBOOK));
String mission = null;
if (fbPage.getMission() != null) {
mission = fbPage.getMission();
} else if (fbPage.getAbout() != null) {
mission = fbPage.getAbout();
}
org.setMission(mission);
org.setAddress(getAddress(fbPage.getLocation()));
}
开发者ID:karma-exchange-org,项目名称:karma-exchange,代码行数:21,代码来源:FacebookSocialNetworkProvider.java
示例5: fetchObject
import com.restfb.types.Page; //导入依赖的package包/类
void fetchObject() {
out.println("* Fetching single objects *");
User user = facebookClient25.fetchObject("me", User.class);
Page page = facebookClient25.fetchObject("cocacola", Page.class);
out.println("User name: " + user.getName());
out.println("Page likes: " + page.getLikes());
}
开发者ID:restfb,项目名称:restfb-examples,代码行数:10,代码来源:GraphReaderExample.java
示例6: getStreamUser
import com.restfb.types.Page; //导入依赖的package包/类
@Override
public UserAccount getStreamUser(String uid) {
try {
Page page = facebookClient.fetchObject(uid, Page.class);
UserAccount facebookUser = new FacebookAccount(page);
return facebookUser;
}
catch(Exception e) {
logger.error(e);
return null;
}
}
开发者ID:MKLab-ITI,项目名称:simmo-stream-manager,代码行数:13,代码来源:FacebookRetriever.java
示例7: PagePubTest01
import com.restfb.types.Page; //导入依赖的package包/类
public PagePubTest01() {
try {
fbClient = new DefaultFacebookClient(pageAccessToken, Version.LATEST);
myuser = fbClient.fetchObject("me", User.class);
mypage = fbClient.fetchObject(pageID, Page.class);
System.out.println(myuser);
System.out.println(mypage);
} catch (FacebookException ex) { //So that you can see what went wrong
ex.printStackTrace(System.err); //in case you did anything incorrectly
}
}
开发者ID:pierre-muth,项目名称:selfpi,代码行数:15,代码来源:PagePubTest01.java
示例8: FacebookPageData
import com.restfb.types.Page; //导入依赖的package包/类
public FacebookPageData(Page FBpage) {
Name = FBpage.getName();
Category = FBpage.getCategory();
ID = FBpage.getId();
Description = FBpage.getDescription();
if (FBpage.getLocation() != null)
Location = FBpage.getLocation().toString();
}
开发者ID:SmartSearch,项目名称:Edge-Node,代码行数:9,代码来源:FacebookPageData.java
示例9: fetchObject
import com.restfb.types.Page; //导入依赖的package包/类
void fetchObject() {
out.println("* Fetching single objects *");
User user = facebookClient.fetchObject("me", User.class);
Page page = facebookClient.fetchObject("cocacola", Page.class);
out.println("User name: " + user.getName());
out.println("Page likes: " + page.getLikes());
}
开发者ID:oleke,项目名称:Gender-Mining,代码行数:10,代码来源:GraphReaderExample.java
示例10: create
import com.restfb.types.Page; //导入依赖的package包/类
protected static <T> AbstractFBTypeWrapper create(Class<T> type, T object){
AbstractFBTypeWrapper wrapper;
if(type.equals(User.class)){
wrapper = new UserWrapper((User)object);
} else if (type.equals(Page.class)){
wrapper = new PageWrapper((Page)object);
} else {
throw new IllegalArgumentException("Object type not supported.");
}
return wrapper;
}
开发者ID:wandora-team,项目名称:wandora,代码行数:12,代码来源:AbstractFBTypeWrapper.java
示例11: getObjectClass
import com.restfb.types.Page; //导入依赖的package包/类
protected Class getObjectClass(){
Component selected = tabPane.getSelectedComponent();
if(selected.equals(userPanel)){
return User.class;
} else {
return Page.class;
}
}
开发者ID:wandora-team,项目名称:wandora,代码行数:9,代码来源:FBGraphExtractorPanel.java
示例12: getStreamUser
import com.restfb.types.Page; //导入依赖的package包/类
@Override
public StreamUser getStreamUser(String uid) {
try {
Page page = facebookClient.fetchObject(uid, Page.class);
StreamUser facebookUser = new FacebookStreamUser(page);
return facebookUser;
}
catch(Exception e) {
logger.error(e);
return null;
}
}
开发者ID:socialsensor,项目名称:socialmedia-abstractions,代码行数:13,代码来源:FacebookRetriever.java
示例13: Facebook
import com.restfb.types.Page; //导入依赖的package包/类
public Facebook() {
//read config
String line;
try (BufferedReader br = new BufferedReader( new FileReader(SelfPi.FACEBOOK_CONFIG_FILE_PATH) )){
line = br.readLine();
if (line != null && line.contains(FACETOKENKEY)) {
pageAccessToken = br.readLine();
}
line = br.readLine();
if (line != null && line.contains(FACEAPPIDKEY)) {
appID = br.readLine();
}
line = br.readLine();
if (line != null && line.contains(FACEPROFILEIDKEY)) {
pageID = br.readLine();
}
line = br.readLine();
if (line != null && line.contains(FACEUSERIDKEY)) {
userID = br.readLine();
}
line = br.readLine();
if (line != null && line.contains(FACEALBUMIDKEY)) {
albumID = br.readLine();
}
line = br.readLine();
if (line != null && line.contains(FACEPHOTOMSGIDKEY)) {
photoMsg = br.readLine();
}
} catch (IOException e) {
System.out.println("Error in config.txt");
};
try {
fbClient = new DefaultFacebookClient(pageAccessToken, Version.LATEST);
myuser = fbClient.fetchObject("me", User.class);
mypage = fbClient.fetchObject(pageID, Page.class);
System.out.println("Facebook initialized: USER: "+myuser+", PAGE: "+mypage);
} catch (FacebookException ex) { //So that you can see what went wrong
ex.printStackTrace(System.err); //in case you did anything incorrectly
}
}
开发者ID:pierre-muth,项目名称:selfpi,代码行数:45,代码来源:Facebook.java
示例14: generateAll
import com.restfb.types.Page; //导入依赖的package包/类
public static void generateAll(FacebookClient fbc, Facebook facebook, File coreFile, ArrayList<String> skipAlbums, long maxAlbumpics)
{
File dir = coreFile.getParentFile();
CustomStringBuilder builder = new CustomStringBuilder("|");
Properties listProps = new Properties();
File userFile = new File("" + dir + "/user.xml");
User user = fbc.fetchObject("me", User.class, MasterParameter.getParameterByClass(User.class));
userInfo(user, fbc, facebook, true, true, userFile);
// the Graph API only returns friends who are using this app, so it is
// useless to fetch them
Connection<Album> albums = fbc.fetchConnection("me/albums", Album.class, MasterParameter.getParameterByClass(Album.class));
ArrayList<Album> albumList = new ArrayList<>(albums.getData());
Connection<Photo> photos = fbc.fetchConnection("me/photos", Photo.class, MasterParameter.getParameterByClass(Photo.class));
Album lonelyAlbum = new Album();
lonelyAlbum.setName("Einzelbilder");
lonelyAlbum.setDescription("Fotos ohne Album");
if (photos.getData().size() >= 1)
lonelyAlbum.setCoverPhoto(photos.getData().get(0).getId());
lonelyAlbum.setId("lonely");
albumList.add(lonelyAlbum);
for (Album album : albumList)
{
if (!skipAlbums.contains(album.getName()))
{
File albumXml = new File("" + dir + "/albums/" + album.getId() + "/albuminfo.xml");
builder.append(FileUtils.getWayTo(dir, albumXml));
albumInfo(album, fbc, albumXml, maxAlbumpics, album.getId().equalsIgnoreCase("lonely"), photos);
}
}
listProps.put(PropertyFile.ALBUMS.toString(), builder.toString());
builder.empty();
Connection<Post> posts = fbc.fetchConnection("me/posts", Post.class, MasterParameter.getParameterByClass(Post.class));
for (Post post : posts.getData())
{
File postXml = new File("" + dir + "/posts/" + post.getId() + "/postinfo.xml");
builder.append(FileUtils.getWayTo(dir, postXml));
postInfo(post, postXml, fbc);
}
listProps.put(PropertyFile.POSTS.toString(), builder.toString());
builder.empty();
for (String pageToken : facebook.pages().fetchAllAccessTokens().values())
{
FacebookClient fc = new DefaultFacebookClient(pageToken, Version.VERSION_2_3);
Page page = fc.fetchObject("me", Page.class, MasterParameter.getParameterByClass(Page.class));
File pageXml = new File("" + dir + "/pages/" + page.getId() + "/pageinfo.xml");
builder.append(FileUtils.getWayTo(dir, pageXml));
pageInfo(page, pageXml);
}
listProps.put(PropertyFile.PAGES.toString(), builder.toString());
builder.empty();
Connection<Group> groups = fbc.fetchConnection("me/groups", Group.class, MasterParameter.getParameterByClass(Group.class));
for (Group group : groups.getData())
{
File groupXml = new File("" + dir + "/groups/" + group.getId() + "/groupinfo.xml");
builder.append(FileUtils.getWayTo(dir, groupXml));
groupInfo(group, fbc, groupXml);
}
listProps.put(PropertyFile.GROUPS.toString(), builder.toString());
listProps.put(PropertyFile.USER.toString(), FileUtils.getWayTo(coreFile, userFile));
writeProperties(listProps, coreFile, "list of all xml files");
}
开发者ID:RStoeckl,项目名称:themis-fb,代码行数:62,代码来源:Serializer.java
示例15: FacebookAccount
import com.restfb.types.Page; //导入依赖的package包/类
/**
* Maps the information of a facebook page
*
* @param page - Facebook's page
*/
public FacebookAccount(Page page) {
if (page == null) return;
//Id
setId(Sources.FACEBOOK + "#" + page.getId());
//The id of the page in the network
//userid = page.getId();
//The name of the page
name = page.getName();
//The username of the page
username = page.getUsername();
//The name of the Social Network
source = Sources.FACEBOOK;
//The description of the page
description = page.getAbout();
pageUrl = page.getLink();
if (pageUrl == null) {
pageUrl = username == null ? ("https://www.facebook.com/profile.php?id=" + page.getId()) : ("http://www.facebook.com/" + username);
}
//Avatar of the page
avatarBig = page.getPicture();
if (avatarBig == null) {
avatarBig = "https://graph.facebook.com/" + page.getId() + "/picture";
}
//Number of people talking about the page
numFollowers = page.getTalkingAboutCount().intValue();
//Location
Location loc = page.getLocation();
if (loc != null) {
location = loc.getCity();
}
}
开发者ID:MKLab-ITI,项目名称:simmo,代码行数:48,代码来源:FacebookAccount.java
示例16: PageWrapper
import com.restfb.types.Page; //导入依赖的package包/类
PageWrapper(Page p){
page = p;
}
开发者ID:wandora-team,项目名称:wandora,代码行数:4,代码来源:PageWrapper.java
示例17: FacebookStreamUser
import com.restfb.types.Page; //导入依赖的package包/类
/**
* Maps the information of a facebook page
* @param page
*/
public FacebookStreamUser(Page page) {
super(SocialNetworkSource.Facebook.toString(), Operation.NEW);
if (page == null) return;
//Id
id = SocialNetworkSource.Facebook+"#"+page.getId();
//The id of the page in the network
userid = page.getId();
//The name of the page
name = page.getName();
//The username of the page
username = page.getUsername();
//The name of the Social Network
streamId = SocialNetworkSource.Facebook.toString();
//The description of the page
description = page.getAbout();
//Link to the page
linkToProfile = page.getLink();
pageUrl = page.getLink();
if(pageUrl == null) {
pageUrl = username==null ? ("https://www.facebook.com/profile.php?id="+userid) : ("http://www.facebook.com/"+username);
}
//Avatar of the page
profileImage = page.getPicture();
if(profileImage == null) {
profileImage = "https://graph.facebook.com/" + userid + "/picture";
}
imageUrl = profileImage;
//Number of people talking about the page
followers = page.getTalkingAboutCount();
//Location
Location loc = page.getLocation();
if(loc != null) {
location = loc.getCity();
}
}
开发者ID:socialsensor,项目名称:socialmedia-abstractions,代码行数:52,代码来源:FacebookStreamUser.java
示例18: getLikeFromApi
import com.restfb.types.Page; //导入依赖的package包/类
private FacebookLike getLikeFromApi(String pageID) {
Connection<Page> thepage = apiConnection.fetchConnection(pageID, Page.class);
Page page = thepage.getData().get(0);
FacebookLike like = new FacebookLike(page.getId(), page.getUsername(), page.getDescription(), page.getLink(), page.getCategory());
return like;
}
开发者ID:fabiogermann,项目名称:zhaw-facepath,代码行数:7,代码来源:FacebookFacade.java
示例19: getNoPages
import com.restfb.types.Page; //导入依赖的package包/类
/**
* Gets the No of Pages
*
* @param id user id
* @return Returns the number of pages a user likes
*/
public int getNoPages(String id) {
Connection<Page> pages = client.fetchConnection(id + "/likes", Page.class);
List<Page> data = pages.getData();
return data.size();
}
开发者ID:oleke,项目名称:Gender-Mining,代码行数:12,代码来源:FcbkCrawler.java
注:本文中的com.restfb.types.Page类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论