本文整理汇总了Java中com.restfb.types.FacebookType.getId方法的典型用法代码示例。如果您正苦于以下问题:Java FacebookType.getId方法的具体用法?Java FacebookType.getId怎么用?Java FacebookType.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.restfb.types.FacebookType
的用法示例。
在下文中一共展示了FacebookType.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: post
import com.restfb.types.FacebookType; //导入方法依赖的package包/类
@Override
public String post(FacebookPosting posting) {
try {
FacebookClient facebookClient = new DefaultFacebookClient(ACCESS_TOKEN);
FacebookType publishMessageResponse = facebookClient.publish(FACEBOOK_PAGE + "/links", FacebookType.class,
Parameter.with("message", posting.getMessage()),
Parameter.with("link", posting.getLink()),
Parameter.with("og:name", posting.getName()),
Parameter.with("description", posting.getDescription()),
Parameter.with("icon", posting.getPicture()),
Parameter.with("picture", posting.getPicture())
);
String facebookUrl = "http://www.facebook.com/permalink.php?story_fbid=" + publishMessageResponse.getId() + "&id=" + FACEBOOK_PAGE;
log.info("Successfully posted [" + posting.getMessage() + "] to Facebook at [" + facebookUrl + "].");
return facebookUrl;
} catch (RuntimeException e) {
log.warning("Failed to post [" + posting.getMessage() + "] to Facebook.");
log.throwing(getClass().getName(), "post", e);
throw e;
}
}
示例2: publishMessage
import com.restfb.types.FacebookType; //导入方法依赖的package包/类
String publishMessage() {
out.println("* Feed publishing *");
FacebookType publishMessageResponse =
facebookClient.publish("me/feed", FacebookType.class, Parameter.with("message", "RestFB test"));
out.println("Published message ID: " + publishMessageResponse.getId());
return publishMessageResponse.getId();
}
示例3: publishEvent
import com.restfb.types.FacebookType; //导入方法依赖的package包/类
String publishEvent() {
out.println("* Event publishing *");
Date tomorrow = new Date(currentTimeMillis() + 1000L * 60L * 60L * 24L);
Date twoDaysFromNow = new Date(currentTimeMillis() + 1000L * 60L * 60L * 48L);
FacebookType publishEventResponse =
facebookClient.publish("me/events", FacebookType.class, Parameter.with("name", "Party"),
Parameter.with("start_time", tomorrow), Parameter.with("end_time", twoDaysFromNow));
out.println("Published event ID: " + publishEventResponse.getId());
return publishEventResponse.getId();
}
示例4: publishPhoto
import com.restfb.types.FacebookType; //导入方法依赖的package包/类
String publishPhoto() {
out.println("* Binary file publishing *");
FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class,
BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")),
Parameter.with("message", "Test cat"));
out.println("Published photo ID: " + publishPhotoResponse.getId());
return publishPhotoResponse.getId();
}
示例5: publishPhoto
import com.restfb.types.FacebookType; //导入方法依赖的package包/类
String publishPhoto() {
out.println("* Binary file publishing *");
FacebookType publishPhotoResponse =
facebookClient.publish("me/photos", FacebookType.class,
BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")),
Parameter.with("message", "Test cat"));
out.println("Published photo ID: " + publishPhotoResponse.getId());
return publishPhotoResponse.getId();
}
示例6: mapToTopicMap
import com.restfb.types.FacebookType; //导入方法依赖的package包/类
@Override
Topic mapToTopicMap(TopicMap tm) throws TopicMapException {
FacebookType entity = getEnclosedEntity();
if(entity == null) return null;
String id = entity.getId();
String name;
if(entity instanceof NamedFacebookType){
name = ((NamedFacebookType)entity).getName();
} else {
name = id;
}
logger.log("Processing graph object: " + name);
Topic entityTopic = getOrCreateTopic(tm, getSIBase() + id, name + " (" + id + ")");
Topic entityType = getOrCreateType(tm, getType());
Topic facebookTopic = getFacebookTopic(tm);
makeSubclassOf(tm, entityType, facebookTopic);
entityTopic.addType(entityType);
Topic idType = getOrCreateType(tm, "id");
entityTopic.setData(idType, getLangTopic(tm), id);
return entityTopic;
}