Search in sources :

Example 1 with Book

use of com.github.javafaker.Book in project com-liferay-apio-architect by liferay.

the class BlogPostingModel method compute.

/**
 * Computes the fake data for this model class.
 */
public static void compute() {
    if (!_blogPostings.isEmpty()) {
        return;
    }
    for (long index = 0; index < 42; index++) {
        Faker faker = new Faker();
        Book book = faker.book();
        Lorem lorem = faker.lorem();
        RandomService randomService = faker.random();
        int creatorId = randomService.nextInt(PersonModel.getCount());
        DateAndTime dateAndTime = faker.date();
        Date date = dateAndTime.past(400, DAYS);
        BlogPostingModel blogPostingModel = new BlogPostingModel(_count.get(), lorem.paragraph(), date, creatorId, date, lorem.sentence(), book.title());
        _blogPostings.put(_count.getAndIncrement(), blogPostingModel);
    }
}
Also used : Lorem(com.github.javafaker.Lorem) Faker(com.github.javafaker.Faker) Book(com.github.javafaker.Book) RandomService(com.github.javafaker.service.RandomService) DateAndTime(com.github.javafaker.DateAndTime) Date(java.util.Date)

Aggregations

Book (com.github.javafaker.Book)1 DateAndTime (com.github.javafaker.DateAndTime)1 Faker (com.github.javafaker.Faker)1 Lorem (com.github.javafaker.Lorem)1 RandomService (com.github.javafaker.service.RandomService)1 Date (java.util.Date)1