Package com.gooddata.account
Class AccountService
- java.lang.Object
-
- com.gooddata.AbstractService
-
- com.gooddata.account.AccountService
-
public class AccountService extends AbstractService
Service to access and manipulate account.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.gooddata.AbstractService
AbstractService.OutputStreamResponseExtractor
-
-
Field Summary
-
Fields inherited from class com.gooddata.AbstractService
mapper, restTemplate
-
-
Constructor Summary
Constructors Constructor Description AccountService(org.springframework.web.client.RestTemplate restTemplate)Deprecated.use AccountService(RestTemplate, GoodDataSettings) constructor insteadAccountService(org.springframework.web.client.RestTemplate restTemplate, GoodDataSettings settings)Constructs service for GoodData account management.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccountcreateAccount(Account account, String organizationName)Creates new account in given organization (domain).AccountgetAccountById(String id)Get account for given account idAccountgetAccountByUri(String uri)Get account for given account idAccountgetCurrent()Gets current account of logged user.voidlogout()Performs user logout.voidremoveAccount(Account account)Delete given accountvoidupdateAccount(Account account)Updates account-
Methods inherited from class com.gooddata.AbstractService
extractData
-
-
-
-
Constructor Detail
-
AccountService
public AccountService(org.springframework.web.client.RestTemplate restTemplate, GoodDataSettings settings)Constructs service for GoodData account management.- Parameters:
restTemplate- RESTful HTTP Spring templatesettings- settings
-
AccountService
@Deprecated public AccountService(org.springframework.web.client.RestTemplate restTemplate)
Deprecated.use AccountService(RestTemplate, GoodDataSettings) constructor insteadConstructs service for GoodData account management.- Parameters:
restTemplate- RESTful HTTP Spring template
-
-
Method Detail
-
getCurrent
public Account getCurrent()
Gets current account of logged user.- Returns:
- current account
- Throws:
com.gooddata.GoodDataException- when current account can't be accessed.
-
logout
public void logout()
Performs user logout.- Throws:
com.gooddata.GoodDataException- when logout failed.
-
createAccount
public Account createAccount(Account account, String organizationName)
Creates new account in given organization (domain). Only domain admin is allowed create new accounts! This means rest request has to authorized as domain admin.- Parameters:
account- to createorganizationName- (domain) in which account should be created- Returns:
- new account
- Throws:
com.gooddata.GoodDataException- when account can't be created
-
removeAccount
public void removeAccount(Account account)
Delete given account- Parameters:
account- to remove- Throws:
AccountNotFoundException- when given account wasn't foundcom.gooddata.GoodDataException- when account can't be removed for other reason
-
getAccountById
public Account getAccountById(String id)
Get account for given account id- Parameters:
id- to search for- Returns:
- account for id
- Throws:
AccountNotFoundException- when account for given id can't be foundcom.gooddata.GoodDataException- when different error occurs
-
getAccountByUri
public Account getAccountByUri(String uri)
Get account for given account id- Parameters:
uri- to search for- Returns:
- account for uri
- Throws:
AccountNotFoundException- when account for given uri can't be foundcom.gooddata.GoodDataException- when different error occurs
-
updateAccount
public void updateAccount(Account account)
Updates account- Parameters:
account- to be updated- Throws:
AccountNotFoundException- when account for given uri can't be found
-
-