Class AccountService


  • public class AccountService
    extends AbstractService
    Service to access and manipulate account.
    • Constructor Summary

      Constructors 
      Constructor Description
      AccountService​(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
      com.gooddata.sdk.model.account.Account createAccount​(com.gooddata.sdk.model.account.Account account, java.lang.String organizationName)
      Creates new account in given organization (domain).
      com.gooddata.sdk.model.account.Account getAccountById​(java.lang.String id)
      Get account for given account id
      com.gooddata.sdk.model.account.Account getAccountByLogin​(java.lang.String email, java.lang.String organizationName)
      Get account by given login.
      com.gooddata.sdk.model.account.Account getAccountByUri​(java.lang.String uri)
      Get account for given account id
      com.gooddata.sdk.model.account.Account getCurrent()
      Gets current account of logged user.
      com.gooddata.sdk.model.account.SeparatorSettings getSeparatorSettings​(com.gooddata.sdk.model.account.Account account)
      Returns default thousand and decimal separator settings for the given account.
      void logout()
      Performs user logout.
      void removeAccount​(com.gooddata.sdk.model.account.Account account)
      Delete given account
      void updateAccount​(com.gooddata.sdk.model.account.Account account)
      Updates account
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ACCOUNT_TEMPLATE

        public static final org.springframework.web.util.UriTemplate ACCOUNT_TEMPLATE
      • ACCOUNTS_TEMPLATE

        public static final org.springframework.web.util.UriTemplate ACCOUNTS_TEMPLATE
      • ACCOUNT_BY_LOGIN_TEMPLATE

        public static final org.springframework.web.util.UriTemplate ACCOUNT_BY_LOGIN_TEMPLATE
      • LOGIN_TEMPLATE

        public static final org.springframework.web.util.UriTemplate LOGIN_TEMPLATE
      • SEPARATORS_TEMPLATE

        public static final org.springframework.web.util.UriTemplate SEPARATORS_TEMPLATE
    • Constructor Detail

      • AccountService

        public AccountService​(org.springframework.web.client.RestTemplate restTemplate,
                              GoodDataSettings settings)
        Constructs service for GoodData account management.
        Parameters:
        restTemplate - RESTful HTTP Spring template
        settings - settings
    • Method Detail

      • getCurrent

        public com.gooddata.sdk.model.account.Account getCurrent()
        Gets current account of logged user.
        Returns:
        current account
        Throws:
        com.gooddata.sdk.common.GoodDataException - when current account can't be accessed.
      • logout

        public void logout()
        Performs user logout.
        Throws:
        com.gooddata.sdk.common.GoodDataException - when logout failed.
      • createAccount

        public com.gooddata.sdk.model.account.Account createAccount​(com.gooddata.sdk.model.account.Account account,
                                                                    java.lang.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 create
        organizationName - (domain) in which account should be created
        Returns:
        new account
        Throws:
        com.gooddata.sdk.common.GoodDataException - when account can't be created
      • removeAccount

        public void removeAccount​(com.gooddata.sdk.model.account.Account account)
        Delete given account
        Parameters:
        account - to remove
        Throws:
        AccountNotFoundException - when given account wasn't found
        com.gooddata.sdk.common.GoodDataException - when account can't be removed for other reason
      • getAccountById

        public com.gooddata.sdk.model.account.Account getAccountById​(java.lang.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 found
        com.gooddata.sdk.common.GoodDataException - when different error occurs
      • getAccountByLogin

        public com.gooddata.sdk.model.account.Account getAccountByLogin​(java.lang.String email,
                                                                        java.lang.String organizationName)
        Get account by given login. Only domain admin is allowed to search users by login.
        Parameters:
        email - used as login
        organizationName - (domain) in which account is present
        Returns:
        account found by given login
        Throws:
        AccountNotFoundException - when given account wasn't found
        com.gooddata.sdk.common.GoodDataException - when different error occurs
      • getAccountByUri

        public com.gooddata.sdk.model.account.Account getAccountByUri​(java.lang.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 found
        com.gooddata.sdk.common.GoodDataException - when different error occurs
      • updateAccount

        public void updateAccount​(com.gooddata.sdk.model.account.Account account)
        Updates account
        Parameters:
        account - to be updated
        Throws:
        AccountNotFoundException - when account for given uri can't be found
      • getSeparatorSettings

        public com.gooddata.sdk.model.account.SeparatorSettings getSeparatorSettings​(com.gooddata.sdk.model.account.Account account)
        Returns default thousand and decimal separator settings for the given account.
        Parameters:
        account - account
        Returns:
        default SeparatorSettings for the account