Class TwitterAccountServiceImpl
java.lang.Object
io.meeds.gamification.twitter.service.impl.TwitterAccountServiceImpl
- All Implemented Interfaces:
TwitterAccountService
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTwitterAccountServiceImpl(org.exoplatform.commons.api.settings.SettingService settingService, TwitterConsumerService twitterConsumerService, TwitterAccountStorage twitterAccountStorage, io.meeds.gamification.service.EventService eventService, org.exoplatform.web.security.codec.CodecInitializer codecInitializer) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTwitterAccount(String twitterUsername, String currentUser) Add watched Twitter account.intcountTwitterAccounts(String currentUser) Count all watched twitter accountsvoiddeleteTwitterAccount(long twitterAccountId, String currentUser) delete watched Twitter accountvoiddeleteTwitterBearerToken(String currentUser) Deletes Twitter bearer tokengetTwitterAccountById(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 usergetTwitterAccounts(int offset, int limit) Get available watched twitter accounts using offset and limit.getTwitterAccounts(String currentUser, int offset, int limit, boolean forceUpdate) Get available watched twitter accounts using offset and limit.gets Twitter bearer tokengetTwitterBearerToken(String currentUser) gets Twitter bearer tokenvoidsaveTwitterBearerToken(String bearerToken, String currentUser) Saves Twitter bearer tokenvoidsetEventEnabledForAccount(long eventId, long accountId, boolean enabled, String currentUser) Enables/disables watched account eventvoidupdateAccountLastMentionTweetId(long accountId, long lastMentionTweetId) Update twitter account last mention tweet Id.
-
Field Details
-
ENABLED
- See Also:
-
-
Constructor Details
-
TwitterAccountServiceImpl
public TwitterAccountServiceImpl(org.exoplatform.commons.api.settings.SettingService settingService, TwitterConsumerService twitterConsumerService, TwitterAccountStorage twitterAccountStorage, io.meeds.gamification.service.EventService eventService, org.exoplatform.web.security.codec.CodecInitializer codecInitializer)
-
-
Method Details
-
getTwitterAccounts
public List<TwitterAccount> getTwitterAccounts(String currentUser, int offset, int limit, boolean forceUpdate) throws IllegalAccessException Description copied from interface:TwitterAccountServiceGet available watched twitter accounts using offset and limit.- Specified by:
getTwitterAccountsin interfaceTwitterAccountService- Parameters:
currentUser- user name attempting to access watched twitter accountsoffset- Offset of resultlimit- Limit of resultforceUpdate- force Load remote accounts or not.- Returns:
ListofTwitterAccount- Throws:
IllegalAccessException- when user is not authorized to access watched twitter accounts
-
getTwitterAccountById
Description copied from interface:TwitterAccountServiceRetrieves a watched twitter account identified by its technical identifier.- Specified by:
getTwitterAccountByIdin interfaceTwitterAccountService- 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:TwitterAccountServiceRetrieves a watched twitter account identified by its technical identifier accessed by a user- Specified by:
getTwitterAccountByIdin interfaceTwitterAccountService- 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
Description copied from interface:TwitterAccountServiceGet available watched twitter accounts using offset and limit.- Specified by:
getTwitterAccountsin interfaceTwitterAccountService- Parameters:
offset- Offset of resultlimit- Limit of result- Returns:
ListofTwitterAccount
-
countTwitterAccounts
Description copied from interface:TwitterAccountServiceCount all watched twitter accounts- Specified by:
countTwitterAccountsin interfaceTwitterAccountService- 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 void addTwitterAccount(String twitterUsername, String currentUser) throws org.exoplatform.commons.ObjectAlreadyExistsException, IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterAccountServiceAdd watched Twitter account.- Specified by:
addTwitterAccountin interfaceTwitterAccountService- Parameters:
twitterUsername- Twitter usernamecurrentUser- user name attempting to add watched Twitter account.- 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:TwitterAccountServicedelete watched Twitter account- Specified by:
deleteTwitterAccountin interfaceTwitterAccountService- 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
-
saveTwitterBearerToken
public void saveTwitterBearerToken(String bearerToken, String currentUser) throws IllegalAccessException Description copied from interface:TwitterAccountServiceSaves Twitter bearer token- Specified by:
saveTwitterBearerTokenin interfaceTwitterAccountService- 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:TwitterAccountServiceDeletes Twitter bearer token- Specified by:
deleteTwitterBearerTokenin interfaceTwitterAccountService- 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:TwitterAccountServicegets Twitter bearer token- Specified by:
getTwitterBearerTokenin interfaceTwitterAccountService- 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:TwitterAccountServicegets Twitter bearer token- Specified by:
getTwitterBearerTokenin interfaceTwitterAccountService- Returns:
- Twitter bearer token
-
setEventEnabledForAccount
public void setEventEnabledForAccount(long eventId, long accountId, boolean enabled, String currentUser) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterAccountServiceEnables/disables watched account event- Specified by:
setEventEnabledForAccountin interfaceTwitterAccountService- Parameters:
eventId- event IdaccountId- account remote Idenabled- true to enabled, else falsecurrentUser- user name attempting to enables/disables event.- Throws:
IllegalAccessException- when user is not authorized enables/disables account eventorg.exoplatform.commons.exception.ObjectNotFoundException
-
updateAccountLastMentionTweetId
public void updateAccountLastMentionTweetId(long accountId, long lastMentionTweetId) throws org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:TwitterAccountServiceUpdate twitter account last mention tweet Id.- Specified by:
updateAccountLastMentionTweetIdin interfaceTwitterAccountService- 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
-