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.ChangeEvent, 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. 
 String getExportName()
          get the root XML element name for this model's XML representation
 String getInfo()
          return user readable information about the model
static AddressModel getReference()
          Gets the reference.
 void importXml(InputStream is)
          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, getExistingModels, refreshListeners, refreshListeners, remove, removeListener, removeListeners, syncModels
 
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.

Specified by:
export in class Model
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(InputStream is)
               throws Exception
Import xml.

Specified by:
importXml in class Model
Parameters:
is - the input stream 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

Overrides:
sync in class Model

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

getExportName

public String getExportName()
Description copied from class: Model
get the root XML element name for this model's XML representation

Specified by:
getExportName in class Model
Returns:
the XML root element name

getInfo

public String getInfo()
               throws Exception
Description copied from class: Model
return user readable information about the model

Specified by:
getInfo in class Model
Returns:
user readable information String
Throws:
Exception


Generated December 30 2011 by mbb using Apache Ant(TM) version 1.8.2 compiled on December 20 2010 and Java version 1.6.0_30 from Sun Microsystems Inc. on Linux i386 3.0.0-14-generic-pae