public Integer getNbTweetsByUser(String login) { Long res = (Long) crudDAO.findUniqueWithNamedQuery( Tweet.COUNT_TWEETS_FOR_USER, QueryParameters.with("name", login).parameters()); return res.intValue(); }
public List<Tweet> findMyRecentTweets(Long start, Integer range) { User user = securityContext.getUser(); List<Tweet> result; if (start != null) { result = crudDAO.findMaxResultsWithNamedQuery( Tweet.FIND_ALL_RECENT_BY_AUTHOR_WITH_LIMIT, QueryParameters.with("author", user.getLogin()).and("id", start).parameters(), range); } else { result = crudDAO.findMaxResultsWithNamedQuery( Tweet.FIND_ALL_RECENT_BY_AUTHOR, QueryParameters.with("author", user.getLogin()).parameters(), range); } return result; }
public List<Tweet> findTweetByKeyword(String keyword) { return crudDAO.findWithNamedQuery( Tweet.FIND_BY_KEYWORD, QueryParameters.with("keyword", "%" + keyword + "%").parameters()); }
public String getEmailOfTweetOwner(Long tweetId) { return (String) crudDAO.findUniqueWithNamedQuery( Tweet.EMAIL_ADDRESS_OF_TWEET_OWNER, QueryParameters.with("tweetId", Long.valueOf(tweetId)).parameters()); }