Package net.sourceforge.pebble.dao

Examples of net.sourceforge.pebble.dao.StaticPageDAO


   */
  public List<StaticPage> getStaticPages(Blog blog) throws StaticPageServiceException {
    List<StaticPage> staticPages = new ArrayList<StaticPage>();
    try {
      DAOFactory factory = DAOFactory.getConfiguredFactory();
      StaticPageDAO dao = factory.getStaticPageDAO();
      staticPages.addAll(dao.loadStaticPages(blog));
    } catch (PersistenceException pe) {
      throw new StaticPageServiceException(blog, pe);
    }

    Collections.sort(staticPages, new StaticPageByNameComparator());
View Full Code Here


        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);
        }
      }
View Full Code Here

   * @throws  StaticPageServiceException if something goes wrong
   */
  public void putStaticPage(StaticPage staticPage) throws StaticPageServiceException {
    ContentCache cache = ContentCache.getInstance();
    DAOFactory factory = DAOFactory.getConfiguredFactory();
    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));
          putStaticPage(staticPage);
        } else {
          dao.storeStaticPage(staticPage);
          staticPage.setPersistent(true);
          cache.removeStaticPage(staticPage);
        }

        staticPage.getBlog().getSearchIndex().index(staticPage);
View Full Code Here

   * @throws  StaticPageServiceException if something goes wrong
   */
  public void removeStaticPage(StaticPage staticPage) throws StaticPageServiceException {
    ContentCache cache = ContentCache.getInstance();
    DAOFactory factory = DAOFactory.getConfiguredFactory();
    StaticPageDAO dao = factory.getStaticPageDAO();
    Blog blog = staticPage.getBlog();

    try {
      dao.removeStaticPage(staticPage);
      cache.removeStaticPage(staticPage);

      staticPage.getBlog().getSearchIndex().unindex(staticPage);
      staticPage.getBlog().getStaticPageIndex().unindex(staticPage);
    } catch (PersistenceException pe) {
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.dao.StaticPageDAO

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.