org.workjournal
Class Journal

java.lang.Object
  |
  +--org.workjournal.Journal

public class Journal
extends java.lang.Object

Journal is a collection of JournalEntry objects. It is persisted in a small database using HypersonicSQL.

Author:
Thornton Rose
See Also:
JournalEntry

Constructor Summary
Journal(java.sql.Connection conn)
          Construct a new Journal.
 
Method Summary
 void add(JournalEntry entry)
          Add the given journal entry.
 int count()
          Get the number of journal entries.
 void delete(JournalEntry entry)
          Delete the given journal entry.
 JournalEntry get(int row)
          Get the journal entry at the given position.
 int indexOf(JournalEntry entry)
          Get the index of the given journal entry.
 void load()
          Load the entries from the database.
 long newId()
          Generate a new journal entry ID.
 void sort()
          Sort the journal entries using a JournalEntryComparator.
 void update(JournalEntry entry)
          Update the given journal entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Journal

public Journal(java.sql.Connection conn)
Construct a new Journal.
Method Detail

get

public JournalEntry get(int row)
Get the journal entry at the given position.

indexOf

public int indexOf(JournalEntry entry)
Get the index of the given journal entry.

count

public int count()
Get the number of journal entries.

load

public void load()
          throws java.sql.SQLException
Load the entries from the database.

add

public void add(JournalEntry entry)
         throws java.sql.SQLException
Add the given journal entry.

update

public void update(JournalEntry entry)
            throws java.sql.SQLException
Update the given journal entry.

delete

public void delete(JournalEntry entry)
            throws java.sql.SQLException
Delete the given journal entry.

sort

public void sort()
Sort the journal entries using a JournalEntryComparator.

newId

public long newId()
           throws java.sql.SQLException
Generate a new journal entry ID.