FileDocCategorySizeDatePackage
LoadComment.javaAPI DocExample1908Mon Mar 31 23:08:52 BST 2003org.dasein.gb.persist

LoadComment

public class LoadComment extends org.dasein.persist.Execution

Fields Summary
private static final String
LOAD
private static final int
COMMENT_ID
private static final int
APPROVED
private static final int
EMAIL
private static final int
NAME
private static final int
COMMENT
private static final int
CREATED
Constructors Summary
Methods Summary
public java.lang.StringgetDataSource()

        return "jdbc/kyra";
    
public static org.dasein.gb.persist.LoadCommentgetInstance()

        return (LoadComment)Execution.getInstance(LoadComment.class);
    
public java.lang.StringgetStatement()

        return LOAD;
    
public java.util.HashMaprun()

    
          
        long id = ((Long)data.get(Comment.COMMENT_ID)).longValue();
        HashMap res = new HashMap();
        String tmp;
        
        statement.setLong(COMMENT_ID, id);
        results = statement.executeQuery();
        if( !results.next() ) {
            throw new PersistenceException("No such comment: " + id);
        }
        tmp = results.getString(APPROVED);
        res.put(Comment.APPROVED,
                new Boolean(tmp.trim().equalsIgnoreCase("Y")));
        tmp = results.getString(EMAIL);
        if( results.wasNull() ) {
            res.put(Comment.EMAIL, null);
        }
        else {
            res.put(Comment.EMAIL, tmp.trim());
        }
        res.put(Comment.NAME, results.getString(NAME));
        res.put(Comment.COMMENT, results.getString(COMMENT));
        res.put(Comment.CREATED, results.getDate(CREATED));
        return res;