// Path: demo/src/main/java/com/basilgregory/onamsample/entities/Comment.java
// @Table
// public class Comment extends Entity {
//     private String comment;
//     private long createdAt;
// 
//     private Post post;
//     private User user;
// 
// 
//     public String getComment() {
//         return comment;
//     }
// 
//     public void setComment(String comment) {
//         this.comment = comment;
//     }
// 
//     public long getCreatedAt() {
//         return createdAt;
//     }
// 
//     public void setCreatedAt(long createdAt) {
//         this.createdAt = createdAt;
//     }
// 
//     @ManyToOne
//     @Column(name = "post_id")
//     public Post getPost() {
//         return fetch(this.post,new Post(){});
//     }
// 
//     public void setPost(Post post) {
//         this.post = post;
//     }
// 
//     @ManyToOne
//     @Column(name = "creator_id")
//     public User getUser() {
//         return fetch(this.user,new User(){});
//     }
// 
//     public void setUser(User user) {
//         this.user = user;
//     }
// 
//     /**
//      * You may create any number of @BeforeCreate functions and will be executed before actual insertion to the database
//      * The order of execution of @BeforeCreate functions (incase of more than one) will be random.
//      */
//     @BeforeCreate
//     public void settingTimeStamps(){
//         createdAt = System.currentTimeMillis();
//     }
// 
//     /**
//      * You may create any number of #{{@link AfterCreate}} functions and will be executed before actual insertion to the
//      * database
//      * The order of execution of #{{@link AfterCreate}} functions (incase of more than one) will be random.
//      */
//     @AfterCreate
//     public void afterCreate(){
//         this.comment = "Comment: "+this.comment;
//     }
// }
// 
// Path: demo/src/main/java/com/basilgregory/onamsample/entities/Post.java
// @Table
// public class Post extends Entity {
//     private String title;
//     private Object post;
// 
//     //If you need to include a property that is not be inserted/updated to database then you have to specify the modifier transient
//     private transient String transientPost;
// 
// 
//     private long createdAt;
// 
//     private List<User> followers;
// 
//     private List<Comment> comments;
//     private User user;
// 
//     @Column(unique = true)
//     @Json(fieldName = "title")
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     @Json(fieldName = "post")
//     public Object getPost() {
//         return post;
//     }
// 
//     public void setPost(Object post) {
//         this.post = post;
//     }
// 
//     @Json(fieldName = "created_at")
//     public long getCreatedAt() {
//         return createdAt;
//     }
// 
//     public void setCreatedAt(long createdAt) {
//         this.createdAt = createdAt;
//     }
// 
//     @OneToMany(referencedColumnName = "post_id", targetEntity = Comment.class)
//     public List<Comment> getComments() {
//         return fetch(this.comments,new Comment(){});
//     }
// 
//     public void setComments(List<Comment> comments) {
//         this.comments = comments;
//     }
// 
//     @ManyToOne
//     public User getUser() {
//         return fetch(this.user,new User(){});
//     }
// 
//     public void setUser(User user) {
//         this.user = user;
//     }
// 
//     @ManyToMany(tableName = "post_followers", targetEntity = User.class)
//     public List<User> getFollowers() {
//         return fetch(this.followers,new User(){});
//     }
// 
//     public void setFollowers(List<User> followers) {
//         this.followers = followers;
//     }
// 
//     public String getTransientPost() {
//         return transientPost;
//     }
// 
//     public void setTransientPost(String transientPost) {
//         this.transientPost = transientPost;
//     }
// }
// 
// Path: demo/src/main/java/com/basilgregory/onamsample/entities/User.java
// @Table
// public class User extends Entity {
//     private String name;
//     private String bio;
// 
// 
//     private List<Post> followedPosts;
//     private List<Post> posts;
//     private List<Comment> comments;
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getBio() {
//         return bio;
//     }
// 
//     public void setBio(String bio) {
//         this.bio = bio;
//     }
// 
//     @OneToMany(targetEntity = Post.class)
//     public List<Post> getPosts() {
//         return fetch(this.posts,new Post(){});
//     }
// 
//     public void setPosts(List<Post> posts) {
//         this.posts = posts;
//     }
// 
//     @OneToMany(targetEntity = Comment.class)
//     public List<Comment> getComments() {
//         return fetch(this.comments,new Comment(){});
//     }
// 
//     public void setComments(List<Comment> comments) {
//         this.comments = comments;
//     }
// 
//     @ManyToMany(tableName = "post_followers", targetEntity = Post.class)
//     public List<Post> getFollowedPosts() {
//         return fetch(this.followedPosts,new Post(){});
//     }
// 
//     public void setFollowedPosts(List<Post> followedPosts) {
//         this.followedPosts = followedPosts;
//     }
// }


import com.basilgregory.onam.annotations.Json;
import com.basilgregory.onamsample.entities.Comment;
import com.basilgregory.onamsample.entities.Post;
import com.basilgregory.onamsample.entities.User;
import java.util.List;
package com.basilgregory.onamsample.views;



/**
 * Created by donpeter on 10/5/17.
 */

public class PostView {
    private Post post;

    public PostView(Post post) {
        this.post = post;
    }
    @Json(fieldName = "title")
    public String getTitle() {
        return post.getTitle();
    }

    @Json(fieldName = "created_at")
    public long getCreatedAt() {
        return post.getCreatedAt();
    }

// Path: demo/src/main/java/com/basilgregory/onamsample/entities/Comment.java
// @Table
// public class Comment extends Entity {
//     private String comment;
//     private long createdAt;
// 
//     private Post post;
//     private User user;
// 
// 
//     public String getComment() {
//         return comment;
//     }
// 
//     public void setComment(String comment) {
//         this.comment = comment;
//     }
// 
//     public long getCreatedAt() {
//         return createdAt;
//     }
// 
//     public void setCreatedAt(long createdAt) {
//         this.createdAt = createdAt;
//     }
// 
//     @ManyToOne
//     @Column(name = "post_id")
//     public Post getPost() {
//         return fetch(this.post,new Post(){});
//     }
// 
//     public void setPost(Post post) {
//         this.post = post;
//     }
// 
//     @ManyToOne
//     @Column(name = "creator_id")
//     public User getUser() {
//         return fetch(this.user,new User(){});
//     }
// 
//     public void setUser(User user) {
//         this.user = user;
//     }
// 
//     /**
//      * You may create any number of @BeforeCreate functions and will be executed before actual insertion to the database
//      * The order of execution of @BeforeCreate functions (incase of more than one) will be random.
//      */
//     @BeforeCreate
//     public void settingTimeStamps(){
//         createdAt = System.currentTimeMillis();
//     }
// 
//     /**
//      * You may create any number of #{{@link AfterCreate}} functions and will be executed before actual insertion to the
//      * database
//      * The order of execution of #{{@link AfterCreate}} functions (incase of more than one) will be random.
//      */
//     @AfterCreate
//     public void afterCreate(){
//         this.comment = "Comment: "+this.comment;
//     }
// }
// 
// Path: demo/src/main/java/com/basilgregory/onamsample/entities/Post.java
// @Table
// public class Post extends Entity {
//     private String title;
//     private Object post;
// 
//     //If you need to include a property that is not be inserted/updated to database then you have to specify the modifier transient
//     private transient String transientPost;
// 
// 
//     private long createdAt;
// 
//     private List<User> followers;
// 
//     private List<Comment> comments;
//     private User user;
// 
//     @Column(unique = true)
//     @Json(fieldName = "title")
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     @Json(fieldName = "post")
//     public Object getPost() {
//         return post;
//     }
// 
//     public void setPost(Object post) {
//         this.post = post;
//     }
// 
//     @Json(fieldName = "created_at")
//     public long getCreatedAt() {
//         return createdAt;
//     }
// 
//     public void setCreatedAt(long createdAt) {
//         this.createdAt = createdAt;
//     }
// 
//     @OneToMany(referencedColumnName = "post_id", targetEntity = Comment.class)
//     public List<Comment> getComments() {
//         return fetch(this.comments,new Comment(){});
//     }
// 
//     public void setComments(List<Comment> comments) {
//         this.comments = comments;
//     }
// 
//     @ManyToOne
//     public User getUser() {
//         return fetch(this.user,new User(){});
//     }
// 
//     public void setUser(User user) {
//         this.user = user;
//     }
// 
//     @ManyToMany(tableName = "post_followers", targetEntity = User.class)
//     public List<User> getFollowers() {
//         return fetch(this.followers,new User(){});
//     }
// 
//     public void setFollowers(List<User> followers) {
//         this.followers = followers;
//     }
// 
//     public String getTransientPost() {
//         return transientPost;
//     }
// 
//     public void setTransientPost(String transientPost) {
//         this.transientPost = transientPost;
//     }
// }
// 
// Path: demo/src/main/java/com/basilgregory/onamsample/entities/User.java
// @Table
// public class User extends Entity {
//     private String name;
//     private String bio;
// 
// 
//     private List<Post> followedPosts;
//     private List<Post> posts;
//     private List<Comment> comments;
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getBio() {
//         return bio;
//     }
// 
//     public void setBio(String bio) {
//         this.bio = bio;
//     }
// 
//     @OneToMany(targetEntity = Post.class)
//     public List<Post> getPosts() {
//         return fetch(this.posts,new Post(){});
//     }
// 
//     public void setPosts(List<Post> posts) {
//         this.posts = posts;
//     }
// 
//     @OneToMany(targetEntity = Comment.class)
//     public List<Comment> getComments() {
//         return fetch(this.comments,new Comment(){});
//     }
// 
//     public void setComments(List<Comment> comments) {
//         this.comments = comments;
//     }
// 
//     @ManyToMany(tableName = "post_followers", targetEntity = Post.class)
//     public List<Post> getFollowedPosts() {
//         return fetch(this.followedPosts,new Post(){});
//     }
// 
//     public void setFollowedPosts(List<Post> followedPosts) {
//         this.followedPosts = followedPosts;
//     }
// }


// Path: demo/src/main/java/com/basilgregory/onamsample/views/PostView.java
import com.basilgregory.onam.annotations.Json;
import com.basilgregory.onamsample.entities.Comment;
import com.basilgregory.onamsample.entities.Post;
import com.basilgregory.onamsample.entities.User;
import java.util.List;

package com.basilgregory.onamsample.views;



/**
 * Created by donpeter on 10/5/17.
 */

public class PostView {
    private Post post;

    public PostView(Post post) {
        this.post = post;
    }
    @Json(fieldName = "title")
    public String getTitle() {
        return post.getTitle();
    }

    @Json(fieldName = "created_at")
    public long getCreatedAt() {
        return post.getCreatedAt();
    }

    public List<Comment> getComments() {