Kawai Wiki

Rev

Rev 195 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.kawai.dao;

import java.util.List;

import org.kawai.model.Language;
import org.kawai.model.Page;
import org.kawai.model.Preview;
import org.kawai.model.Revision;

/**
 * Interace DAO PageDAO.
 *
 * @author Sergio Oliveira
 *
 */

public interface PageDAO {

    /**
     * Loads the page by id.
     * @param id int
     * @return Page
     */

    public Page load(int id);
   
    public Page loadWithTitleOnly(String name, Language lang);

    /**
     * Updates the page.
     * @param p Page
     */

    public void update(Page p);

    /**
     * Loads the page by name and language.
     * @param name String
     * @param lang Language
     * @return Page
     */

    public Page loadByName(String name, Language lang);

    /**
     * Loads the page by name, language and revision.
     * @param name String
     * @param lang Language
     * @param revision int
     * @return Page
     */

    public Page loadByName(String name, Language lang, int revision);

    /**
     * Loads the page by userId, name and language.
     * @param userId int
     * @param name String
     * @param lang Language
     * @return Page
     */

    public Page loadByNameWithPreview(int userId, String name, Language lang);

    /**
     * Loads the front page by language.
     * @param lang Language
     * @return Page
     */

    public Page loadFrontPage(Language lang);

    /**
     * Inserts the page.
     * @param p Page
     */

    public void insert(Page p);

    /**
     * Checks if page exists by name and language.
     * @param name String
     * @param lang Language
     * @return boolean
     */

    public boolean exists(String name, Language lang);

    /**
     * Checks if isSystemPage.
     * @param name String
     * @return boolean
     */

    public boolean isSystemPage(String name);

    /**
     * Loads all pages including the system pages or not.
     * @param includeSystemPages boolean
     * @return List<Page>
     */

    public List<Page> loadAll(boolean includeSystemPages);

    /**
     * Sets the new front page.
     * @param p Page
     * @return boolean
     */

    public boolean setNewFrontPage(Page p);

    /**
     * Delete page.
     * @param p Page
     * @return boolean
     */

    public boolean delete(Page p);

    /**
     * Gets the front page by language.
     * @param lang Language
     * @return String
     */

    public String getFrontPage(Language lang);

    /**
     * Loads the preview by userid, name and language.
     * @param userId int
     * @param name String
     * @param lang Language
     * @return Preview
     */

    public Preview loadPreview(int userId, String name, Language lang);

    /**
     * Insert the preview with userId, page and comment.
     * @param userId int
     * @param p Page
     * @param comment String
     * @return Preview
     */

    public Preview insertPreview(int userId, Page p, String comment);

    /**
     * Delete the preview with userId, name and language.
     * @param userId int
     * @param name String
     * @param lang Language
     */

    public void deletePreview(int userId, String name, Language lang);

    /**
     * Loads the revision by revision id, name and language.
     * @param revision int
     * @param name String
     * @param lang Language
     * @return Revision
     */

    public Revision loadRevision(int revision, String name, Language lang);

    /**
     * Insert the revision.
     * @param r Revision
     */

    public void insertRevision(Revision r);

    /**
     * Load revisions by name and language.
     * @param name String
     * @param lang Language
     * @return List < Revision >
     */

    public List<Revision> loadRevisions(String name, Language lang);

    /**
     * Load the last revisions by language and including or not system pages.
     * @param lang Language
     * @param includeSystemPages boolean
     * @return List < Revision >
     */

    public List<Revision> loadLastRevisions(Language lang, boolean includeSystemPages);
}