org.apache.wicket.examples.repeater
Class ContactsDatabase

java.lang.Object
  extended by org.apache.wicket.examples.repeater.ContactsDatabase

public class ContactsDatabase
extends Object

simple database for contacts

Author:
igor

Constructor Summary
ContactsDatabase(int count)
          Constructor
 
Method Summary
protected  void add(Contact contact)
           
 void delete(Contact contact)
          delete contact from the database
 List<Contact> find(int first, int count, String sortProperty, boolean sortAsc)
          select contacts and apply sort
 Contact get(long id)
          find contact by id
 int getCount()
           
protected  List<Contact> getIndex(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

ContactsDatabase

public ContactsDatabase(int count)
Constructor

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

get

public Contact get(long id)
find contact by id

Parameters:
id -
Returns:
contact

add

protected void add(Contact contact)

find

public List<Contact> find(int first,
                          int count,
                          String sortProperty,
                          boolean sortAsc)
select contacts and apply sort

Parameters:
first -
count -
sortProperty -
sortAsc -
Returns:
list of contacts

getIndex

protected List<Contact> getIndex(String prop,
                                 boolean asc)

getCount

public int getCount()
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-2011 Apache Software Foundation. All Rights Reserved.