FileDocCategorySizeDatePackage
Comment.javaAPI DocExample3882Mon Sep 09 12:47:48 BST 2002org.dasein.gb

Comment

public class Comment extends Object

Fields Summary
private static final org.dasein.util.Cache
cache
public static final String
APPROVED
public static final String
COMMENT
public static final String
COMMENT_ID
public static final String
CREATED
public static final String
EMAIL
public static final String
NAME
private Boolean
approved
private String
comment
private Long
commentID
private Date
created
private String
email
private String
name
Constructors Summary
private Comment(Long cid, HashMap data)


         
        super();
        commentID = cid;
        load(data);
    
Methods Summary
public static org.dasein.gb.Commentcreate(java.util.HashMap data)

    
            
        Sequencer seq = Sequencer.getInstance(Comment.COMMENT_ID);
        Comment cmt;
        Long id;

        id = new Long(seq.next());
        data.put(Comment.COMMENT_ID, id);
        CommentDAO.create(data);
        cmt = new Comment(id, data);
        synchronized( cache ) {
            cache.cache(id, cmt);
        }
        return cmt;
    
public static java.util.ArrayListgetApproved()

        Iterator results = CommentDAO.getApproved().iterator();
        ArrayList cmts = new ArrayList();
        
        while( results.hasNext() ) {
            Long id = (Long)results.next();
            
            cmts.add(Comment.getComment(id.longValue()));
        }
        return cmts;
    
public static org.dasein.gb.CommentgetComment(long cid)

        Long id = new Long(cid);
        
        synchronized( cache ) {
            Comment cmt = (Comment)cache.get(id);

            if( cmt == null ) {
                HashMap data = CommentDAO.getComment(cid);

                data.put(Comment.COMMENT_ID, id);
                cmt = new Comment(id, data);
                cache.cache(id, cmt);
            }
            return cmt;
        }
    
public java.lang.StringgetComment()

        return comment;
    
public longgetCommentID()

        return commentID.longValue();
    
public java.util.DategetCreated()

        return created;
    
public java.lang.StringgetEmail()

        return email;
    
public java.lang.StringgetName()

        return name;
    
public static java.util.ArrayListgetPending()

        Iterator results = CommentDAO.getPending().iterator();
        ArrayList cmts = new ArrayList();
        
        while( results.hasNext() ) {
            Long id = (Long)results.next();
            
            cmts.add(Comment.getComment(id.longValue()));
        }
        return cmts;
    
public booleanisApproved()

        return approved.booleanValue();
    
private voidload(java.util.HashMap data)

        approved = (Boolean)data.get(Comment.APPROVED);
        comment = (String)data.get(Comment.COMMENT);
        commentID = (Long)data.get(Comment.COMMENT_ID);
        created = (Date)data.get(Comment.CREATED);
        email = (String)data.get(Comment.EMAIL);
        name = (String)data.get(Comment.NAME);
    
public voidremove()

        HashMap data = new HashMap();

        data.put(Comment.COMMENT_ID, commentID);
        CommentDAO.remove(data);
        synchronized( cache ) {
            cache.release(commentID);
        }
    
public voidsave(java.util.HashMap data)

        CommentDAO.save(data);
        load(data);