KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > roller > model > WeblogManager


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. The ASF licenses this file to You
4  * under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License. For additional information regarding
15  * copyright in this work, please see the NOTICE file in the top level
16  * directory of this distribution.
17  */

18
19 package org.apache.roller.model;
20
21 import java.util.Date JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24 import org.apache.roller.RollerException;
25 import org.apache.roller.pojos.Assoc;
26 import org.apache.roller.pojos.CommentData;
27 import org.apache.roller.pojos.UserData;
28 import org.apache.roller.pojos.WeblogCategoryData;
29 import org.apache.roller.pojos.WeblogEntryData;
30 import org.apache.roller.pojos.WebsiteData;
31
32
33 /**
34  * Interface to weblog entry, category and comment management.
35  */

36 public interface WeblogManager {
37     
38     public static final String JavaDoc CATEGORY_ATT = "category.att";
39        
40     /**
41      * Save weblog entry.
42      */

43     public void saveWeblogEntry(WeblogEntryData entry) throws RollerException;
44        
45     /**
46      * Remove weblog entry.
47      */

48     public void removeWeblogEntry(WeblogEntryData entry) throws RollerException;
49     
50     /**
51      * Get weblog entry by id.
52      */

53     public WeblogEntryData getWeblogEntry(String JavaDoc id) throws RollerException;
54     
55     /**
56      * Get weblog entry by anchor.
57      */

58     public WeblogEntryData getWeblogEntryByAnchor(WebsiteData website, String JavaDoc anchor)
59             throws RollerException;
60         
61     /**
62      * Get WeblogEntries by offset/length as list in reverse chronological order.
63      * The range offset and list arguments enable paging through query results.
64      * @param website Weblog or null to get for all weblogs.
65      * @param user User or null to get for all users.
66      * @param startDate Start date or null for no start date.
67      * @param endDate End date or null for no end date.
68      * @param catName Category path or null for all categories.
69      * @param status Status of DRAFT, PENDING, PUBLISHED or null for all
70      * @param sortBy Sort by either 'pubTime' or 'updateTime' (null for pubTime)
71      * @param offset Offset into results for paging
72      * @param length Max comments to return (or -1 for no limit)
73      * @return List of WeblogEntryData objects in reverse chrono order.
74      * @throws RollerException
75      */

76     public List JavaDoc getWeblogEntries(
77             WebsiteData website,
78             UserData user,
79             Date JavaDoc startDate,
80             Date JavaDoc endDate,
81             String JavaDoc catName,
82             String JavaDoc status,
83             String JavaDoc sortBy,
84             String JavaDoc locale,
85             int offset,
86             int range)
87             throws RollerException;
88        
89     /**
90      * Get Weblog Entries grouped by day. This method returns a Map that
91      * contains Lists, each List contains WeblogEntryData objects, and the
92      * Lists are keyed by Date objects.
93      * @param website Weblog or null to get for all weblogs.
94      * @param startDate Start date or null for no start date.
95      * @param endDate End date or null for no end date.
96      * @param catName Category path or null for all categories.
97      * @param status Status of DRAFT, PENDING, PUBLISHED or null for all
98      * @param offset Offset into results for paging
99      * @param length Max comments to return (or -1 for no limit)
100      * @return Map of Lists, keyed by Date, and containing WeblogEntryData.
101      * @throws RollerException
102      */

103     public Map JavaDoc getWeblogEntryObjectMap(
104             WebsiteData website,
105             Date JavaDoc startDate,
106             Date JavaDoc endDate,
107             String JavaDoc catName,
108             String JavaDoc status,
109             String JavaDoc locale,
110             int offset,
111             int range)
112             throws RollerException;
113         
114     /**
115      * Get Weblog Entry date strings grouped by day. This method returns a Map
116      * that contains Lists, each List contains YYYYMMDD date strings objects,
117      * and the Lists are keyed by Date objects.
118      * @param website Weblog or null to get for all weblogs.
119      * @param startDate Start date or null for no start date.
120      * @param endDate End date or null for no end date.
121      * @param catName Category path or null for all categories.
122      * @param status Status of DRAFT, PENDING, PUBLISHED or null for all
123      * @param offset Offset into results for paging
124      * @param length Max comments to return (or -1 for no limit)
125      * @return Map of Lists, keyed by Date, and containing date strings.
126      * @throws RollerException
127      */

128     public Map JavaDoc getWeblogEntryStringMap(
129             WebsiteData website,
130             Date JavaDoc startDate,
131             Date JavaDoc endDate,
132             String JavaDoc catName,
133             String JavaDoc status,
134             String JavaDoc locale,
135             int offset,
136             int range)
137             throws RollerException;
138     
139     /**
140      * Get weblog entries with given category or, optionally, any sub-category
141      * of that category.
142      * @param cat Category
143      * @param subcats True if sub-categories are to be fetched
144      * @return List of weblog entries in category
145      */

146     public List JavaDoc getWeblogEntries(WeblogCategoryData cat, boolean subcats)
147             throws RollerException;
148     
149     /**
150      * Get weblog enties ordered by descending number of comments.
151      * @param website Weblog or null to get for all weblogs.
152      * @param startDate Start date or null for no start date.
153      * @param endDate End date or null for no end date.
154      * @param offset Offset into results for paging
155      * @param length Max comments to return (or -1 for no limit)
156      * @returns List of WeblogEntryData objects.
157      */

158     public List JavaDoc getMostCommentedWeblogEntries(
159             WebsiteData website,
160             Date JavaDoc startDate,
161             Date JavaDoc endDate,
162             int offset,
163             int length)
164             throws RollerException;
165     
166     /**
167      * Get the WeblogEntry following, chronologically, the current entry.
168      * Restrict by the Category, if named.
169      * @param current The "current" WeblogEntryData
170      * @param catName The value of the requested Category Name
171      */

172     public WeblogEntryData getNextEntry(WeblogEntryData current,
173             String JavaDoc catName, String JavaDoc locale) throws RollerException;
174     
175     /**
176      * Get the WeblogEntry prior to, chronologically, the current entry.
177      * Restrict by the Category, if named.
178      * @param current The "current" WeblogEntryData.
179      * @param catName The value of the requested Category Name.
180      */

181     public WeblogEntryData getPreviousEntry(WeblogEntryData current,
182             String JavaDoc catName, String JavaDoc locale) throws RollerException;
183         
184     /**
185      * Get entries next after current entry.
186      * @param entry Current entry.
187      * @param catName Only return entries in this category (if not null).
188      * @param maxEntries Maximum number of entries to return.
189      */

190     public List JavaDoc getNextEntries(WeblogEntryData entry,
191             String JavaDoc catName, String JavaDoc locale, int maxEntries) throws RollerException;
192         
193     /**
194      * Get entries previous to current entry.
195      * @param entry Current entry.
196      * @param catName Only return entries in this category (if not null).
197      * @param maxEntries Maximum number of entries to return.
198      */

199     public List JavaDoc getPreviousEntries(WeblogEntryData entry,
200             String JavaDoc catName, String JavaDoc locale, int maxEntries) throws RollerException;
201     
202     /**
203      * Get specified number of most recent pinned and published Weblog Entries.
204      * @param max Maximum number to return.
205      * @return Collection of WeblogEntryData objects.
206      */

207     public List JavaDoc getWeblogEntriesPinnedToMain(Integer JavaDoc max) throws RollerException;
208     
209     /** Get time of last update for a weblog specified by username */
210     public Date JavaDoc getWeblogLastPublishTime(WebsiteData website) throws RollerException;
211     
212     /**
213      * Gets returns most recent pubTime, optionally restricted by category.
214      * @param handle Handle of website or null for all users
215      * @param catName Category name of posts or null for all categories
216      * @return Date Of last publish time
217      */

218     public Date JavaDoc getWeblogLastPublishTime(WebsiteData website, String JavaDoc catName )
219             throws RollerException;
220     
221     /**
222      * Save weblog category.
223      */

224     public void saveWeblogCategory(WeblogCategoryData cat) throws RollerException;
225     
226     /**
227      * Remove weblog category.
228      */

229     public void removeWeblogCategory(WeblogCategoryData cat) throws RollerException;
230         
231     /**
232      * Get category by id.
233      */

234     public WeblogCategoryData getWeblogCategory(String JavaDoc id) throws RollerException;
235     
236     /**
237      * Recategorize all entries with one category to another.
238      */

239     public void moveWeblogCategoryContents(WeblogCategoryData srcCat, WeblogCategoryData destCat)
240             throws RollerException;
241     
242     /**
243      * Get top level categories for a website.
244      * @param website Website.
245      */

246     public WeblogCategoryData getRootWeblogCategory(WebsiteData website) throws RollerException;
247     
248     
249     /**
250      * Get category specified by website and categoryPath.
251      * @param website Website of WeblogCategory.
252      * @param categoryPath Path of WeblogCategory, relative to category root.
253      */

254     public WeblogCategoryData getWeblogCategoryByPath(WebsiteData website,
255             String JavaDoc categoryPath) throws RollerException;
256     
257     /**
258      * Get sub-category by path relative to specified category.
259      * @param category Root of path or null to start at top of category tree.
260      * @param path Path of category to be located.
261      * @param website Website of categories.
262      * @return Category specified by path or null if not found.
263      */

264     public WeblogCategoryData getWeblogCategoryByPath(WebsiteData wd,
265             WeblogCategoryData category, String JavaDoc string) throws RollerException;
266     
267     /**
268      * Get WebLogCategory objects for a website.
269      */

270     public List JavaDoc getWeblogCategories(WebsiteData website) throws RollerException;
271     
272     /**
273      * Get WebLogCategory objects for a website.
274      */

275     public List JavaDoc getWeblogCategories(WebsiteData website, boolean includeRoot)
276             throws RollerException;
277         
278     /**
279      * Get absolute path to category, appropriate for use by getWeblogCategoryByPath().
280      * @param category WeblogCategoryData.
281      * @return Forward slash separated path string.
282      */

283     public String JavaDoc getPath(WeblogCategoryData category) throws RollerException;
284     
285     /**
286      * Get parent association for a category.
287      */

288     public Assoc getWeblogCategoryParentAssoc(WeblogCategoryData data) throws RollerException;
289     
290     /**
291      * Get child associations for a category.
292      */

293     public List JavaDoc getWeblogCategoryChildAssocs(WeblogCategoryData data) throws RollerException;
294     
295     /**
296      * Get all descendent associations for a category.
297      */

298     public List JavaDoc getAllWeblogCategoryDecscendentAssocs(WeblogCategoryData data) throws RollerException;
299     
300     /**
301      * Get all ancestor associates for a category.
302      */

303     public List JavaDoc getWeblogCategoryAncestorAssocs(WeblogCategoryData data) throws RollerException;
304     
305     /**
306      * Save comment.
307      */

308     public void saveComment(CommentData comment) throws RollerException;
309     
310     /**
311      * Remove comment.
312      */

313     public void removeComment(CommentData comment) throws RollerException;
314    
315     /**
316      * Get comment by id.
317      */

318     public CommentData getComment(String JavaDoc id) throws RollerException;
319        
320     /**
321      * Generic comments query method.
322      * @param website Website or null for all comments on site
323      * @param entry Entry or null to include all comments
324      * @param startDate Start date or null for no restriction
325      * @param endDate End date or null for no restriction
326      * @param pending Pending flag value or null for no restriction
327      * @param pending Approved flag value or null for no restriction
328      * @param reverseChrono True for results in reverse chrono order
329      * @param spam Spam flag value or null for no restriction
330      * @param offset Offset into results for paging
331      * @param length Max comments to return (or -1 for no limit)
332      */

333     public List JavaDoc getComments(
334             WebsiteData website,
335             WeblogEntryData entry,
336             String JavaDoc searchString,
337             Date JavaDoc startDate,
338             Date JavaDoc endDate,
339             Boolean JavaDoc pending,
340             Boolean JavaDoc approved,
341             Boolean JavaDoc spam,
342             boolean reverseChrono,
343             int offset,
344             int length
345             ) throws RollerException;
346         
347     /**
348      * Create unique anchor for weblog entry.
349      */

350     public String JavaDoc createAnchor(WeblogEntryData data) throws RollerException;
351     
352     /**
353      * Check for duplicate category name.
354      */

355     public boolean isDuplicateWeblogCategoryName(WeblogCategoryData data)
356             throws RollerException;
357     
358     /**
359      * Check if weblog category is in use.
360      */

361     public boolean isWeblogCategoryInUse(WeblogCategoryData data)
362             throws RollerException;
363     
364     /**
365      * Returns true if ancestor is truly an ancestor of child.
366      */

367     public boolean isDescendentOf(WeblogCategoryData child,
368             WeblogCategoryData ancestor) throws RollerException;
369     
370     /**
371      * Apply comment default settings from website to all of website's entries.
372      */

373     public void applyCommentDefaultsToEntries(WebsiteData website)
374         throws RollerException;
375     
376     /**
377      * Release all resources held by manager.
378      */

379     public void release();
380 }
381
Popular Tags