logger.info("Http Message Content: " + getHttpMessageContent(e));
JSONObject jsonObject = BuildJsonObjectsUtil.extractJsonContents(getHttpMessageContent(e));
if ((isPost(e) || isPut(e)) && isAdmin(loggedInUser)) {
AccessTokenModel accessTokenModel = new Gson().fromJson(getHttpMessageContent(e), AccessTokenModel.class);
BasicAccessToken newAccessToken = accessTokenModel.getAccessToken();
Account account = getAccountService().getAccount(loggedInUser.getAccountName());
if (account != null && newAccessToken != null && newAccessToken.getId() != null && newAccessToken.getId().length() >= 16) {
newAccessToken.setAccountName(account.getId());
logger.info("Persisting AccessToken: " + new Gson().toJson(newAccessToken));
getAccountService().persistAccessToken(newAccessToken);
if (account.getAccessTokens() == null) {
BasicAccount newAccount = new BasicAccount(account);
newAccount.setAccessTokens(new ArrayList<String>());
account = newAccount;
}
account.getAccessTokens().add(newAccessToken.getId());
getAccountService().persistAccount(account);
}
jsonResponse = new Gson().toJson(accessTokenModel);
} else if (isGet(e) && isAdmin(loggedInUser)) {