}
@Override
public String publish(String to, String message) {
LOG.info("Start publish");
FacebookType publishMessageResponse = null;
// try {
if (to != null) {
User user = facebookClient.fetchObject(to, User.class);
publishMessageResponse = facebookClient.publish(user.getId()
+ "/feed", FacebookType.class,
Parameter.with("message", message));
} else {
publishMessageResponse = facebookClient.publish("me/feed",
FacebookType.class, Parameter.with("message", message));
}
LOG.error("Published post [" + publishMessageResponse.getId() + "]");
// } catch (FacebookException e) {
// LOG.error("An error occurred while publishing", e);
// }
LOG.info("End publish");
return publishMessageResponse.getId();
}