use of com.github.javafaker.Shakespeare in project com-liferay-apio-architect by liferay.
the class BlogPostingCommentModel method compute.
/**
* Computes the fake data for this model class.
*/
public static void compute() {
if (!_blogPostingCommentModels.isEmpty()) {
return;
}
for (long index = 0; index < BlogPostingModel.getCount(); index++) {
Map<Long, BlogPostingCommentModel> blogPostingCommentModels = new HashMap<>();
Random random = new Random();
for (int i = 0; i < random.nextInt(70); i++) {
long authorId = random.nextInt(PersonModel.getCount());
Faker faker = new Faker();
Shakespeare shakespeare = faker.shakespeare();
DateAndTime dateAndTime = faker.date();
Date date = dateAndTime.past(400, DAYS);
BlogPostingCommentModel blogPostingCommentModel = new BlogPostingCommentModel(authorId, _count.get(), index, shakespeare.hamletQuote(), date, date);
blogPostingCommentModels.put(_count.getAndIncrement(), blogPostingCommentModel);
}
_blogPostingCommentModels.put(index, blogPostingCommentModels);
}
}
Aggregations