net.sf.borg.model
Class AddressModel

java.lang.Object
  extended by net.sf.borg.model.Model
      extended by net.sf.borg.model.AddressModel
All Implemented Interfaces:
Searchable<Address>

public class AddressModel
extends Model
implements Searchable<Address>

AddressModel provides the model layer APIs for working with Addresses


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.borg.model.Model
Model.Listener
 
Method Summary
 void delete(Address addr)
          Delete an Address
 void delete(Address addr, boolean undo)
          Delete an Address.
 void export(Writer fw)
          Export all Addresses to XML.
 Address getAddress(int num)
          Get an Address by key
 Collection<Address> getAddresses()
          Get all addresses.
 Collection<Address> getAddresses(Date d)
          Get all addresses with birthdays on a given day.
 EntityDB<Address> getDB()
          Deprecated. 
static AddressModel getReference()
          Gets the reference.
 void importXml(String fileName)
          Import xml.
 Address newAddress()
          get a new address object
 void refresh()
          Refresh the birthday map and notify any listeners that the model has changed
 void saveAddress(Address addr)
          Save an address.
 void saveAddress(Address addr, boolean undo)
          Save an address.
 Collection<Address> search(SearchCriteria criteria)
          Return a collection of all records that match the given search criteria
 void sync()
          Sync with the underlying db
 
Methods inherited from class net.sf.borg.model.Model
addListener, refreshListeners, remove, removeListener, removeListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getReference

public static AddressModel getReference()
Gets the reference.

Returns:
the reference

delete

public void delete(Address addr)
Delete an Address

Parameters:
addr - the Address

delete

public void delete(Address addr,
                   boolean undo)
Delete an Address.

Parameters:
addr - the Address
undo - true if we are executing an undo

export

public void export(Writer fw)
            throws Exception
Export all Addresses to XML.

Parameters:
fw - the Writer to write XML to
Throws:
Exception - the exception

getAddress

public Address getAddress(int num)
                   throws Exception
Get an Address by key

Parameters:
num - the key
Returns:
the address
Throws:
Exception - the exception

getAddresses

public Collection<Address> getAddresses()
                                 throws Exception
Get all addresses.

Returns:
the addresses
Throws:
Exception - the exception

getAddresses

public Collection<Address> getAddresses(Date d)
Get all addresses with birthdays on a given day.

Parameters:
d - the day
Returns:
the addresses

getDB

@Deprecated
public EntityDB<Address> getDB()
Deprecated. 

Gets the dB.

Returns:
the dB

importXml

public void importXml(String fileName)
               throws Exception
Import xml.

Parameters:
fileName - the file name of the file containing the XML
Throws:
Exception - the exception

newAddress

public Address newAddress()
get a new address object

Returns:
the address

refresh

public void refresh()
Refresh the birthday map and notify any listeners that the model has changed


saveAddress

public void saveAddress(Address addr)
Save an address.

Parameters:
addr - the address

saveAddress

public void saveAddress(Address addr,
                        boolean undo)
Save an address.

Parameters:
addr - the address
undo - true if we are executing an undo

sync

public void sync()
Sync with the underlying db


search

public Collection<Address> search(SearchCriteria criteria)
Description copied from interface: Searchable
Return a collection of all records that match the given search criteria

Specified by:
search in interface Searchable<Address>
Parameters:
criteria - the search criteria
Returns:
collection of matching records


Generated September 24 2010 by mbb using Apache Ant version 1.7.1 compiled on June 27 2008 and Java version 1.6.0_20 from Sun Microsystems Inc. on Linux i386 2.6.24-28-generic