use of com.pratilipi.data.client.BlogPostData in project pratilipi by Pratilipi.
the class BlogPostDataUtil method createBlogPostData.
public static BlogPostData createBlogPostData(BlogPost blogPost, Page blogPostPage) {
BlogPostData blogPostData = new BlogPostData(blogPost.getId());
blogPostData.setBlogId(blogPost.getBlogId());
blogPostData.setTitle(blogPost.getTitle());
blogPostData.setTitleEn(blogPost.getTitleEn());
blogPostData.setContent(blogPost.getContent());
blogPostData.setLanguage(blogPost.getLanguage());
blogPostData.setState(blogPost.getState());
User user = DataAccessorFactory.getDataAccessor().getUser(blogPost.getCreatedBy());
if (user != null) {
UserData userData = UserDataUtil.createUserData(user);
blogPostData.setCreatedBy(userData);
}
blogPostData.setCreationDate(blogPost.getCreationDate());
blogPostData.setLastUpdated(blogPost.getLastUpdated());
blogPostData.setPageUrl(blogPostPage.getUriAlias() == null ? blogPostPage.getUri() : blogPostPage.getUriAlias());
blogPostData.setAccessToUpdate(hasAccessToUpdateBlogPostData(blogPost, null));
return blogPostData;
}
Aggregations