001: /* ***** BEGIN LICENSE BLOCK *****
002: * Version: MPL 1.1
003: * The contents of this file are subject to the Mozilla Public License Version
004: * 1.1 (the "License"); you may not use this file except in compliance with
005: * the License. You may obtain a copy of the License at
006: * http://www.mozilla.org/MPL/
007: *
008: * Software distributed under the License is distributed on an "AS IS" basis,
009: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
010: * for the specific language governing rights and limitations under the
011: * License.
012: *
013: * The Original Code is Riot.
014: *
015: * The Initial Developer of the Original Code is
016: * Neteye GmbH.
017: * Portions created by the Initial Developer are Copyright (C) 2007
018: * the Initial Developer. All Rights Reserved.
019: *
020: * Contributor(s):
021: * Felix Gnass [fgnass at neteye dot de]
022: *
023: * ***** END LICENSE BLOCK ***** */
024: package org.riotfamily.pages.dao;
025:
026: import java.util.List;
027:
028: import org.riotfamily.pages.model.Page;
029: import org.riotfamily.pages.model.PageAlias;
030: import org.riotfamily.pages.model.PageNode;
031: import org.riotfamily.pages.model.Site;
032: import org.springframework.dao.IncorrectResultSizeDataAccessException;
033:
034: /**
035: * DAO interface for {@link Page pages} and {@link PageAlias aliases}.
036: * <p>
037: * Implementors should extend {@link AbstractPageDao} instead of implementing
038: * this interface directly.
039: *
040: * @author Felix Gnass [fgnass at neteye dot de]
041: * @since 6.5
042: */
043: public interface PageDao {
044:
045: /**
046: * Loads the Page with the given id.
047: */
048: public Page loadPage(Long id);
049:
050: public Site findSite(String hostName, String path);
051:
052: /**
053: * Returns the Page with the given site and path, or <code>null</code> if
054: * no such page exists.
055: */
056: public Page findPage(Site site, String path);
057:
058: /**
059: * Returns the PageAlias with the given site and path, or <code>null</code> if
060: * no such alias exists.
061: */
062: public PageAlias findPageAlias(Site site, String path);
063:
064: /**
065: * Returns the PageNode with the given handlerName, or <code>null</code> if
066: * no such node exists.
067: * @throws IncorrectResultSizeDataAccessException if more than one node
068: * exists with the given handlerName
069: */
070: public PageNode findNodeForHandler(String handlerName);
071:
072: /**
073: * Returns the Page with the given handlerName and site,
074: * or <code>null</code> if no such page exists.
075: * @throws IncorrectResultSizeDataAccessException if more than one page
076: * exists with the given handlerName
077: */
078: public Page findPageForHandler(String handlerName, Site site);
079:
080: /**
081: * Returns all pages with the given handlerName and site,
082: * or an empty list if no page is found.
083: */
084: public List findPagesForHandler(String handlerName, Site site);
085:
086: /**
087: *
088: */
089: public List getWildcardPaths(Site site);
090:
091: /**
092: * Returns the root node.
093: */
094: public PageNode getRootNode();
095:
096: public void saveNode(PageNode node);
097:
098: public void savePage(Site site, Page page);
099:
100: public void savePage(Page parent, Page child);
101:
102: public Page addTranslation(Page page, Site site);
103:
104: public void updatePage(Page page);
105:
106: public void deletePage(Page page);
107:
108: public void deleteAlias(Page page);
109:
110: public void updateNode(PageNode node);
111:
112: public void moveNode(PageNode node, PageNode newParent);
113:
114: public Site loadSite(Long id);
115:
116: /**
117: * Returns the first site returned by listSites().
118: */
119: public Site getDefaultSite();
120:
121: /**
122: * Returns all sites.
123: */
124: public List listSites();
125:
126: public void saveSite(Site site);
127:
128: public void updateSite(Site site);
129:
130: public void deleteSite(Site site);
131:
132: }
|