org.davesag.generica.peer
Class TextPeer

java.lang.Object
  extended byorg.davesag.generica.peer.TextPeer

public class TextPeer
extends Object

This peer manipulates AbstractText s using hibernate.

Since:
Generica 1.0
Version:
CVS Revision $Id: TextPeer.java,v 1.13 2004/03/30 13:00:41 davesag Exp $
Author:
Dave Sag http://www.davesag.com

Constructor Summary
TextPeer()
           
 
Method Summary
static void delete(Session sess, AbstractText text)
          Delete this text.
static List loadAll(Session sess, Locale loc, String classname)
          loads all the texts with the given optional Locale and of the given optional classname and orders by lastModified date.
static List loadAll(Session sess, User author, Locale loc, String classname)
          Loads all the texts by the given author, optionally using the locale and classname as qualifiers.
static Long save(Session sess, AbstractText text)
          Sets the last modified date and saves this text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextPeer

public TextPeer()
Method Detail

save

public static Long save(Session sess,
                        AbstractText text)
Sets the last modified date and saves this text.

Parameters:
sess - The Session to use to save the text. The session will be flushed but not closed.
text - The text.
Returns:
The ID of the saved user, or null if there was an error.

delete

public static void delete(Session sess,
                          AbstractText text)
Delete this text.

Parameters:
sess - The Session to use to delete the text. The session will be flushed but not closed.
text - The text.

loadAll

public static List loadAll(Session sess,
                           Locale loc,
                           String classname)
loads all the texts with the given optional Locale and of the given optional classname and orders by lastModified date.

Parameters:
sess - the hibernate session.
loc - the locale.
classname - the name of the class to load.
Returns:
a list of loaded objects.

loadAll

public static List loadAll(Session sess,
                           User author,
                           Locale loc,
                           String classname)
Loads all the texts by the given author, optionally using the locale and classname as qualifiers.

Parameters:
sess - The Hiberante Session.
author - The User who wrote the text.
loc - The Locale we are interested in, or null if we don't care about language.
classname - The specific class of text we are concernet with, or null if we want all Texts.
Returns:
A List of all the texts or an empty list, never null.
Throws:
RuntimeException - if the params are invalid.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.