Class TwitterServiceImpl
java.lang.Object
io.meeds.twitter.gamification.service.impl.TwitterServiceImpl
- All Implemented Interfaces:
TwitterService
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTweetToWatch(String tweetLink) Add watched Tweet.addTwitterAccount(String twitterUsername, String currentUser) Add watched Twitter account.longCount all watched tweetslongcountTwitterAccounts(String currentUser) Count all watched twitter accountsvoiddeleteTweet(long tweetId) delete watched TweetvoiddeleteTweetById(long tweetId) voiddeleteTwitterAccount(long twitterAccountId, String currentUser) delete watched Twitter accountvoiddeleteTwitterBearerToken(String currentUser) Deletes Twitter bearer tokengetTweetByLink(String tweetLink) Retrieves a watched tweet identified by its linkGet all watched tweets.org.springframework.data.domain.Page<Tweet> getTweets(org.springframework.data.domain.Pageable pageable) Get available watched tweets using page.getTwitterAccountById(long accountId) Retrieves a watched twitter account identified by its technical identifier.getTwitterAccountById(long accountId, String username) Retrieves a watched twitter account identified by its technical identifier accessed by a userGet all watched twitter accounts.org.springframework.data.domain.Page<TwitterAccount> getTwitterAccounts(String currentUser, org.springframework.data.domain.Pageable pageable) Get available watched twitter accounts using page.org.springframework.data.domain.Page<TwitterAccount> getTwitterAccounts(org.springframework.data.domain.Pageable pageable) Get available watched twitter accounts using page.gets Twitter bearer tokengetTwitterBearerToken(String currentUser) gets Twitter bearer tokenvoidsaveTwitterBearerToken(String bearerToken, String currentUser) Saves Twitter bearer tokenvoidupdateAccountLastMentionTweetId(long accountId, long lastMentionTweetId) Update twitter account last mention tweet Id.voidupdateTweetReactions(long tweetId, Set<String> likers, Set<String> retweeters) Update tweet with last reactions.
-
Field Details
-
NOT_FOUND
- See Also:
-
-
Constructor Details
-
TwitterServiceImpl
public TwitterServiceImpl()
-
-
Method Details
-
getTwitterAccounts
public org.springframework.data.domain.Page<TwitterAccount> getTwitterAccounts(String currentUser, org.springframework.data.domain.Pageable pageable) throws IllegalAccessException Description copied from interface:TwitterServiceGet available watched twitter accounts using page.- Specified by:
getTwitterAccountsin interfaceTwitterService- Parameters:
currentUser- user name attempting to access watched twitter accountspageable-Pageablethe page to be returned.- Returns:
ListofTwitterAccount- Throws:
IllegalAccessException- when user is not authorized to access watched twitter accounts
-
getTwitterAccountById
Description copied from interface:TwitterServiceRetrieves a watched twitter account identified by its technical identifier.- Specified by:
getTwitterAccountByIdin interfaceTwitterService- Parameters:
accountId- watched twitter account technical identifier- Returns:
- found
TwitterAccount
-
getTwitterAccountById
public TwitterAccount getTwitterAccountById(long accountId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterServiceRetrieves a watched twitter account identified by its technical identifier accessed by a user- Specified by:
getTwitterAccountByIdin interfaceTwitterService- Parameters:
accountId- watched twitter account technical identifierusername- user name attempting to access watched twitter account- Returns:
- found
TwitterAccount - Throws:
IllegalAccessException- when user is not authorized to access watched twitter accountorg.exoplatform.commons.exception.ObjectNotFoundException- twitter account not found
-
getTwitterAccounts
public org.springframework.data.domain.Page<TwitterAccount> getTwitterAccounts(org.springframework.data.domain.Pageable pageable) Description copied from interface:TwitterServiceGet available watched twitter accounts using page.- Specified by:
getTwitterAccountsin interfaceTwitterService- Parameters:
pageable-Pageablethe page to be returned.- Returns:
ListofTwitterAccount
-
getTwitterAccounts
Description copied from interface:TwitterServiceGet all watched twitter accounts.- Specified by:
getTwitterAccountsin interfaceTwitterService- Returns:
ListofTwitterAccount
-
countTwitterAccounts
Description copied from interface:TwitterServiceCount all watched twitter accounts- Specified by:
countTwitterAccountsin interfaceTwitterService- Parameters:
currentUser- User name accessing watched twitter accounts- Returns:
- Watched twitter accounts count
- Throws:
IllegalAccessException- when user is not authorized to get watched twitter accounts
-
addTwitterAccount
public TwitterAccount addTwitterAccount(String twitterUsername, String currentUser) throws org.exoplatform.commons.ObjectAlreadyExistsException, IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterServiceAdd watched Twitter account.- Specified by:
addTwitterAccountin interfaceTwitterService- Parameters:
twitterUsername- Twitter usernamecurrentUser- user name attempting to add watched Twitter account.- Returns:
TwitterAccount- Throws:
org.exoplatform.commons.ObjectAlreadyExistsException- when watched Twitter account already existsIllegalAccessException- when user is not authorized to add watched Twitter account.org.exoplatform.commons.exception.ObjectNotFoundException- when the Twitter account identified by its technical name is not found
-
deleteTwitterAccount
public void deleteTwitterAccount(long twitterAccountId, String currentUser) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterServicedelete watched Twitter account- Specified by:
deleteTwitterAccountin interfaceTwitterService- Parameters:
twitterAccountId- twitter remote account idcurrentUser- user name attempting to delete watched Twitter account- Throws:
IllegalAccessException- when user is not authorized to delete the watched Twitter accountorg.exoplatform.commons.exception.ObjectNotFoundException
-
addTweetToWatch
Description copied from interface:TwitterServiceAdd watched Tweet.- Specified by:
addTweetToWatchin interfaceTwitterService- Parameters:
tweetLink- Tweet link- Returns:
TwitterAccount
-
getTweets
public org.springframework.data.domain.Page<Tweet> getTweets(org.springframework.data.domain.Pageable pageable) Description copied from interface:TwitterServiceGet available watched tweets using page.- Specified by:
getTweetsin interfaceTwitterService- Parameters:
pageable-Pageablethe page to be returned.- Returns:
ListofTweet
-
getTweets
Description copied from interface:TwitterServiceGet all watched tweets.- Specified by:
getTweetsin interfaceTwitterService- Returns:
ListofTweet
-
countTweets
public long countTweets()Description copied from interface:TwitterServiceCount all watched tweets- Specified by:
countTweetsin interfaceTwitterService- Returns:
- Watched tweets count
-
getTweetByLink
Description copied from interface:TwitterServiceRetrieves a watched tweet identified by its link- Specified by:
getTweetByLinkin interfaceTwitterService- Parameters:
tweetLink- watched tweet link- Returns:
- found
TwitterAccount
-
deleteTweet
public void deleteTweet(long tweetId) throws org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterServicedelete watched Tweet- Specified by:
deleteTweetin interfaceTwitterService- Parameters:
tweetId- tweet Id- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
deleteTweetById
public void deleteTweetById(long tweetId) - Specified by:
deleteTweetByIdin interfaceTwitterService
-
saveTwitterBearerToken
public void saveTwitterBearerToken(String bearerToken, String currentUser) throws IllegalAccessException Description copied from interface:TwitterServiceSaves Twitter bearer token- Specified by:
saveTwitterBearerTokenin interfaceTwitterService- Parameters:
bearerToken- twitter bearer tokencurrentUser- user name attempting to save Twitter bearer token- Throws:
IllegalAccessException- when user is not authorized save Twitter bearer token
-
deleteTwitterBearerToken
Description copied from interface:TwitterServiceDeletes Twitter bearer token- Specified by:
deleteTwitterBearerTokenin interfaceTwitterService- Parameters:
currentUser- user name attempting to delete Twitter bearer token- Throws:
IllegalAccessException- when user is not authorized to delete Twitter bearer token
-
getTwitterBearerToken
Description copied from interface:TwitterServicegets Twitter bearer token- Specified by:
getTwitterBearerTokenin interfaceTwitterService- Parameters:
currentUser- user name attempting to access Twitter bearer token- Returns:
- Twitter bearer token
- Throws:
IllegalAccessException- when user is not authorized to access Twitter bearer token
-
getTwitterBearerToken
Description copied from interface:TwitterServicegets Twitter bearer token- Specified by:
getTwitterBearerTokenin interfaceTwitterService- Returns:
- Twitter bearer token
-
updateAccountLastMentionTweetId
public void updateAccountLastMentionTweetId(long accountId, long lastMentionTweetId) throws org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterServiceUpdate twitter account last mention tweet Id.- Specified by:
updateAccountLastMentionTweetIdin interfaceTwitterService- Parameters:
accountId- account IdlastMentionTweetId- last mention Tweet Id- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the Twitter account identified by its technical name is not found
-
updateTweetReactions
public void updateTweetReactions(long tweetId, Set<String> likers, Set<String> retweeters) throws org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterServiceUpdate tweet with last reactions.- Specified by:
updateTweetReactionsin interfaceTwitterService- Parameters:
tweetId- tweetIdlikers- tweet likersretweeters- tweet retweeters- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the tweet identified by its technical id is not found
-