Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.Blog


  private String getTwitterUsername(BlogEntry blogEntry) {
    return getProperty(blogEntry, "username");
  }
 
  private String getProperty(BlogEntry blogEntry, String property) {
    Blog blog = blogEntry.getBlog();
    String blogName = blog.getName();
    PluginProperties pluginProperties = blog.getPluginProperties();
    String result = pluginProperties.getProperty("twitter." + blogName + "." + property);
    if(result == null) {
      result = pluginProperties.getProperty("twitter." + property);
      if(result == null) {
        log.error("Twitter credentials (" + property + ") not found. Please configure twitter." + property + " in order to post to twitter");
View Full Code Here


   * @param request  the HttpServletRequest instance
   * @param response the HttpServletResponse instance
   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    String username = request.getParameter("user");
    SecurityRealm realm = PebbleContext.getInstance().getConfiguration().getSecurityRealm();
    try {
      PebbleUserDetails user = realm.getUser(username);
      if (user != null) {
        getModel().put(Constants.USER_KEY, user);
        getModel().put(Constants.BLOG_ENTRIES, blog.getRecentPublishedBlogEntries(username));
        return new AboutAuthorView();
      }
    } catch (SecurityRealmException e) {
      log.error("Exception encountered", e);
    }
View Full Code Here

   * Called when a comment or TrackBack has been added.
   *
   * @param response a Response
   */
  protected void blogEntryResponseAdded(Response response) {
    Blog blog = response.getBlogEntry().getBlog();
    if (SecurityUtils.isUserAuthorisedForBlog(blog)) {
      response.setApproved();
    }
  }
View Full Code Here

   * Gets the permalink for a blog entry.
   *
   * @return  a URI as a String
   */
  public String getPermalink(BlogEntry blogEntry) {
    Blog blog = blogEntry.getBlog();
    Date date = blogEntry.getDate();
    DateFormat year = new SimpleDateFormat("yyyy");
    year.setTimeZone(blog.getTimeZone());
    DateFormat month = new SimpleDateFormat("MM");
    month.setTimeZone(blog.getTimeZone());
    DateFormat day = new SimpleDateFormat("dd");
    day.setTimeZone(blog.getTimeZone());

    StringBuffer buf = new StringBuffer();
    buf.append("/");
    buf.append(year.format(date));
    buf.append("/");
View Full Code Here

public class Comments {

  private static final Log log = LogFactory.getLog(Comments.class);

  public Comment previewComment(String blogId, Comment comment) {
    Blog blog = BlogManager.getInstance().getBlog(blogId);

    ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
    decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
    decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);

    blog.getContentDecoratorChain().decorate(decoratorContext, comment);

    return comment;
  }
View Full Code Here

    return comment;
  }

  public Comment saveComment(String blogId, Comment comment) {
    Blog blog = BlogManager.getInstance().getBlog(blogId);

    ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
    decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
    decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);

    blog.getContentDecoratorChain().decorate(decoratorContext, comment);

    return comment;
  }
View Full Code Here

   *
   * @param uri   a relative URI
   * @return  a BlogEntry instance, or null if one can't be found
   */
  public BlogEntry getBlogEntry(String uri) {
    Blog blog = getBlog();
    BlogService service = new BlogService();
    try {
      return service.getBlogEntry(blog, uri.substring(12, uri.lastIndexOf(".")));
    } catch (BlogServiceException e) {
      return null;
View Full Code Here

    for (String role : roles) {
      if (role.equals(Constants.ANY_ROLE)) {
        return true;
      } else if (SecurityUtils.isUserInRole(role)) {
        if (ab instanceof Blog) {
          Blog blog = (Blog) ab;
          if (blog.isUserInRole(role, currentUser)) {
            return true;
          }
        } else {
          return true;
        }
View Full Code Here

  public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
    AbstractBlog abstractBlog = (AbstractBlog)request.getAttribute(Constants.BLOG_KEY);

    if (abstractBlog instanceof Blog) {
      Blog blog = (Blog)abstractBlog;
      if (SecurityUtils.isUserAuthorisedForBlog(blog)) {
        return EVAL_BODY_INCLUDE;
      }
    }
View Full Code Here

  public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
    AbstractBlog abstractBlog = (AbstractBlog)request.getAttribute(Constants.BLOG_KEY);

    if (abstractBlog instanceof Blog) {
      Blog blog = (Blog)abstractBlog;
      if (SecurityUtils.isBlogAdmin() || SecurityUtils.isUserAuthorisedForBlogAsBlogOwner(blog)) {
        return EVAL_BODY_INCLUDE;
      }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.domain.Blog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.