Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.StaticPage


  protected void setUp() throws Exception {
    super.setUp();

    decorator = new EscapeMarkupDecorator();
    blogEntry = new BlogEntry(blog);
    staticPage = new StaticPage(blog);
    context = new ContentDecoratorContext();
  }
View Full Code Here


  protected void setUp() throws Exception {
    super.setUp();

    decorator = new PhotoDecorator();
    blogEntry = new BlogEntry(blog);
    staticPage = new StaticPage(blog);
    context = new ContentDecoratorContext();
  }
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();

    blogEntry = new BlogEntry(blog);
    staticPage = new StaticPage(blog);
    decorator = new RelativeUriDecorator();
    context = new ContentDecoratorContext();
    decorator.setBlog(blog);
  }
View Full Code Here

      return "template";
    }
    if (!getModel().contains(Constants.STATIC_PAGE_KEY)) {
      return "template";
    }
    StaticPage staticPage = (StaticPage) getModel().get(Constants.STATIC_PAGE_KEY);
    Blog blog = (Blog) getModel().get(Constants.BLOG_KEY);
    String templateFile = blog.getThemeDirectory() + "/" + staticPage.getTemplate() + ".jsp";
    if (new File(templateFile).canRead()) {
      return staticPage.getTemplate();
    }
    return "template";
  }
View Full Code Here

   * @return the name of the next view
   */
  public View process(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    StaticPageService service = new StaticPageService();
    StaticPage staticPage = null;
    try {
      staticPage = service.getStaticPageById(blog, request.getParameter("page"));
    } catch (StaticPageServiceException e) {
      throw new ServletException(e);
    }
View Full Code Here

  /**
   * Prepares the view for presentation.
   */
  public void prepare() {
    StaticPage staticPage = (StaticPage)getModel().get(Constants.STATIC_PAGE_KEY);
    StaticPage previewStaticPage = (StaticPage)staticPage.clone();

    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.PREVIEW);
    context.setMedia(ContentDecoratorContext.HTML_PAGE);
    staticPage.getBlog().getContentDecoratorChain().decorate(context, previewStaticPage);
View Full Code Here

   * Gets the title of this view.
   *
   * @return the title as a String
   */
  public String getTitle() {
    StaticPage staticPage = (StaticPage)getModel().get(Constants.STATIC_PAGE_KEY);
    return staticPage.getTitle();
  }
View Full Code Here

   * @param blog    the Blog
   * @return  a Page instance, or null if the page couldn't be found
   * @throws  StaticPageServiceException if something goes wrong
   */
  public StaticPage getStaticPageById(Blog blog, String pageId) throws StaticPageServiceException {
    StaticPage staticPage;
    ContentCache cache = ContentCache.getInstance();

    try {
      staticPage = cache.getStaticPage(blog, pageId);
      if (staticPage != null) {
        log.debug("Got static page " + pageId+ " from cache");
      } else {
        log.debug("Loading static page " + pageId+ " from disk");

        DAOFactory factory = DAOFactory.getConfiguredFactory();
        StaticPageDAO dao = factory.getStaticPageDAO();
        staticPage = dao.loadStaticPage(blog, pageId);
        if (staticPage != null) {
          staticPage.setPersistent(true);
          cache.putStaticPage(staticPage);
        }
      }
    } catch (PersistenceException pe) {
      throw new StaticPageServiceException(blog, pe);
    }

    if (staticPage != null) {
      staticPage = (StaticPage)staticPage.clone();
    }

    return staticPage;
  }
View Full Code Here

    StaticPageDAO dao = factory.getStaticPageDAO();
    Blog blog = staticPage.getBlog();

    synchronized (blog) {
      try {
        StaticPage sp = getStaticPageById(blog, staticPage.getId());

        if (!staticPage.isPersistent() && sp != null) {
          // the static page is new but one exists with the same ID already
          // - increment the date/ID and try again
          staticPage.setDate(new Date(staticPage.getDate().getTime() + 1));
View Full Code Here

  public void prepare() {
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);
    context.setMedia(ContentDecoratorContext.HTML_PAGE);

    StaticPage staticPage = (StaticPage)getModel().get(Constants.STATIC_PAGE_KEY);
    staticPage.getBlog().getContentDecoratorChain().decorate(context, staticPage);
  }
View Full Code Here

TOP

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

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.