KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > pages > dao > PageDao


1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1
3  * The contents of this file are subject to the Mozilla Public License Version
4  * 1.1 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  * http://www.mozilla.org/MPL/
7  *
8  * Software distributed under the License is distributed on an "AS IS" basis,
9  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10  * for the specific language governing rights and limitations under the
11  * License.
12  *
13  * The Original Code is Riot.
14  *
15  * The Initial Developer of the Original Code is
16  * Neteye GmbH.
17  * Portions created by the Initial Developer are Copyright (C) 2007
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  * Felix Gnass [fgnass at neteye dot de]
22  *
23  * ***** END LICENSE BLOCK ***** */

24 package org.riotfamily.pages.dao;
25
26 import java.util.List JavaDoc;
27 import java.util.Locale JavaDoc;
28
29 import org.riotfamily.pages.Page;
30 import org.riotfamily.pages.PageAlias;
31 import org.riotfamily.pages.PageLocation;
32 import org.riotfamily.pages.PageNode;
33 import org.riotfamily.pages.Site;
34 import org.springframework.dao.IncorrectResultSizeDataAccessException;
35
36 /**
37  * DAO interface for {@link Page pages} and {@link PageAlias aliases}.
38  * <p>
39  * Implementors should extend {@link AbstractPageDao} instead of implementing
40  * this interface directly.
41  *
42  * @author Felix Gnass [fgnass at neteye dot de]
43  * @since 6.5
44  */

45 public interface PageDao {
46
47     /**
48      * Loads the Page with the given id.
49      */

50     public Page loadPage(Long JavaDoc id);
51
52     /**
53      * Re-loads the given Page from the database.
54      */

55     public void refreshPage(Page page);
56
57     /**
58      * Returns the Page with the given location, or <code>null</code> if
59      * no such page exists.
60      */

61     public Page findPage(PageLocation location);
62
63     /**
64      * Returns the PageAlias with the given location, or <code>null</code> if
65      * no such alias exists.
66      */

67     public PageAlias findPageAlias(PageLocation location);
68
69     /**
70      * Returns the PageNode with the given handlerName, or <code>null</code> if
71      * no such node exists.
72      * @throws IncorrectResultSizeDataAccessException if more than one node
73      * exists with the given handlerName
74      */

75     public PageNode findNodeForHandler(String JavaDoc handlerName);
76
77     /**
78      * Returns the Page with the given handlerName and locale,
79      * or <code>null</code> if no such page exists.
80      * @throws IncorrectResultSizeDataAccessException if more than one page
81      * exists with the given handlerName and location
82      */

83     public Page findPageForHandler(String JavaDoc handlerName, Locale JavaDoc locale);
84
85     /**
86      * Returns all pages with the given handlerName and locale,
87      * or an empty list if no page is found.
88      */

89     public List JavaDoc findPagesForHandler(String JavaDoc handlerName, Locale JavaDoc locale);
90
91     /**
92      *
93      */

94     public List JavaDoc getWildcardPaths(PageLocation location);
95     
96     /**
97      * Returns the root node for the given site.
98      */

99     public PageNode findRootNode(Site site);
100
101     public void saveNode(PageNode node);
102
103     public void savePage(Site site, Page page);
104
105     public void savePage(Page parent, Page child);
106
107     public Page addTranslation(Page page, Locale JavaDoc locale);
108
109     public void updatePage(Page page);
110
111     public void deletePage(Page page);
112
113     public void updateNode(PageNode node);
114
115     public void moveNode(PageNode node, PageNode newParent);
116
117     public Site loadSite(Long JavaDoc id);
118
119     /**
120      * Returns the site with the specified name. If no such site exists a new
121      * site instance is created (and persisted).
122      */

123     public Site getSite(String JavaDoc name);
124
125     /**
126      * Returns the first site returned by listSites(). If no sites exist, a new
127      * site instance with a default name is created.
128      */

129     public Site getDefaultSite();
130
131     /**
132      * Returns all sites.
133      */

134     public List JavaDoc listSites();
135
136     public void saveSite(Site site);
137
138     public void updateSite(Site site);
139
140     public void deleteSite(Site site);
141
142     /**
143      * Returns a list containing all configured Locales. Implementors must
144      * return a list containing at least one element.
145      */

146     public List JavaDoc getLocales();
147
148 }
Popular Tags