KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > components > dao > ComponentDao


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) 2006
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.components.dao;
25
26 import java.util.List JavaDoc;
27 import java.util.Map JavaDoc;
28
29 import org.riotfamily.components.ComponentList;
30 import org.riotfamily.components.ComponentVersion;
31 import org.riotfamily.components.Location;
32 import org.riotfamily.components.VersionContainer;
33
34 /**
35  * DAO interface that provides methods to access
36  * {@link ComponentList ComponentList}s,
37  * {@link ComponentVersion ComponentVersion}s and
38  * {@link VersionContainer VersionContainer}s.
39  */

40 public interface ComponentDao {
41
42     /**
43      * Returns the {@link ComponentList} with the given location.
44      */

45     public ComponentList findComponentList(Location location);
46
47     /**
48      * Returns the nested {@link ComponentList} for the given parent/slot.
49      */

50     public ComponentList findComponentList(VersionContainer parent, String JavaDoc slot);
51
52     /**
53      * Returns all {@link ComponentList ComponentList} with the given type
54      * and path.
55      */

56     public List JavaDoc findComponentLists(String JavaDoc type, String JavaDoc path);
57
58     /**
59      * Returns all {@link ComponentList ComponentLists} marked as dirty.
60      */

61     public List JavaDoc findDirtyComponentLists();
62
63     /**
64      * Loads the ComponentList specified by the given id.
65      */

66     public ComponentList loadComponentList(Long JavaDoc id);
67
68     /**
69      * Loads the VersionContainer specified by the given id.
70      */

71     public VersionContainer loadVersionContainer(Long JavaDoc id);
72
73     /**
74      * Loads the ComponentVersion specified by the given id.
75      * @since 6.4
76      */

77     public ComponentVersion loadComponentVersion(Long JavaDoc id);
78
79     /**
80      * Saves the given ComponentList.
81      */

82     public void saveComponentList(ComponentList list);
83
84     /**
85      * Updates the given ComponentList.
86      */

87     public void updateComponentList(ComponentList list);
88
89     /**
90      * Updates the given VersionContainer.
91      */

92     public void updateVersionContainer(VersionContainer container);
93
94     /**
95      * Updates the given ComponentVersion.
96      */

97     public void updateComponentVersion(ComponentVersion version);
98
99     /**
100      * Deletes all {@link ComponentList ComponentLists} with the given path.
101      * @since 6.4
102      */

103     public void deleteComponentLists(String JavaDoc type, String JavaDoc path);
104
105     /**
106      * Deletes the given ComponentList.
107      */

108     public void deleteComponentList(ComponentList list);
109
110     /**
111      * Deletes the given ComponentVersion.
112      */

113     public void deleteComponentVersion(ComponentVersion version);
114
115     /**
116      * Deletes the given VersionContainer.
117      */

118     public void deleteVersionContainer(VersionContainer container);
119
120     /**
121      * Returns a list of {@link VersionContainer containers} that can be
122      * modified without affecting the live list. If the preview list does not
123      * already exist a new list is created and populated with the containers
124      * from the live list. This method does not create any copys since the
125      * containers themself are responisble for managing the different versions.
126      */

127     public List JavaDoc getOrCreatePreviewContainers(ComponentList list);
128
129     /**
130      * Returns a ComponentVersion and creates it if it does not already exist.
131      * Whether the live or preview version is returned is controlled by the
132      * <code>live</code> parameter.
133      * @param container The VersionContainer to use
134      * @param type The type assigned to newly created versions
135      * @param live Whether to return the live version
136      */

137     public ComponentVersion getOrCreateVersion(
138             VersionContainer container, String JavaDoc type, boolean live);
139
140     /**
141      * Inserts a container into a list.
142      */

143     public VersionContainer insertContainer(ComponentList componentList,
144             String JavaDoc type, Map JavaDoc properties, int position, boolean live);
145
146     /**
147      * Creates copys of all ComponentLists under the given path and sets
148      * their path to the specified <code>newPath</code>.
149      */

150     public void copyComponentLists(String JavaDoc type, String JavaDoc oldPath, String JavaDoc newPath);
151
152     /**
153      * Publishes all changes made to the given list.
154      */

155     public boolean publishList(ComponentList componentList);
156
157     /**
158      * Published all changes made to the given container.
159      */

160     public boolean publishContainer(VersionContainer container);
161
162     /**
163      * Discards all changes made to the given list.
164      */

165     public boolean discardList(ComponentList componentList);
166
167     /**
168      * Discards all changes made to the given container.
169      */

170     public boolean discardContainer(VersionContainer container);
171
172 }
173
Popular Tags