⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mockstaticpagedao.java

📁 pebble-blog 博客源码博客源码博客源码
💻 JAVA
字号:
package net.sourceforge.pebble.dao.mock;import net.sourceforge.pebble.dao.PersistenceException;import net.sourceforge.pebble.dao.StaticPageDAO;import net.sourceforge.pebble.domain.Blog;import net.sourceforge.pebble.domain.StaticPage;import java.util.Collection;import java.util.HashMap;import java.util.Map;/** * This is a mock implementation of StaticPageDAO that is used when performing * unit tests. * * @author    Simon Brown */public class MockStaticPageDAO implements StaticPageDAO {  private Map<String,StaticPage> pages = new HashMap<String,StaticPage>();  /**   * Loads the static pages for a given blog.   *   * @param blog    the owning Blog instance   * @return  a Collection of StaticPage instances   * @throws  PersistenceException    if static pages cannot be loaded   */  public Collection<StaticPage> loadStaticPages(Blog blog) throws PersistenceException {    return pages.values();  }  /**   * Loads a specific static page.   *   * @param blog    the owning Blog   * @param pageId   the page ID   * @return a StaticPage instance   * @throws PersistenceException   if the static page cannot be loaded   */  public StaticPage loadStaticPage(Blog blog, String pageId) throws PersistenceException {    return pages.get(pageId);  }  /**   * Stores the specified static page.   *   * @param staticPage the static page to store   * @throws net.sourceforge.pebble.dao.PersistenceException   *          if something goes wrong storing the static page   */  public void storeStaticPage(StaticPage staticPage) throws PersistenceException {    pages.put(staticPage.getId(), staticPage);  }  /**   * Removes the specified static page.   *   * @param staticPage the static page to remove   * @throws net.sourceforge.pebble.dao.PersistenceException   *          if something goes wrong removing the page   */  public void removeStaticPage(StaticPage staticPage) throws PersistenceException {    pages.remove(staticPage.getId());  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -