use of models.Tweet in project play-cookbook by spinscale.
the class Application method showTweets.
public static void showTweets(String username) {
User user = User.find("byLogin", username).first();
notFoundIfNull(user);
List<Tweet> tweets = Tweet.find("user = ? order by postedAt DESC", user).fetch(20);
render(tweets, user);
}
use of models.Tweet in project play-cookbook by spinscale.
the class CreateTweetJob method doJob.
public void doJob() {
User user = User.find("byLogin", "alr").first();
Tweet t = new Tweet();
t.user = user;
t.content = RandomStringUtils.randomAlphanumeric(RandomUtils.nextInt(140));
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, RandomUtils.nextInt(10000));
t.postedAt = cal.getTime();
t.save();
Logger.debug("Created tweet at: %s", t.postedAt);
}