de.hs_rm.cs.lecturenotes.server.core.persistence.dao
Class ParagraphDAO

java.lang.Object
  extended by de.hs_rm.cs.lecturenotes.server.core.persistence.dao.AbstractDAO<Paragraph>
      extended by de.hs_rm.cs.lecturenotes.server.core.persistence.dao.ParagraphDAO
All Implemented Interfaces:
IDAO<Paragraph>

public final class ParagraphDAO
extends AbstractDAO<Paragraph>

Data Access Object for System Entity Paragraph. A bunch of core editor functionality resides in LectureSelectHandler.

Version:
$LastChangedRevision: 274 $
Author:
Enrico Homann

Field Summary
static java.lang.String SQL_TABLENAME
          SQL Table Name.
 
Fields inherited from class de.hs_rm.cs.lecturenotes.server.core.persistence.dao.AbstractDAO
SQL_DELETEALL_TEMPLATE, SQL_DROP_TEMPLATE
 
Fields inherited from interface de.hs_rm.cs.lecturenotes.server.core.persistence.dao.IDAO
SQLERRORCODE_DUPLICATE_ENTRY
 
Constructor Summary
ParagraphDAO(SQLConnection db)
          DAO Constructor.
 
Method Summary
 java.lang.Long createEntity(Paragraph entity)
          Creates an entity of type T and returns the inserted id.
 Paragraph getParagraphById(long paragraphId)
          Will return a Paragraph by its primary key long paragraphId or null if none found.
 java.util.List<Paragraph> getParagraphBySQL(java.lang.String sql)
          Will return all lectures by String sql.
 java.util.List<Paragraph> getParagraphHistoryByParaId(long paraId)
          Will return the version history of the Paragraph with long paraId as List of Paragraph objects.
 
Methods inherited from class de.hs_rm.cs.lecturenotes.server.core.persistence.dao.AbstractDAO
createEntity, deleteTableContents, dropTable, executeCreateSQL, executeUpdateSQL, getDb, setDb
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_TABLENAME

public static final java.lang.String SQL_TABLENAME
SQL Table Name.

See Also:
Constant Field Values
Constructor Detail

ParagraphDAO

public ParagraphDAO(SQLConnection db)
DAO Constructor.

Parameters:
db - SQLConnection connection
Method Detail

getParagraphBySQL

public java.util.List<Paragraph> getParagraphBySQL(java.lang.String sql)
Will return all lectures by String sql. This method does not fetch the paragraphs.

Parameters:
sql - String
Returns:
Lecture

getParagraphById

public Paragraph getParagraphById(long paragraphId)
Will return a Paragraph by its primary key long paragraphId or null if none found.

Parameters:
paragraphId - long
Returns:
Paragraph or null

getParagraphHistoryByParaId

public java.util.List<Paragraph> getParagraphHistoryByParaId(long paraId)
Will return the version history of the Paragraph with long paraId as List of Paragraph objects.

Parameters:
paraId - long
Returns:
List of Paragraph

createEntity

public java.lang.Long createEntity(Paragraph entity)
                            throws java.sql.SQLException
Description copied from interface: IDAO
Creates an entity of type T and returns the inserted id. Throws SQLException in case of a duplicated entry or other DBMS problems.

Parameters:
entity - T
Returns:
Long Id of the freshly inserted row. Must be not null and should be above 0.
Throws:
java.sql.SQLException - Exception thrown. Here to indicate a duplicate entry to the outside world.