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

Specified by:
export in class Model
Parameters:
fw - the writer to write XML to
Throws:
Exception - the exception

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

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

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