use of net.cryptonomica.entities.Notary in project cryptonomica by Cryptonomica.
the class VisitorAPI method showAllNotaries.
@ApiMethod(name = "searchForNotaries", path = "searchForNotaries", httpMethod = ApiMethod.HttpMethod.POST)
public ArrayList<NotaryGeneralView> showAllNotaries(final User googleUser) throws Exception {
// ensure authorization
UserTools.ensureCryptonomicaRegisteredUser(googleUser);
//
List<Notary> notaryList = ofy().load().type(Notary.class).list();
//
ArrayList<NotaryGeneralView> notaryGeneralViewArrayList = new ArrayList<>();
if (notaryList != null) {
for (Notary notary : notaryList) {
Key<CryptonomicaUser> notaryCUkey = Key.create(CryptonomicaUser.class, notary.getId());
//
CryptonomicaUser notaryCryptonomicaUser = ofy().load().key(notaryCUkey).now();
//
UserProfileGeneralView notaryUserProfileGeneralView = new UserProfileGeneralView(notaryCryptonomicaUser);
//
notaryGeneralViewArrayList.add(new NotaryGeneralView(notaryUserProfileGeneralView, notary));
}
}
//
LOG.warning("notaryGeneralViewArrayList: " + new Gson().toJson(notaryGeneralViewArrayList));
//
return notaryGeneralViewArrayList;
}
Aggregations