List of usage examples for twitter4j Twitter createFriendship
User createFriendship(long userId, boolean follow) throws TwitterException;
From source file:it.greenvulcano.gvesb.social.twitter.directcall.TwitterOperationEnableNotification.java
License:Open Source License
@Override public void execute(SocialAdapterAccount account) throws SocialAdapterException { try {/*from w ww . j a va2 s. co m*/ Twitter twitter = (Twitter) account.getProxyObject(); try { long id = Long.parseLong(fromAccountId); user = twitter.createFriendship(id, true); } catch (NumberFormatException exc) { user = twitter.createFriendship(fromAccountId, true); } } catch (NumberFormatException exc) { logger.error("Call to TwitterOperationEnableNotification failed. Check fromAccountId[" + fromAccountId + "] format.", exc); throw new SocialAdapterException( "Call to TwitterOperationEnableNotification failed. Check fromAccountId[" + fromAccountId + "] format.", exc); } catch (TwitterException exc) { logger.error("Call to TwitterOperationEnableNotification fromAccountId[" + fromAccountId + "] failed.", exc); throw new SocialAdapterException( "Call to TwitterOperationEnableNotification fromAccountId[" + fromAccountId + "] failed.", exc); } }