org.apache.wicket.spring.common
Class ContactDaoImpl

java.lang.Object
  extended by org.apache.wicket.spring.common.ContactDaoImpl
All Implemented Interfaces:
ContactDao

public class ContactDaoImpl
extends java.lang.Object
implements ContactDao

a dao implementation with an auto-generated embedded database. in a true application this dao would interface with a real database, but because we want to keep dependencies to a minimum we generate our own database here.

Author:
Igor Vaynberg (ivaynberg)

Constructor Summary
ContactDaoImpl()
          Constructor
 
Method Summary
protected  void add(Contact contact)
           
 int count()
           
 void delete(Contact contact)
          delete contact from the database
 java.util.Iterator find(QueryParam qp)
          select contacts and apply sort
 Contact get(long id)
          find contact by id
protected  java.util.List getIndex(java.lang.String prop, boolean asc)
           
 void save(Contact contact)
          add contact to the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContactDaoImpl

public ContactDaoImpl()
Constructor

Parameters:
count - number of contacts to generate at startup
Method Detail

get

public Contact get(long id)
find contact by id

Specified by:
get in interface ContactDao
Parameters:
id -
Returns:
contact

add

protected void add(Contact contact)

find

public java.util.Iterator find(QueryParam qp)
select contacts and apply sort

Specified by:
find in interface ContactDao
Parameters:
first -
count -
sortProperty -
sortAsc -
Returns:
list of contacts

getIndex

protected java.util.List getIndex(java.lang.String prop,
                                  boolean asc)

count

public int count()
Specified by:
count in interface ContactDao
Returns:
number of contacts in the database

save

public void save(Contact contact)
add contact to the database

Parameters:
contact -

delete

public void delete(Contact contact)
delete contact from the database

Parameters:
contact -


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.