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

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

public final class SlideDAO
extends AbstractDAO<Slide>

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
SlideDAO(SQLConnection db)
          DAO Constructor.
 
Method Summary
 java.lang.Long createEntity(Slide entity)
          Creates an entity of type T and returns the inserted id.
 java.util.List<Slide> getEntityListBySQL(java.lang.String sql)
          Will return all lectures by String sql.
 java.util.List<Slide> getSlidesByParaId(long paraId, SlideAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a sorted List of Slide objects for Paragraph identified by long paraId.
 java.lang.Integer hardDeleteEntity(Slide entity)
          Hard deletes Slide.
 java.lang.Integer updateEntity(Slide entity)
          Will update a Slide entity and return the number of rows that were updated, which must be one.
 
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

SlideDAO

public SlideDAO(SQLConnection db)
DAO Constructor.

Parameters:
db - SQLConnection connection
Method Detail

getEntityListBySQL

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

Parameters:
sql - String
Returns:
Lecture

getSlidesByParaId

public java.util.List<Slide> getSlidesByParaId(long paraId,
                                               SlideAttributeEnum orderAttribute,
                                               SQLSortDirectionEnum sortDirection)
Will return a sorted List of Slide objects for Paragraph identified by long paraId.

Parameters:
paraId - long
orderAttribute - SlideAttributeEnum
sortDirection - SQLSortDirectionEnum
Returns:
List of Slide

createEntity

public java.lang.Long createEntity(Slide 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.

updateEntity

public java.lang.Integer updateEntity(Slide entity)
Will update a Slide entity and return the number of rows that were updated, which must be one. If the number is not one a failure had occurred. Notice: Ownership will not be updated

Parameters:
entity - Slide.
Returns:
Integer Number of rows that were updated

hardDeleteEntity

public java.lang.Integer hardDeleteEntity(Slide entity)
Hard deletes Slide.

Parameters:
entity - Slide
Returns:
Integer