Holger's Java API

## com.antelmann.calendar
Class SQLCalendarDB

    java.lang.Object
      com.antelmann.calendar.SQLCalendarDB

All Implemented Interfaces:
  CalendarDB, Closeable

    public class SQLCalendarDB

extends Object
implements CalendarDB

a JDBC implementation of a calendar database. doesn't include recurrence, yet.

Author:
  Holger Antelmann

Field Summary
`protected String` `beginDateField`
`protected String` `cancelField`
`protected String` `categoryField` categories are stored in a single comma-separated text field
`static String` `catSeparator`
`protected Connection` `con`
`protected String` `confirmField`
`protected String` `createdField`
`protected String` `descriptionField`
`protected String` `endDateField`
`protected String` `idField`
`protected String` `locationField`
`protected String` `propsIdField`
`protected String` `propsKeyField`
`protected String` `propsTableName`
`protected String` `propsValueField`
`protected String` `tableName`
`protected String` `titleField`
`protected String` `updatedField`

Constructor Summary
`SQLCalendarDB(Connection con, Properties props)`

Method Summary
`void` `close()`
`boolean` `containsEntry(CalendarEntry entry)` entry is there if the id corresponds to an entry in the database; the contained data may be different
`boolean` `deleteEntry(CalendarEntry entry)` deletes the given entry from the database
`protected int` `generateNewID()` takes the maximum existing id and adds one
`Collection<Alert>` `getActiveAlerts()` returns all active non-acknowledged alerts
`Collection<Alert>` `getAlerts(Filter<Alert> filter)`
`Collection<CalendarEntry>` `getEntries(Filter<CalendarEntry> filter)`
`void` `insertAlert(Alert alert)`
`CalendarEntry` `insertEntry(CalendarEntry entry)` the id of the given entry is ignored; the returned entry will reflect the actual database object
`void` `updateAlert(Alert alert)`
`void` `updateEntry(CalendarEntry entry)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### catSeparator

    public static final String catSeparator

See Also:
  Constant Field Values

### con

    protected Connection con

### tableName

    protected String tableName

### idField

    protected String idField

### titleField

    protected String titleField

### locationField

    protected String locationField

### descriptionField

    protected String descriptionField

### beginDateField

    protected String beginDateField

### endDateField

    protected String endDateField

### confirmField

    protected String confirmField

### cancelField

    protected String cancelField

### createdField

    protected String createdField

### updatedField

    protected String updatedField

### categoryField

    protected String categoryField

  categories are stored in a single comma-separated text field

### propsTableName

    protected String propsTableName

### propsIdField

    protected String propsIdField

### propsKeyField

    protected String propsKeyField

### propsValueField

    protected String propsValueField

Constructor Detail

### SQLCalendarDB

    public SQLCalendarDB(Connection con,
                         Properties props)

Method Detail

### containsEntry

    public boolean containsEntry(CalendarEntry entry)
                          throws DatabaseException

  Description copied from interface: `CalendarDB`
  entry is there if the id corresponds to an entry in the database; the contained data may be different

  Specified by:
    `containsEntry` in interface `CalendarDB`
  Throws:
    `DatabaseException`

### updateEntry

    public void updateEntry(CalendarEntry entry)
                     throws CalendarException,
                            DatabaseException

  Specified by:
    `updateEntry` in interface `CalendarDB`
  Throws:
    `CalendarException`
    `DatabaseException`

### insertEntry

    public CalendarEntry insertEntry(CalendarEntry entry)
                              throws DatabaseException

  Description copied from interface: `CalendarDB`
  the id of the given entry is ignored; the returned entry will reflect the actual database object

  Specified by:
    `insertEntry` in interface `CalendarDB`
  Throws:
    `DatabaseException`

### generateNewID

    protected int generateNewID()
                         throws SQLException

  takes the maximum existing id and adds one

  Throws:
    `SQLException`

### deleteEntry

    public boolean deleteEntry(CalendarEntry entry)
                        throws DatabaseException

  deletes the given entry from the database

  Specified by:
    `deleteEntry` in interface `CalendarDB`
  Throws:
    `DatabaseException`

### getEntries

    public Collection<CalendarEntry> getEntries(Filter<CalendarEntry> filter)
                                         throws DatabaseException

  Specified by:
    `getEntries` in interface `CalendarDB`
  Throws:
    `DatabaseException`

### getActiveAlerts

    public Collection<Alert> getActiveAlerts()
                                      throws DatabaseException

  Description copied from interface: `CalendarDB`
  returns all active non-acknowledged alerts

  Specified by:
    `getActiveAlerts` in interface `CalendarDB`
  Throws:
    `DatabaseException`

### getAlerts

    public Collection<Alert> getAlerts(Filter<Alert> filter)
                                throws DatabaseException

  Specified by:
    `getAlerts` in interface `CalendarDB`
  Throws:
    `DatabaseException`

### insertAlert

    public void insertAlert(Alert alert)
                     throws DatabaseException,
                            CalendarException

  Specified by:
    `insertAlert` in interface `CalendarDB`
  Throws:
    `DatabaseException`
    `CalendarException`

### updateAlert

    public void updateAlert(Alert alert)
                     throws DatabaseException,
                            CalendarException

  Specified by:
    `updateAlert` in interface `CalendarDB`
  Throws:
    `DatabaseException`
    `CalendarException`

### close

    public void close()
               throws DatabaseException

  Specified by:
    `close` in interface `CalendarDB`
  Specified by:
    `close` in interface `Closeable`
  Throws:
    `DatabaseException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads