001: /**
002: * Copyright (c) 2003-2007, David A. Czarnecki
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions are met:
007: *
008: * Redistributions of source code must retain the above copyright notice, this list of conditions and the
009: * following disclaimer.
010: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
011: * following disclaimer in the documentation and/or other materials provided with the distribution.
012: * Neither the name of "David A. Czarnecki" and "blojsom" nor the names of its contributors may be used to
013: * endorse or promote products derived from this software without specific prior written permission.
014: * Products derived from this software may not be called "blojsom", nor may "blojsom" appear in their name,
015: * without prior written permission of David A. Czarnecki.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
018: * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
019: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020: * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
021: * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
022: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
025: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
026: * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
027: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
028: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
029: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030: */package org.blojsom.blog;
031:
032: import java.util.Date;
033: import java.util.List;
034: import java.util.Locale;
035: import java.util.Map;
036:
037: /**
038: * Entry
039: *
040: * @author David Czarnecki
041: * @since blojsom 3.0
042: * @version $Id: Entry.java,v 1.7 2007/01/17 02:35:16 czarneckid Exp $
043: */
044: public interface Entry {
045:
046: /**
047: * Get the entry ID
048: *
049: * @return Entry ID
050: */
051: Integer getId();
052:
053: /**
054: * Set the entry ID
055: *
056: * @param id Entry ID
057: */
058: void setId(Integer id);
059:
060: /**
061: * Get the blog ID
062: *
063: * @return Blog ID
064: */
065: Integer getBlogId();
066:
067: /**
068: * Set the blog ID
069: *
070: * @param blogId Blog ID
071: */
072: void setBlogId(Integer blogId);
073:
074: /**
075: * Get the blog category ID
076: *
077: * @return Blog category ID
078: */
079: public Integer getBlogCategoryId();
080:
081: /**
082: * Set the blog category ID
083: *
084: * @param blogCategoryId Blog category ID
085: */
086: public void setBlogCategoryId(Integer blogCategoryId);
087:
088: /**
089: * Date of the blog entry
090: * <p/>
091: * This value is constructed from the lastModified value of the file
092: *
093: * @return Date of the blog entry
094: */
095: Date getDate();
096:
097: /**
098: * Date of this blog entry
099: *
100: * @param entryDate Date of the blog entry
101: */
102: void setDate(Date entryDate);
103:
104: /**
105: * Return an RFC 822 style date
106: *
107: * @return Date formatted in RFC 822 format
108: */
109: String getRFC822Date();
110:
111: /**
112: * Return an UTC style date
113: *
114: * @return Date formatted in UTC format
115: */
116: String getUTCDate();
117:
118: /**
119: * Return an ISO 8601 style date
120: * http://www.w3.org/TR/NOTE-datetime
121: *
122: * @return Date formatted in ISO 8601 format
123: */
124: String getISO8601Date();
125:
126: /**
127: * Return the blog entry date formatted with a specified date format
128: *
129: * @param format Date format
130: * @return <code>null</code> if the entry date or format is null, otherwise returns the entry date formatted to the specified format. If the format is invalid, returns <tt>entryDate.toString()</tt>
131: */
132: String getDateAsFormat(String format);
133:
134: /**
135: * Return the blog entry date formatted with a specified date format
136: *
137: * @param format Date format
138: * @param locale Locale for date formatting
139: * @return <code>null</code> if the entry date or format is null, otherwise returns the entry date formatted to the specified format. If the format is invalid, returns <tt>entryDate.toString()</tt>
140: */
141: String getDateAsFormat(String format, Locale locale);
142:
143: /**
144: * Title of the blog entry
145: *
146: * @return Blog title
147: */
148: String getTitle();
149:
150: /**
151: * Set the title of the blog entry
152: *
153: * @param title Title for the blog entry
154: */
155: void setTitle(String title);
156:
157: /**
158: * Title for the entry where the <, >, and & characters are escaped
159: *
160: * @return Escaped entry title
161: */
162: String getEscapedTitle();
163:
164: /**
165: * Description of the blog entry
166: *
167: * @return Blog entry description
168: */
169: String getDescription();
170:
171: /**
172: * Escaped description of the blog entry
173: * This method would be used for generating RSS feeds where the <, >, and & characters are escaped
174: *
175: * @return Blog entry description where &, <, and > have been escaped
176: */
177: String getEscapedDescription();
178:
179: /**
180: * Set the description for the blog entry
181: *
182: * @param description Description for the blog entry
183: */
184: void setDescription(String description);
185:
186: /**
187: * Category for the blog entry. This corresponds to the category directory name.
188: *
189: * @return Blog entry category
190: */
191: String getCategory();
192:
193: /**
194: * Return the category name encoded.
195: *
196: * @return Category name encoded as UTF-8
197: */
198: String getEncodedCategory();
199:
200: /**
201: * Determines whether or not this blog entry supports comments.
202: *
203: * @return <code>true</code> if the blog entry supports comments, <code>false</code> otherwise
204: */
205: Integer getAllowComments();
206:
207: /**
208: * Whether or not comments are allowed
209: *
210: * @return <code>true</code> if comments are allowed, <code>false</code> otherwise
211: */
212: Boolean allowsComments();
213:
214: /**
215: * Set whether comments are allowed
216: *
217: * @param allowComments <code>true</code> if comments are allowed, <code>false</code> otherwise
218: */
219: void setAllowComments(Integer allowComments);
220:
221: /**
222: * Get the comments
223: *
224: * @return List of comments
225: */
226: List getComments();
227:
228: /**
229: * Set the comments for this blog entry. The comments must be an <code>List</code>
230: * of {@link org.blojsom.blog.Comment}. This method will not writeback or change the comments on disk.
231: *
232: * @param comments Comments for this entry
233: */
234: void setComments(List comments);
235:
236: /**
237: * Get the comments as an array of {@link Comment} objects
238: *
239: * @return BlogComment[] array
240: */
241: Comment[] getCommentsAsArray();
242:
243: /**
244: * Get the number of comments for this entry
245: *
246: * @return 0 if comments is <code>null</code>, or the number of comments otherwise, which could be 0
247: */
248: int getNumComments();
249:
250: /**
251: * Determines whether or not this blog entry supports trackbacks.
252: *
253: * @return <code>true</code> if the blog entry supports trackbacks, <code>false</code> otherwise
254: */
255: Integer getAllowTrackbacks();
256:
257: /**
258: * Whether or not trackbacks are allowed
259: *
260: * @return <code>true</code> if trackbacks are allowed, <code>false</code> otherwise
261: */
262: Boolean allowsTrackbacks();
263:
264: /**
265: * Set whether trackbacks are allowed
266: *
267: * @param allowTrackbacks <code>true</code> if trackbacks are allowed, <code>false</code> otherwise
268: */
269: void setAllowTrackbacks(Integer allowTrackbacks);
270:
271: /**
272: * Get the trackbacks
273: *
274: * @return List of trackbacks
275: */
276: List getTrackbacks();
277:
278: /**
279: * Set the trackbacks for this blog entry. The trackbacks must be an <code>List</code>
280: * of {@link org.blojsom.blog.Trackback}. This method will not writeback or change the trackbacks to disk.
281: *
282: * @param trackbacks Trackbacks for this entry
283: */
284: void setTrackbacks(List trackbacks);
285:
286: /**
287: * Get the trackbacks as an array of Trackback objects
288: *
289: * @return Trackback[] array
290: */
291: Trackback[] getTrackbacksAsArray();
292:
293: /**
294: * Get the number of trackbacks for this entry
295: *
296: * @return 0 if trackbacks is <code>null</code>, or the number of trackbacks otherwise, which could be 0
297: */
298: int getNumTrackbacks();
299:
300: /**
301: * Get the {@link org.blojsom.blog.Category} object for this blog entry
302: *
303: * @return {@link org.blojsom.blog.Category} object
304: */
305: Category getBlogCategory();
306:
307: /**
308: * Set the {@link org.blojsom.blog.Category} object for this blog entry
309: *
310: * @param blogCategory New {@link org.blojsom.blog.Category} object
311: */
312: void setBlogCategory(Category blogCategory);
313:
314: /**
315: * Return meta data for this blog entry. This method may return <code>null</code>.
316: *
317: * @return Meta data
318: */
319: Map getMetaData();
320:
321: /**
322: * Set the meta-data associated with this blog entry
323: *
324: * @param metaData Meta-data
325: */
326: void setMetaData(Map metaData);
327:
328: /**
329: * Determines whether or not this blog entry supports pingbacks.
330: *
331: * @return <code>true</code> if the blog entry supports pingbacks, <code>false</code> otherwise
332: */
333: Integer getAllowPingbacks();
334:
335: /**
336: * Whether or not pingbacks are allowed
337: *
338: * @return <code>true</code> if pingbacks are allowed, <code>false</code> otherwise
339: */
340: Boolean allowsPingbacks();
341:
342: /**
343: * Set whether pingbacks are allowed
344: *
345: * @param allowPingbacks <code>true</code> if pingbacks are allowed, <code>false</code> otherwise
346: */
347: void setAllowPingbacks(Integer allowPingbacks);
348:
349: /**
350: * Get the pingbacks for this entry
351: *
352: * @return List of {@link org.blojsom.blog.Pingback}
353: */
354: List getPingbacks();
355:
356: /**
357: * Set the pingbacks for this blog entry. The pingbacks must be a <code>List</code>
358: * of {@link org.blojsom.blog.Pingback}. This method will not writeback or change the pingbacks to disk.
359: *
360: * @param pingbacks {@link org.blojsom.blog.Pingback}s for this entry
361: */
362: void setPingbacks(List pingbacks);
363:
364: /**
365: * Get the pingbacks as an array of {@link org.blojsom.blog.Pingback}s objects
366: *
367: * @return {@link org.blojsom.blog.Pingback}[] array
368: */
369: Pingback[] getPingbacksAsArray();
370:
371: /**
372: * Get the number of pingbacks for this entry
373: *
374: * @return 0 if pingbacks is <code>null</code>, or the number of pingbacks otherwise, which could be 0
375: */
376: int getNumPingbacks();
377:
378: /**
379: * Get the status
380: *
381: * @return Status
382: */
383: public String getStatus();
384:
385: /**
386: * Set the status
387: *
388: * @param status Status
389: */
390: public void setStatus(String status);
391:
392: /**
393: * Get the author
394: *
395: * @return Author
396: */
397: public String getAuthor();
398:
399: /**
400: * Set the author
401: *
402: * @param author Author
403: */
404: public void setAuthor(String author);
405:
406: /**
407: * Get the post slug
408: *
409: * @return Post slug
410: */
411: public String getPostSlug();
412:
413: /**
414: * Get the post slug encoded as UTF-8
415: *
416: * @return Post slug encoded as UTF-8
417: */
418: public String getEncodedPostSlug();
419:
420: /**
421: * Set the post slug
422: *
423: * @param postSlug Post slug
424: */
425: public void setPostSlug(String postSlug);
426:
427: /**
428: * Get the last modified date
429: *
430: * @return Last modified date
431: */
432: public Date getModifiedDate();
433:
434: /**
435: * Set the last modified date
436: *
437: * @param modifiedDate Last modified date
438: */
439: public void setModifiedDate(Date modifiedDate);
440:
441: /**
442: * Get the responses (comments, trackbacks, pingbacks)
443: *
444: * @return Responses (comments, trackbacks, pingbacks)
445: */
446: public List getResponses();
447:
448: /**
449: * Get the responses (comments, trackbacks, pingbacks) matching some status code
450: *
451: * @param status Status code
452: * @return Responses (comments, trackbacks, pingbacks) matching some status code
453: */
454: public List getResponsesMatchingStatus(String status);
455:
456: /**
457: * Get the responses (comments, trackbacks, pingbacks) not matching some status code
458: *
459: * @param status Status code
460: * @return Responses (comments, trackbacks, pingbacks) not matching some status code
461: */
462: public List getResponsesNotMatchingStatus(String status);
463: }
|