KickJava   Java API By Example, From Geeks To Geeks.

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


1
2 package org.roller.model;
3 import org.roller.RollerException;
4 import org.roller.pojos.Assoc;
5 import org.roller.pojos.CommentData;
6 import org.roller.pojos.WeblogCategoryAssoc;
7 import org.roller.pojos.WeblogCategoryData;
8 import org.roller.pojos.WeblogEntryData;
9 import org.roller.pojos.WebsiteData;
10 import org.roller.pojos.UserData;
11
12 import java.io.Serializable JavaDoc;
13 import java.util.Date JavaDoc;
14 import java.util.List JavaDoc;
15 import java.util.Map JavaDoc;
16
17
18 /**
19  * Interface to Weblog Management.
20  */

21 public interface WeblogManager extends Serializable JavaDoc
22 {
23     public static final String JavaDoc CATEGORY_ATT = "category.att";
24     
25     public static final String JavaDoc ALL = "ALL";
26     public static final String JavaDoc DRAFT_ONLY = "DRAFT_ONLY";
27     public static final String JavaDoc PUB_ONLY = "PUB_ONLY";
28     
29     /**
30      * Release all resources associated with Roller session.
31      */

32     public void release();
33
34     //------------------------------------------------ WeblogCategoryData CRUD
35

36     /** Create new weblog category, NOT a persistent instance. */
37     public WeblogCategoryData createWeblogCategory();
38
39     /** Create new weblog category, NOT a persistent instance. */
40     public WeblogCategoryData createWeblogCategory(
41         WebsiteData website,
42         WeblogCategoryData parent,
43         String JavaDoc name,
44         String JavaDoc description,
45         String JavaDoc image) throws RollerException;
46
47     /**
48      * Get category by ID
49      */

50     public WeblogCategoryData retrieveWeblogCategory(String JavaDoc id)
51         throws RollerException;
52
53     /**
54      * Recategorize all entries with one category to another.
55      * @param srcId
56      * @param destId
57      * @throws org.roller.RollerException
58      */

59     public void moveWeblogCategoryContents(String JavaDoc srcId, String JavaDoc destId)
60         throws RollerException;
61
62     //--------------------------------------------- WeblogCategoryData Queries
63

64     /** Get WebLogCategory objects for a website. */
65     public List JavaDoc getWeblogCategories(WebsiteData website)
66         throws RollerException;
67
68     /** Get WebLogCategory objects for a website. */
69     public List JavaDoc getWeblogCategories(WebsiteData website, boolean includeRoot)
70         throws RollerException;
71
72     /**
73      * Get top level categories for a website.
74      * @param website Website.
75      */

76     public WeblogCategoryData getRootWeblogCategory(WebsiteData website)
77         throws RollerException;
78
79     /**
80      * Get absolute path to category, appropriate for use by getWeblogCategoryByPath().
81      * @param category WeblogCategoryData.
82      * @return Forward slash separated path string.
83      */

84     public String JavaDoc getPath(WeblogCategoryData category) throws RollerException;
85
86     /**
87      * Get category specified by website and categoryPath.
88      * @param website Website of WeblogCategory.
89      * @param categoryPath Path of WeblogCategory, relative to category root.
90      */

91    public WeblogCategoryData getWeblogCategoryByPath(
92        WebsiteData website, String JavaDoc categoryPath)
93        throws RollerException;
94
95     /**
96      * Get sub-category by path relative to specified category.
97      * @param category Root of path or null to start at top of category tree.
98      * @param path Path of category to be located.
99      * @param website Website of categories.
100      * @return Category specified by path or null if not found.
101      */

102     public WeblogCategoryData getWeblogCategoryByPath(
103         WebsiteData wd, WeblogCategoryData category, String JavaDoc string)
104         throws RollerException;
105
106     //----------------------------------------------- WeblogCategoryAssoc CRUD
107

108     /** Create new weblog category assoc, NOT a persistent instance. */
109     public WeblogCategoryAssoc createWeblogCategoryAssoc();
110
111     /** Create new weblog category assoc, NOT a persistent instance. */
112     public WeblogCategoryAssoc createWeblogCategoryAssoc(
113         WeblogCategoryData category,
114         WeblogCategoryData ancestor,
115         String JavaDoc relation) throws RollerException;
116
117     /**
118      * Get category assoc. by ID
119      */

120     public WeblogCategoryAssoc retrieveWeblogCategoryAssoc(String JavaDoc id)
121         throws RollerException;
122
123     //------------------------------------------------------- CommentData CRUD
124

125     /**
126      * Get comment by ID
127      */

128     public CommentData retrieveComment(String JavaDoc id)
129         throws RollerException;
130
131     /**
132      * Get comments by entry ID
133      * @param entryId
134      * @throws org.roller.RollerException
135      * @return
136      */

137     public abstract List JavaDoc getComments( String JavaDoc entryId )
138         throws RollerException;
139
140     /**
141      * Get comments by entry ID, optionally excluding spam
142      * @param entryId
143      * @param nospam
144      * @throws org.roller.RollerException
145      * @return
146      */

147     public abstract List JavaDoc getComments( String JavaDoc entryId, boolean nospam )
148         throws RollerException;
149
150     /**
151      * Remove comment by ID
152      */

153     public void removeComment( String JavaDoc id )
154         throws RollerException;
155
156     /**
157      * Remove comments specified by array of IDs
158      * @param ids
159      * @throws org.roller.RollerException
160      */

161     public void removeComments( String JavaDoc[] ids )
162         throws RollerException;
163
164     /**
165      * Remove all comments of entry specified by ID
166      */

167     public void removeCommentsForEntry(String JavaDoc entryId)
168         throws RollerException;
169     
170     /**
171      * Get most recent X comments in website.
172      */

173     public List JavaDoc getRecentComments(WebsiteData website, int maxCount)
174         throws RollerException;
175
176     //------------------------------------------------------- WeblogEntry CRUD
177

178     /**
179      * Get weblog entry by ID
180      */

181     public WeblogEntryData retrieveWeblogEntry(String JavaDoc id)
182         throws RollerException;
183
184     /**
185      * Remove weblog entry by ID
186      */

187     public void removeWeblogEntry( String JavaDoc id )
188         throws RollerException;
189
190     //------------------------------------------------ WeblogEntryData Queries
191

192     /**
193      * Get WeblogEntries as a list in reverse chronological order.
194      *
195      * @param userName User name or null to get for all users.
196      * @param startDate Start date or null for no start date.
197      * @param endDate End date or null for no end date.
198      * @param catName Category path or null for all categories.
199      * @param status Status of ALL, DRAFT_ONLY, or PUB_ONLY.
200      * @param maxEntries Max entries or null for no limit.
201      * @return List of WeblogEntryData objects in reverse chrono order.
202      * @throws RollerException
203      */

204     public List JavaDoc getWeblogEntries(
205                     WebsiteData website,
206                     Date JavaDoc startDate,
207                     Date JavaDoc endDate,
208                     String JavaDoc catName,
209                     String JavaDoc status,
210                     Integer JavaDoc maxEntries)
211                     throws RollerException;
212     
213     /**
214      * Get WeblogEntries in range as list in reverse chronological order.
215      * The range offset and list arguments enable paging through query results.
216      *
217      * @param userName User name or null to get for all users.
218      * @param startDate Start date or null for no start date.
219      * @param endDate End date or null for no end date.
220      * @param catName Category path or null for all categories.
221      * @param status Status of ALL, DRAFT_ONLY, or PUB_ONLY.
222      * @param offset Index of first entry to include.
223      * @param length Max number of entries to include.
224      * @return List of WeblogEntryData objects in reverse chrono order.
225      * @throws RollerException
226      */

227     public List JavaDoc getWeblogEntries(
228                     WebsiteData website,
229                     Date JavaDoc startDate,
230                     Date JavaDoc endDate,
231                     String JavaDoc catName,
232                     String JavaDoc status,
233                     int offset,
234                     int length)
235                     throws RollerException;
236     
237     /**
238      * Get Weblog Entries grouped by day. This method returns a Map that
239      * contains Lists, each List contains WeblogEntryData objects, and the
240      * Lists are keyed by Date objects.
241      *
242      * @param userName User name or null to get for all users.
243      * @param startDate Start date or null for no start date.
244      * @param endDate End date or null for no end date.
245      * @param catName Category path or null for all categories.
246      * @param status Status of ALL, DRAFT_ONLY, or PUB_ONLY.
247      * @param maxEntries Max entries or null for no limit.
248      * @return Map of Lists, keyed by Date, and containing WeblogEntryData.
249      * @throws RollerException
250      */

251     public Map JavaDoc getWeblogEntryObjectMap(
252                     WebsiteData website,
253                     Date JavaDoc startDate,
254                     Date JavaDoc endDate,
255                     String JavaDoc catName,
256                     String JavaDoc status,
257                     Integer JavaDoc maxEntries)
258                     throws RollerException;
259
260     /**
261      * Get Weblog Entry date strings grouped by day. This method returns a Map
262      * that contains Lists, each List contains YYYYMMDD date strings objects,
263      * and the Lists are keyed by Date objects.
264      *
265      * @param userName User name or null to get for all users.
266      * @param startDate Start date or null for no start date.
267      * @param endDate End date or null for no end date.
268      * @param catName Category path or null for all categories.
269      * @param status Status of ALL, DRAFT_ONLY, or PUB_ONLY.
270      * @param maxEntries Max entries or null for no limit.
271      * @return Map of Lists, keyed by Date, and containing date strings.
272      * @throws RollerException
273      */

274     public Map JavaDoc getWeblogEntryStringMap(
275                     WebsiteData website,
276                     Date JavaDoc startDate,
277                     Date JavaDoc endDate,
278                     String JavaDoc catName,
279                     String JavaDoc status,
280                     Integer JavaDoc maxEntries)
281                     throws RollerException;
282
283     /**
284      * Get weblog entries with given category or, optionally, any sub-category
285      * of that category.
286      * @param cat Category.
287      * @param subcats True if sub-categories are to be fetched.
288      * @return List of weblog entries in category.
289      */

290     public List JavaDoc retrieveWeblogEntries(WeblogCategoryData cat, boolean subcats)
291         throws RollerException;
292
293     /**
294      * Get the WeblogEntry following, chronologically, the current entry.
295      * Restrict by the Category, if named.
296      *
297      * @param current The "current" WeblogEntryData.
298      * @param catName The value of the requested Category Name.
299      * @return
300      */

301     public WeblogEntryData getNextEntry(WeblogEntryData current, String JavaDoc catName)
302         throws RollerException;
303
304     /**
305      * Get the WeblogEntry prior to, chronologically, the current entry.
306      * Restrict by the Category, if named.
307      *
308      * @param current The "current" WeblogEntryData.
309      * @param catName The value of the requested Category Name.
310      * @return
311      */

312     public WeblogEntryData getPreviousEntry(WeblogEntryData current, String JavaDoc catName)
313         throws RollerException;
314
315     /**
316      * Get entries next after current entry.
317      * @param entry Current entry.
318      * @param catName Only return entries in this category (if not null).
319      * @param maxEntries Maximum number of entries to return.
320      */

321     public List JavaDoc getNextEntries(
322        WeblogEntryData entry, String JavaDoc catName, int maxEntries) throws RollerException;
323
324     /**
325      * Get entries previous to current entry.
326      * @param entry Current entry.
327      * @param catName Only return entries in this category (if not null).
328      * @param maxEntries Maximum number of entries to return.
329      */

330     public List JavaDoc getPreviousEntries(
331        WeblogEntryData entry, String JavaDoc catName, int maxEntries) throws RollerException;
332
333     /**
334      * Get specified number of most recent pinned and published Weblog Entries.
335      * @param max Maximum number to return.
336      * @return Collection of WeblogEntryData objects.
337      */

338     public List JavaDoc getWeblogEntriesPinnedToMain(Integer JavaDoc max)
339         throws RollerException;
340
341     /** Get weblog entry by anchor. */
342     public WeblogEntryData getWeblogEntryByAnchor(
343         WebsiteData website, String JavaDoc anchor ) throws RollerException;
344
345     /** Get time of last update for a weblog specified by username */
346     public Date JavaDoc getWeblogLastPublishTime( String JavaDoc userName )
347         throws RollerException;
348
349     /**
350      * Gets the Date of the latest Entry publish time.
351      * @param userName User name of weblog or null for all users
352      * @param catName Top-level category name of posts or null for all categories.
353      * @return Date Of last publish time
354      * @throws RollerException
355      */

356     public Date JavaDoc getWeblogLastPublishTime( String JavaDoc userName, String JavaDoc catName )
357         throws RollerException;
358
359     /**
360      * Remove WeblogEntry contents.
361      */

362     public void removeWeblogEntryContents(WeblogEntryData data)
363         throws RollerException;
364
365     /**
366      * Create unique anchor for weblog entry.
367      */

368     public String JavaDoc createAnchor(WeblogEntryData data)
369         throws RollerException;
370
371     /**
372      * Check for duplicate category name.
373      */

374     public boolean isDuplicateWeblogCategoryName(WeblogCategoryData data)
375         throws RollerException;
376
377     /**
378      * Check if weblog category is in use.
379      */

380     public boolean isWeblogCategoryInUse(WeblogCategoryData data)
381         throws RollerException;
382
383     /**
384      * Returns true if ancestor is truly an ancestor of child.
385      */

386     public boolean isDescendentOf(
387         WeblogCategoryData child, WeblogCategoryData ancestor) throws RollerException;
388
389     /**
390      */

391     public Assoc getWeblogCategoryParentAssoc(WeblogCategoryData data) throws RollerException;
392
393     /**
394      */

395     public List JavaDoc getWeblogCategoryChildAssocs(WeblogCategoryData data) throws RollerException;
396
397     /**
398      */

399     public List JavaDoc getAllWeblogCategoryDecscendentAssocs(WeblogCategoryData data) throws RollerException;
400
401     /**
402      */

403     public List JavaDoc getWeblogCategoryAncestorAssocs(WeblogCategoryData data) throws RollerException;
404
405     /**
406      * Get the url of a user's weblog.
407      * @param user the user
408      * @param contextUrl the context url, this is prepended and can be absolute or relative depending on what is desired.
409      * @return the url of the user's weblog
410      * @throws RollerException
411      */

412     public String JavaDoc getUrl(UserData user, String JavaDoc contextUrl) throws RollerException;
413 }
414
Popular Tags