org.davesag.generica.peer
Class FaqPersistencePeer

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

public class FaqPersistencePeer
extends Object

This peer manipulates Faq s using the persistance manager's Archivist.

Since:
Generica 1.0
Version:
CVS Revision $Id: FaqPersistencePeer.java,v 1.3 2004/04/06 15:33:23 davesag Exp $
Author:
Dave Sag http://www.davesag.com

Constructor Summary
FaqPersistencePeer()
           
 
Method Summary
static boolean asked(Archivist archivist, String question, Locale loc)
          Has this question already been asked in this Locale?
static void delete(Archivist archivist, Faq faq)
          Delete this faq.
static List loadAll(Archivist archivist, Locale loc)
          Loads all the Faqs with the given optional Locale.
static Faq save(Archivist archivist, Faq faq)
          Sets the last modified date and saves this Faq.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FaqPersistencePeer

public FaqPersistencePeer()
Method Detail

save

public static Faq save(Archivist archivist,
                       Faq faq)
Sets the last modified date and saves this Faq.

Parameters:
archivist - The Archivist to use to save the Faq. The session will be flushed but not closed.
faq - The faq.
Returns:
The ID of the saved Faq, or null if there was an error.

delete

public static void delete(Archivist archivist,
                          Faq faq)
Delete this faq.

Parameters:
archivist - The Archivist to use to delete the Faq. The session will be flushed but not closed.
faq - The faq.

asked

public static boolean asked(Archivist archivist,
                            String question,
                            Locale loc)
Has this question already been asked in this Locale?

Parameters:
archivist - The Archivist to use to delete the faq. The session will be flushed but not closed.
question - The question.
loc - The Locale.
Returns:
true if there is a Faq with the supplied question and in the supplied Locale's language.
Throws:
RuntimeException - if the params were invalid, or if an internal exception was encountered.

loadAll

public static List loadAll(Archivist archivist,
                           Locale loc)
Loads all the Faqs with the given optional Locale. Orders by lastModified date.

NOTE: Only works for Hibernate right now. This is a hack.

Parameters:
archivist - The Archivist to use to delete the Faq. The session will be flushed but not closed.
loc - The Locale.
Returns:
List of Faqs.


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