net.sf.borg.model
Class MemoModel

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

public class MemoModel
extends Model
implements Searchable<Memo>

The Memo Model manages the Memo Entities. Memos are keyed by a name. Memos contain simple text and have stayed simple to be able to sync with the simple memo functionality of a Palm Pilot.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.borg.model.Model
Model.Listener
 
Method Summary
 void delete(String name, boolean undo)
          Delete a memo by name
 void export(Writer fw)
          Export to XML
 MemoDB getDB()
          Gets the dB.
 Memo getMemo(String name)
          Gets a memo by name.
 Collection<Memo> getMemos()
          Gets all memos.
 Collection<String> getNames()
          Gets all memo names.
static MemoModel getReference()
          Gets the singleton.
 void importXml(String fileName)
          Import xml.
 void refresh()
          Refresh listeners
 void saveMemo(Memo memo)
          Save a memo.
 void saveMemo(Memo memo, boolean undo)
          Save a memo.
 Collection<Memo> search(SearchCriteria criteria)
          Return a collection of all records that match the given search criteria
 
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 MemoModel getReference()
Gets the singleton.

Returns:
the singleton

getDB

public MemoDB getDB()
Gets the dB.

Returns:
the dB

getMemos

public Collection<Memo> getMemos()
                          throws Exception
Gets all memos.

Returns:
all memos
Throws:
Exception - the exception

getNames

public Collection<String> getNames()
                            throws Exception
Gets all memo names.

Returns:
the memo names
Throws:
Exception - the exception

delete

public void delete(String name,
                   boolean undo)
Delete a memo by name

Parameters:
name - the memo name
undo - true if we are executing an undo

saveMemo

public void saveMemo(Memo memo)
Save a memo.

Parameters:
memo - the memo

saveMemo

public void saveMemo(Memo memo,
                     boolean undo)
Save a memo.

Parameters:
memo - the memo
undo - true if we are executing an undo

getMemo

public Memo getMemo(String name)
             throws Exception
Gets a memo by name.

Parameters:
name - the memo name
Returns:
the memo
Throws:
Exception - the exception

export

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

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

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

refresh

public void refresh()
Refresh listeners


search

public Collection<Memo> 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<Memo>
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