|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.webapp.notes.db.NotesDatabase
org.activemath.webapp.notes.db.JDBCNotesDatabase
public class JDBCNotesDatabase
Notes Database using JDBC connectivity This implementation assumes that
there will never be more notes stored than min(2^31-1, largest integer
writable in database); it generates the primary keys as maximum over the
rows in the database. It also assumes that the java.sql API cares for proper
quoting itself, that is if PreparedStatement.setString is
used, it is assumed that no exploits to the underlying SQL layer should be
possible.
| Field Summary | |
|---|---|
protected static Category |
log
The logger for this class |
| Constructor Summary | |
|---|---|
JDBCNotesDatabase()
standard constructor |
|
JDBCNotesDatabase(String databaseURL,
String databaseLogin,
String databasePasswd)
|
|
| Method Summary | |
|---|---|
Note |
createNote(String user,
boolean isPublic,
String noteTitle,
String noteContent,
String contentId)
creates a new note. |
void |
deleteNote(String user,
int noteId)
deletes note from the database |
Connection |
getConnection()
|
static NotesDatabase |
getInstance()
|
String |
getStatus()
only for debugging - returns a String containing a log of what has recently happened |
void |
init()
initializes the database. |
Note |
retrieveNote(String user,
int noteId)
returns the indicated note from the database. |
Iterator |
selectNotes(String user)
|
Iterator |
selectNotes(String user,
String contentId)
selects a group of notes from the database selectNotes
selects the notes which belong to the user and refer to the topic
indicated by contentId |
void |
storeNote(String user,
Note aNote)
stores the given note in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Category log
| Constructor Detail |
|---|
public JDBCNotesDatabase()
public JDBCNotesDatabase(String databaseURL,
String databaseLogin,
String databasePasswd)
| Method Detail |
|---|
public static NotesDatabase getInstance()
public void init()
public void storeNote(String user,
Note aNote)
throws NotesDatabaseAccessException
user - String containing the asserted userIdaNote - Note that is stored in the database
NotesDatabaseAccessException, - if the user is not the note's owner, although the note
exists
NotesDatabaseAccessException - if the user does not own the note,
but it exists
public Note createNote(String user,
boolean isPublic,
String noteTitle,
String noteContent,
String contentId)
date of the note will be
changed when it is stored in the database. The note Id will be generated
as maximum of the notes already in the database + 1, it will be 0 if
none is present.
user - String identifying the owner of the noteisPublic - boolean indicating whether other users may access itnoteContent - String with the intended content for the notecontentId - String identifying the content this note refers to
public Note retrieveNote(String user,
int noteId)
throws NotesDatabaseAccessException,
NotesDatabaseNoteIdInvalidException
user - String indicating the user the note's supposed to belong tonoteId - the id of the note
org.activemath.sm.notes.NotesDatabaseAccessException - is thrown if, for a private node, the user is not the same as
stored in database
org.activemath.sm.notes.NotesDatabaseNoteIdInvalidException - if the noteId is not valid.
NotesDatabaseAccessException
NotesDatabaseNoteIdInvalidException
public Iterator selectNotes(String user,
String contentId)
selectNotes
selects the notes which belong to the user and refer to the topic
indicated by contentId
user - String indicating the owner of the notescontentId - String indicating the content of the note
public Iterator selectNotes(String user)
public void deleteNote(String user,
int noteId)
throws NotesDatabaseAccessException,
NotesDatabaseNoteIdInvalidException
user - String containing the asserted userIdnoteId - of the note to delete
NotesDatabaseAccessException - is thrown if note's user is not the user given
NotesDatabaseNoteIdInvalidException - is thrown if the note is not stored in the databasepublic String getStatus()
getStatus in class NotesDatabasepublic Connection getConnection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||