query.setParameter(1, guestId);
final List<AuthorizationToken> resultList = query.getResultList();
final List<AuthorizationTokenModel> tokenModels = new ArrayList<AuthorizationTokenModel>();
for (AuthorizationToken authorizationToken : resultList) {
AuthorizationCode authCode = em.find(AuthorizationCode.class, authorizationToken.authorizationCodeId);
Application application = em.find(Application.class, authCode.applicationId);
AuthorizationTokenModel tokenModel = new AuthorizationTokenModel(authorizationToken.accessToken,
application.name, application.organization, application.website, authCode.creationTime);
tokenModels.add(tokenModel);
}
return tokenModels;