/*
 * Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved.
 */
package com.gooddata.account;

import com.gooddata.AbstractService;
import com.gooddata.GoodDataException;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

/**
 */
public class AccountService extends AbstractService {

    public AccountService(RestTemplate restTemplate) {
        super(restTemplate);
    }

    public Account getCurrent() {
        try {
            return restTemplate.getForObject(Account.URI, Account.class, Account.CURRENT_ID);
        } catch (GoodDataException | RestClientException e) {
            throw new GoodDataException("Unable to get current account", e);
        }
    }

    public void logout() {
        try {
            final String id = getCurrent().getId();
            restTemplate.delete(Account.LOGIN_URI, id);
        } catch (GoodDataException | RestClientException e) {
            throw new GoodDataException("Unable to logout", e);
        }
    }
}

@@ -297,20 +297,65 @@
 e;%0A%0A/**%0A
+ * Service to access and manipulate account.%0A
  */%0A
-
 public c
@@ -484,32 +484,216 @@
 mplate);%0A    %7D%0A%0A
+    /**%0A     * Gets current account of logged user.%0A     * @throws com.gooddata.GoodDataException when current account can't be accessed.%0A     *%0A     * @return current account%0A     */%0A
     public Accou
@@ -970,24 +970,135 @@
    %7D%0A    %7D%0A%0A
+    /**%0A     * Performs user logout.%0A     * @throws com.gooddata.GoodDataException when logout failed.%0A     */%0A
     public v

add javadocs to AccountService