public static List<NewPost> getStatistics(List<NewPost> newPosts, int userId) { List<Profile> profiles = factory.create(ProfileService.class).getByUserId(userId); Vkontakte vk = new Vkontakte(4949213); for (Profile profile : profiles) { AccessToken accessToken = new AccessToken(); accessToken.setAccessToken(profile.getAccessToken()); accessToken.setUserId(profile.getVkId()); accessToken.setExpirationMoment(profile.getExtTime()); vk.setAccessToken(accessToken); try { return vk.execute().getPostStats(newPosts); } catch (VKException e) { continue; } } return newPosts; }
private static List<PostOffsetDecorator> simpleGrabbing( Task.GrabbingType grabbingType, Vkontakte vk, Integer ownerId, Integer count, Integer lastPostId, Integer offset, Filter filter) throws VKException, WallStopException, FindingEmptyResultException { switch (grabbingType) { case BEGIN: return vk.execute().getPostFromBeginWall(ownerId, count, lastPostId, offset, filter); case END: return vk.execute().getPostFromEndWall(ownerId, count, lastPostId, offset, filter); case RANDOM: case NEW: LOG.fatal("UNSUPPORTED METHOD"); break; } return null; }