org.varienaja.comments
Class CommentDAO

java.lang.Object
  extended by org.varienaja.comments.CommentDAO

public final class CommentDAO
extends java.lang.Object

Class that persists and reads Reviews from persistent storage.

Author:
Varienaja

Field Summary
protected static java.lang.String DATEPATTERN
           
protected static java.lang.String REVIEW
           
protected static java.lang.String REVIEWELEMENT
           
protected static java.lang.String REVIEWELEMENTS
           
protected static java.lang.String REVIEWS
           
 
Constructor Summary
CommentDAO()
           
 
Method Summary
static java.util.Set<Comment> getCommentsFromCache(java.lang.String fileprefix, long id)
          Loads Reviews of an item from the disk.
static boolean saveCommentsToCache(java.lang.String fileprefix, long id, java.util.Set<Comment> comments)
          Stores the reviews of an item on disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVIEWS

protected static final java.lang.String REVIEWS
See Also:
Constant Field Values

REVIEW

protected static final java.lang.String REVIEW
See Also:
Constant Field Values

REVIEWELEMENTS

protected static final java.lang.String REVIEWELEMENTS
See Also:
Constant Field Values

REVIEWELEMENT

protected static final java.lang.String REVIEWELEMENT
See Also:
Constant Field Values

DATEPATTERN

protected static final java.lang.String DATEPATTERN
See Also:
Constant Field Values
Constructor Detail

CommentDAO

public CommentDAO()
Method Detail

saveCommentsToCache

public static boolean saveCommentsToCache(java.lang.String fileprefix,
                                          long id,
                                          java.util.Set<Comment> comments)
Stores the reviews of an item on disk.

Parameters:
fileprefix - The prefix to use for the file on local storage.
id - The id to add to the fileprefix.
comments - The Reviews to store.
Returns:
Whether the operation succeeded or not.

getCommentsFromCache

public static java.util.Set<Comment> getCommentsFromCache(java.lang.String fileprefix,
                                                          long id)
Loads Reviews of an item from the disk. Returns null if there were no cached Reviews of this item.

Parameters:
fileprefix - The prefix to use for the file on local storage.
Returns:
A List of Reviews. Returns null if the review storage directory does not exist.


Copyright © 2010 A.J.V.. All Rights Reserved.