private BlogPost getBlogPost() { if (null == blogPost) blogPost = pageManager.getBlogPost(spaceKey, blogTitle, publishedDate); return blogPost; }
@Override public Map<String, ?> getBlogPost(String authenticationToken, String id) { Map<String, Object> postStructure = null; BlogPost post = getPageManager().getBlogPost(Long.parseLong(id)); if (null != post && permissionManager.hasPermission(AuthenticatedUserThreadLocal.getUser(), Permission.VIEW, post)) { postStructure = new Hashtable<String, Object>(); postStructure.put("id", post.getIdAsString()); postStructure.put("spaceKey", post.getSpaceKey()); postStructure.put("title", post.getTitle()); postStructure.put("version", post.getVersion()); postStructure.put("content", post.getBodyAsString()); if (StringUtils.isNotBlank(post.getCreatorName())) postStructure.put("creator", post.getCreatorName()); postStructure.put("created", post.getCreationDate()); } return postStructure; } }
public String getBlogPostId( final String authenticationToken, final String spaceKey, final String title, final Date day) throws RemoteException { final Calendar _day; final BlogPost blogPost; if (StringUtils.isBlank(spaceKey)) throw new RemoteException("Space key not specified."); if (StringUtils.isBlank(title)) throw new RemoteException("Blog post title not specified."); if (null == day) throw new RemoteException("Blog post publish date not specified."); _day = Calendar.getInstance(getUserTimeZone()); _day.setTime(day); blogPost = getPageManager().getBlogPost(spaceKey, title, _day); return (null != blogPost && getPermissionManager().hasPermission(AuthenticatedUserThreadLocal.getUser(), Permission.VIEW, blogPost)) ? blogPost.getIdAsString() : null; }