// Path: rest-server/src/main/java/com/readlearncode/dukesbookshop/restserver/domain/Author.java
// @XmlRootElement
// public class Author implements Serializable {
// 
//     private String id;
//     private String firstName;
//     private String lastName;
//     private String blogURL;
// 
//     public Author() {
//     }
// 
//     public Author(String id, String firstName, String lastName) {
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//     }
// 
//     public Author(String id, String firstName, String lastName, String blogURL) {
//         this(id, firstName, lastName);
//         this.blogURL = blogURL;
//     }
// 
// 
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getId() {
//         return id;
//     }
// 
//     @GET
//     @Path("/firstName")
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     @GET
//     @Path("/lastName")
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getLastName() {
//         return lastName;
//     }
// 
//     @GET
//     @Path("/blog")
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getBlogURL() {
//         return blogURL;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public void setBlogURL(String blogURL) {
//         this.blogURL = blogURL;
//     }
// 
// 
// }
// 
// Path: rest-server/src/main/java/com/readlearncode/dukesbookshop/restserver/domain/BookBuilder.java
// public class BookBuilder {
//     private String id;
//     private String title;
//     private String description;
//     private Float price;
//     private Date published;
//     private ArrayList<Author> authors = new ArrayList<>();
//     private String imageFileName;
//     private String link;
// 
//     public BookBuilder setId(String id) {
//         this.id = id;
//         return this;
//     }
// 
//     public BookBuilder setTitle(String title) {
//         this.title = title;
//         return this;
//     }
// 
//     public BookBuilder setDescription(String description) {
//         this.description = description;
//         return this;
//     }
// 
//     public BookBuilder setPrice(Float price) {
//         this.price = price;
//         return this;
//     }
// 
//     public BookBuilder setPublished(Date published) {
//         this.published = published;
//         return this;
//     }
// 
//     public BookBuilder setAuthors(ArrayList<Author> authors) {
//         this.authors.addAll(authors);
//         return this;
//     }
// 
//     public BookBuilder addAuthor(Author author) {
//         this.authors.add(author);
//         return this;
//     }
// 
//     public BookBuilder setImageFileName(String imageFileName) {
//         this.imageFileName = imageFileName;
//         return this;
//     }
// 
//     public BookBuilder setLink(String link) {
//         this.link = link;
//         return this;
//     }
// 
//     public Book createBook() {
//         return new Book(id, title, description, price, published, authors, imageFileName, link);
//     }
// }


import com.readlearncode.dukesbookshop.restserver.domain.Author;
import com.readlearncode.dukesbookshop.restserver.domain.BookBuilder;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
    @PostConstruct
    public void populateRepositories() {

        DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");

        // Create the authors
        Author meek = authorRepository.saveAuthor(new Author("1", "Captain S. P.", "Meek", "http://www.gutenberg.org"));
        Author wright = authorRepository.saveAuthor(new Author("2", "Sewell", "Peaslee Wright", "http://www.gutenberg.org"));
        Author knight = authorRepository.saveAuthor(new Author("3", "Damon Francis", "Knight", "http://www.gutenberg.org"));
        Author dee = authorRepository.saveAuthor(new Author("4", "Roger", "Dee", "http://www.gutenberg.org"));
        Author sohl = authorRepository.saveAuthor(new Author("5", "Gerald Allan", "Sohl", "http://www.gutenberg.org"));
        Author harmon = authorRepository.saveAuthor(new Author("6", "Jim", "Harmon", "http://www.gutenberg.org"));
        Author fetlet = authorRepository.saveAuthor(new Author("7", "Andrew", "Fetler", "http://www.gutenberg.org"));
        Author leiber = authorRepository.saveAuthor(new Author("8", "Fritz", "Leiber", "http://www.gutenberg.org"));
        Author janis = authorRepository.saveAuthor(new Author("9", "Jean", "Janis", "http://www.gutenberg.org"));
        Author mayhem = authorRepository.saveAuthor(new Author("10", "Johnny", "Mayhem", "http://www.gutenberg.org"));
        Author savage = authorRepository.saveAuthor(new Author("11", "Arthur", "Savage", "http://www.gutenberg.org"));
        Author young = authorRepository.saveAuthor(new Author("12", "Robert", "Young", "http://www.gutenberg.org"));
        Author miller = authorRepository.saveAuthor(new Author("13", "R", "DeWitt Miller", "http://www.gutenberg.org"));
        Author stecher = authorRepository.saveAuthor(new Author("14", "L. J.", "Stecher JR.", "http://www.gutenberg.org"));
        Author stuart = authorRepository.saveAuthor(new Author("15", "William", "Stuart", "http://www.gutenberg.org"));
        Author leinster = authorRepository.saveAuthor(new Author("16", "Murray", "Leinster", "http://www.gutenberg.org"));
        Author ludwig = authorRepository.saveAuthor(new Author("17", "Edward", "Ludwig", "http://www.gutenberg.org"));


        try {


            // Create the books
            bookRepository.saveBook(
// Path: rest-server/src/main/java/com/readlearncode/dukesbookshop/restserver/domain/Author.java
// @XmlRootElement
// public class Author implements Serializable {
// 
//     private String id;
//     private String firstName;
//     private String lastName;
//     private String blogURL;
// 
//     public Author() {
//     }
// 
//     public Author(String id, String firstName, String lastName) {
//         this.id = id;
//         this.firstName = firstName;
//         this.lastName = lastName;
//     }
// 
//     public Author(String id, String firstName, String lastName, String blogURL) {
//         this(id, firstName, lastName);
//         this.blogURL = blogURL;
//     }
// 
// 
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getId() {
//         return id;
//     }
// 
//     @GET
//     @Path("/firstName")
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getFirstName() {
//         return firstName;
//     }
// 
//     @GET
//     @Path("/lastName")
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getLastName() {
//         return lastName;
//     }
// 
//     @GET
//     @Path("/blog")
//     @Produces(MediaType.APPLICATION_JSON)
//     public String getBlogURL() {
//         return blogURL;
//     }
// 
//     public void setId(String id) {
//         this.id = id;
//     }
// 
//     public void setFirstName(String firstName) {
//         this.firstName = firstName;
//     }
// 
//     public void setLastName(String lastName) {
//         this.lastName = lastName;
//     }
// 
//     public void setBlogURL(String blogURL) {
//         this.blogURL = blogURL;
//     }
// 
// 
// }
// 
// Path: rest-server/src/main/java/com/readlearncode/dukesbookshop/restserver/domain/BookBuilder.java
// public class BookBuilder {
//     private String id;
//     private String title;
//     private String description;
//     private Float price;
//     private Date published;
//     private ArrayList<Author> authors = new ArrayList<>();
//     private String imageFileName;
//     private String link;
// 
//     public BookBuilder setId(String id) {
//         this.id = id;
//         return this;
//     }
// 
//     public BookBuilder setTitle(String title) {
//         this.title = title;
//         return this;
//     }
// 
//     public BookBuilder setDescription(String description) {
//         this.description = description;
//         return this;
//     }
// 
//     public BookBuilder setPrice(Float price) {
//         this.price = price;
//         return this;
//     }
// 
//     public BookBuilder setPublished(Date published) {
//         this.published = published;
//         return this;
//     }
// 
//     public BookBuilder setAuthors(ArrayList<Author> authors) {
//         this.authors.addAll(authors);
//         return this;
//     }
// 
//     public BookBuilder addAuthor(Author author) {
//         this.authors.add(author);
//         return this;
//     }
// 
//     public BookBuilder setImageFileName(String imageFileName) {
//         this.imageFileName = imageFileName;
//         return this;
//     }
// 
//     public BookBuilder setLink(String link) {
//         this.link = link;
//         return this;
//     }
// 
//     public Book createBook() {
//         return new Book(id, title, description, price, published, authors, imageFileName, link);
//     }
// }


// Path: rest-server/src/main/java/com/readlearncode/dukesbookshop/restserver/infrastructure/BootstrapData.java
import com.readlearncode.dukesbookshop.restserver.domain.Author;
import com.readlearncode.dukesbookshop.restserver.domain.BookBuilder;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

    @PostConstruct
    public void populateRepositories() {

        DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");

        // Create the authors
        Author meek = authorRepository.saveAuthor(new Author("1", "Captain S. P.", "Meek", "http://www.gutenberg.org"));
        Author wright = authorRepository.saveAuthor(new Author("2", "Sewell", "Peaslee Wright", "http://www.gutenberg.org"));
        Author knight = authorRepository.saveAuthor(new Author("3", "Damon Francis", "Knight", "http://www.gutenberg.org"));
        Author dee = authorRepository.saveAuthor(new Author("4", "Roger", "Dee", "http://www.gutenberg.org"));
        Author sohl = authorRepository.saveAuthor(new Author("5", "Gerald Allan", "Sohl", "http://www.gutenberg.org"));
        Author harmon = authorRepository.saveAuthor(new Author("6", "Jim", "Harmon", "http://www.gutenberg.org"));
        Author fetlet = authorRepository.saveAuthor(new Author("7", "Andrew", "Fetler", "http://www.gutenberg.org"));
        Author leiber = authorRepository.saveAuthor(new Author("8", "Fritz", "Leiber", "http://www.gutenberg.org"));
        Author janis = authorRepository.saveAuthor(new Author("9", "Jean", "Janis", "http://www.gutenberg.org"));
        Author mayhem = authorRepository.saveAuthor(new Author("10", "Johnny", "Mayhem", "http://www.gutenberg.org"));
        Author savage = authorRepository.saveAuthor(new Author("11", "Arthur", "Savage", "http://www.gutenberg.org"));
        Author young = authorRepository.saveAuthor(new Author("12", "Robert", "Young", "http://www.gutenberg.org"));
        Author miller = authorRepository.saveAuthor(new Author("13", "R", "DeWitt Miller", "http://www.gutenberg.org"));
        Author stecher = authorRepository.saveAuthor(new Author("14", "L. J.", "Stecher JR.", "http://www.gutenberg.org"));
        Author stuart = authorRepository.saveAuthor(new Author("15", "William", "Stuart", "http://www.gutenberg.org"));
        Author leinster = authorRepository.saveAuthor(new Author("16", "Murray", "Leinster", "http://www.gutenberg.org"));
        Author ludwig = authorRepository.saveAuthor(new Author("17", "Edward", "Ludwig", "http://www.gutenberg.org"));


        try {


            // Create the books
            bookRepository.saveBook(
                    new BookBuilder()