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

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

public final class FilecardDAO
extends AbstractDAO<Filecard>

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
FilecardDAO(SQLConnection db)
          DAO Constructor.
 
Method Summary
 java.lang.Long createEntity(Filecard entity)
          Creates an entity of type T and returns the inserted id.
 java.util.List<Filecard> getActivatedEntitiesByLectureId(long lectureId, FilecardAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a sorted List of activated Filecard objects for Paragraph identified by long lectureId.
 java.util.List<Filecard> getActivatedEntitiesByParaId(long paraId, FilecardAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a sorted List of activated Filecard objects for Paragraph identified by long paraId .
 java.util.List<Filecard> getEntitiesByParaId(long paraId, FilecardAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a sorted List of Filecard objects for Paragraph identified by long paraId .
 java.util.List<Filecard> getEntitiesByParaIdWhereClause(java.lang.String whereClause, long paraId, FilecardAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a sorted List of Filecard with where clause String whereClause for Paragraph identified by long paraId.
 Filecard getEntityById(long id)
          Will return a Filecard identified by long id.
 java.util.List<Filecard> getEntityListBySQL(java.lang.String sql)
          Will return all lectures by String sql.
 java.util.List<Filecard> getOwnershipEntitiesByParaId(long userId, long paraId, FilecardAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a sorted List of Filecard objects for Paragraph identified by long paraId and User identified by long userId.
 java.util.List<Filecard> getPendingEntitiesByParaId(long paraId, FilecardAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a sorted List of pending Filecard objects for Paragraph identified by long paraId .
 java.lang.Integer hardDeleteEntity(Filecard entity)
          Hard deletes Slide.
 java.lang.Integer updateEntity(Filecard 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

FilecardDAO

public FilecardDAO(SQLConnection db)
DAO Constructor.

Parameters:
db - SQLConnection connection
Method Detail

getEntityListBySQL

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

Parameters:
sql - String
Returns:
Lecture

getEntityById

public Filecard getEntityById(long id)
Will return a Filecard identified by long id.

Parameters:
id - long
Returns:
Filecard

getEntitiesByParaIdWhereClause

public java.util.List<Filecard> getEntitiesByParaIdWhereClause(java.lang.String whereClause,
                                                               long paraId,
                                                               FilecardAttributeEnum orderAttribute,
                                                               SQLSortDirectionEnum sortDirection)
Will return a sorted List of Filecard with where clause String whereClause for Paragraph identified by long paraId.

Parameters:
whereClause - String
paraId - long
orderAttribute - FilecardAttributeEnum
sortDirection - SQLSortDirectionEnum
Returns:
List of Filecard

getActivatedEntitiesByParaId

public java.util.List<Filecard> getActivatedEntitiesByParaId(long paraId,
                                                             FilecardAttributeEnum orderAttribute,
                                                             SQLSortDirectionEnum sortDirection)
Will return a sorted List of activated Filecard objects for Paragraph identified by long paraId .

Parameters:
paraId - long
orderAttribute - FilecardAttributeEnum
sortDirection - SQLSortDirectionEnum
Returns:
List of Filecard

getActivatedEntitiesByLectureId

public java.util.List<Filecard> getActivatedEntitiesByLectureId(long lectureId,
                                                                FilecardAttributeEnum orderAttribute,
                                                                SQLSortDirectionEnum sortDirection)
Will return a sorted List of activated Filecard objects for Paragraph identified by long lectureId.

Parameters:
lectureId - long
orderAttribute - FilecardAttributeEnum
sortDirection - SQLSortDirectionEnum
Returns:
List of Filecard

getPendingEntitiesByParaId

public java.util.List<Filecard> getPendingEntitiesByParaId(long paraId,
                                                           FilecardAttributeEnum orderAttribute,
                                                           SQLSortDirectionEnum sortDirection)
Will return a sorted List of pending Filecard objects for Paragraph identified by long paraId .

Parameters:
paraId - long
orderAttribute - FilecardAttributeEnum
sortDirection - SQLSortDirectionEnum
Returns:
List of Filecard

getOwnershipEntitiesByParaId

public java.util.List<Filecard> getOwnershipEntitiesByParaId(long userId,
                                                             long paraId,
                                                             FilecardAttributeEnum orderAttribute,
                                                             SQLSortDirectionEnum sortDirection)
Will return a sorted List of Filecard objects for Paragraph identified by long paraId and User identified by long userId.

Parameters:
userId - long
paraId - long
orderAttribute - FilecardAttributeEnum
sortDirection - SQLSortDirectionEnum
Returns:
List of Filecard

getEntitiesByParaId

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

Parameters:
paraId - long
orderAttribute - FilecardAttributeEnum
sortDirection - SQLSortDirectionEnum
Returns:
List of Filecard

createEntity

public java.lang.Long createEntity(Filecard 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(Filecard 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(Filecard entity)
Hard deletes Slide.

Parameters:
entity - Slide
Returns:
Integer