|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.hs_rm.cs.lecturenotes.server.core.persistence.dao.AbstractDAO<Annotation>
de.hs_rm.cs.lecturenotes.server.core.persistence.dao.AnnotationDAO
public final class AnnotationDAO
Data Access Object for System Entity "Lecture".
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 | |
---|---|
AnnotationDAO(SQLConnection db)
DAO Constructor. |
Method Summary | |
---|---|
java.lang.Long |
createEntity(Annotation entity)
Creates an entity of type T and returns the inserted id. |
ResponseStatusEnum |
deleteAnnotation(long annotationId)
Will delete an Annotation object identified by
long annotationId . |
Annotation |
getAnnotationById(long id)
Will return a (first level) Annotation where parentId = 0. |
java.util.List<Annotation> |
getAnnotationListBySQL(java.lang.String sqlQuery)
Fetches a List of Annotation objects by using
SQL statement String sqlQuery . |
java.util.List<Annotation> |
getAnnotationsByParagraphId(long paragraphId,
AnnotationAttributeEnum orderAttribute,
SQLSortDirectionEnum sortDirection)
Will return a List of (first level) Annotation
objects where parentId = 0 and paragraphId =
long paragraphId . |
java.util.List<Annotation> |
getAnnotationsByParagraphId(long paragraphId,
AnnotationDiscriminatorEnum disc,
AnnotationAttributeEnum orderAttribute,
SQLSortDirectionEnum sortDirection)
Will return a List of (first level) Annotation
objects where parentId = 0 and paragraphId =
long paragraphId and annotationDiscriminator is
AnnotationDiscriminatorEnum disc . |
java.util.List<Annotation> |
getAnnotationsByParaId(long paraId,
AnnotationAttributeEnum orderAttribute,
SQLSortDirectionEnum sortDirection)
Will return a List of (first level) Annotation
objects where parentId = 0 for Paragraph with paraId =
long paraId . |
java.util.List<Annotation> |
getAnnotationsByParaId(long paraId,
AnnotationDiscriminatorEnum disc,
AnnotationAttributeEnum orderAttribute,
SQLSortDirectionEnum sortDirection)
Will return a List of (first level) Annotation
objects where parentId = 0 and annotationDiscriminator is
AnnotationDiscriminatorEnum disc for Paragraph
with paraId = long paraId . |
Annotation |
getAnyAnnotationById(long id)
Will return any Annotation regardless if its parentId = 0 or
not. |
java.util.List<Annotation> |
getChildAnnotationsForAnnotation(long parentId,
AnnotationAttributeEnum orderAttribute,
SQLSortDirectionEnum sortDirection)
Will return a List of Annotation objects that
are responses to a parent Annotation identified by
long parentId . |
java.lang.Long |
getNumberAnnotationForParagraph(long paraId,
boolean withResponses)
Will return the number of annotations for Paragraph row(s)
with long paraIdId . |
java.lang.Long |
getNumberResponsesForAnnotation(long annotationId)
Will return the number of response annotations for Annotation with long annotationId . |
java.util.List<Annotation> |
getOwnershipAnnotationsByParaId(long userId,
long paraId,
AnnotationAttributeEnum orderAttribute,
SQLSortDirectionEnum sortDirection)
Will return a List of (first level) Annotation
objects owned by User with long userId where
parentId = 0 for Paragraph with paraId =
long paraId . |
java.util.List<ParagraphStats> |
getTopAnnotatedParagraphs(long lectureId,
long limitValue,
boolean withResponses,
boolean withContents,
SQLSortDirectionEnum sortDirection)
Will return the top annotated Paragraph entities, wrapped in
a ParagraphStats object for increased transport performance. |
java.lang.Integer |
updatePosition(long annotationId,
AnnotationStickyPositionEnum position)
Will update the position of an Annotation . |
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 |
---|
public static final java.lang.String SQL_TABLENAME
Constructor Detail |
---|
public AnnotationDAO(SQLConnection db)
db
- SQLConnection
connectionMethod Detail |
---|
public java.util.List<Annotation> getAnnotationListBySQL(java.lang.String sqlQuery)
List
of Annotation
objects by using
SQL statement String sqlQuery
.
sqlQuery
- String
List
of Annotation
public Annotation getAnyAnnotationById(long id)
Annotation
regardless if its parentId = 0 or
not.
id
- long
Annotation
public Annotation getAnnotationById(long id)
Annotation
where parentId = 0.
id
- long
Annotation
public java.util.List<Annotation> getAnnotationsByParagraphId(long paragraphId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
List
of (first level) Annotation
objects where parentId = 0 and paragraphId =
long paragraphId
. The List
is sorted by the
given parameters.
paragraphId
- long
orderAttribute
- AnnotationAttributeEnum
sortDirection
- SQLSortDirectionEnum
List
of Annotation
public java.util.List<Annotation> getAnnotationsByParagraphId(long paragraphId, AnnotationDiscriminatorEnum disc, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
List
of (first level) Annotation
objects where parentId = 0 and paragraphId =
long paragraphId
and annotationDiscriminator is
AnnotationDiscriminatorEnum disc
. The List
is
sorted by the given parameters.
paragraphId
- long
disc
- AnnotationDiscriminatorEnum
orderAttribute
- AnnotationAttributeEnum
sortDirection
- SQLSortDirectionEnum
List
of Annotation
public java.util.List<Annotation> getAnnotationsByParaId(long paraId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
List
of (first level) Annotation
objects where parentId = 0 for Paragraph
with paraId =
long paraId
. The List
is sorted by the given
parameters.
paraId
- long
orderAttribute
- AnnotationAttributeEnum
sortDirection
- SQLSortDirectionEnum
List
of Annotation
public java.util.List<Annotation> getOwnershipAnnotationsByParaId(long userId, long paraId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
List
of (first level) Annotation
objects owned by User
with long userId
where
parentId = 0 for Paragraph
with paraId =
long paraId
. The List
is sorted by the given
parameters.
userId
- long
that is within the ownership
User
objectparaId
- long
orderAttribute
- AnnotationAttributeEnum
sortDirection
- SQLSortDirectionEnum
List
of Annotation
public java.util.List<Annotation> getAnnotationsByParaId(long paraId, AnnotationDiscriminatorEnum disc, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
List
of (first level) Annotation
objects where parentId = 0 and annotationDiscriminator is
AnnotationDiscriminatorEnum disc
for Paragraph
with paraId = long paraId
. The List
is sorted
by the given parameters.
paraId
- long
disc
- AnnotationDiscriminatorEnum
orderAttribute
- AnnotationAttributeEnum
sortDirection
- SQLSortDirectionEnum
List
of Annotation
public java.util.List<Annotation> getChildAnnotationsForAnnotation(long parentId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
List
of Annotation
objects that
are responses to a parent Annotation
identified by
long parentId
. The List
is sorted by the given
parameters.
parentId
- long
orderAttribute
- AnnotationAttributeEnum
sortDirection
- SQLSortDirectionEnum
List
of Annotation
public ResponseStatusEnum deleteAnnotation(long annotationId)
Annotation
object identified by
long annotationId
. Will return SUCCESS if the operation was
successful or FAILURE otherwise.
annotationId
- long
ResponseStatusEnum
.public java.lang.Long getNumberResponsesForAnnotation(long annotationId)
Annotation
with long annotationId
.
annotationId
- long
Long
public java.lang.Long getNumberAnnotationForParagraph(long paraId, boolean withResponses)
Paragraph
row(s)
with long paraIdId
. boolean withResponses
indicates whether the responses to the annotations shall be included in
the calculation, because they are also Annotation
entities.
paraId
- long
withResponses
- boolean
Long
public java.util.List<ParagraphStats> getTopAnnotatedParagraphs(long lectureId, long limitValue, boolean withResponses, boolean withContents, SQLSortDirectionEnum sortDirection)
Paragraph
entities, wrapped in
a ParagraphStats
object for increased transport performance.
The paragraph with the most relations to Annotation
entities.
lectureId
- long
that describes the Lecture
limitValue
- long
that limits the return rows to the specified
valuewithResponses
- boolean
that specifies whether response
annotations shall be included in the calculationwithContents
- boolean
that specifies whether the content field
of the Paragraph
objects shall be correctly
transfered or not (if not needed). This is for transport
performancesortDirection
- SQLSortDirectionEnum
that specifies the SQL sort
direction
List
of ParagraphStats
objectspublic java.lang.Integer updatePosition(long annotationId, AnnotationStickyPositionEnum position)
Annotation
. Returns the
number of updated rows. Should be exactly 1 if successful, otherwise
there was a problem.
annotationId
- annotationId
position
- AnnotationStickyPositionEnum
Integer
.public java.lang.Long createEntity(Annotation entity)
IDAO
T
and returns the inserted id.
Throws SQLException in case of a duplicated entry or other DBMS problems.
entity
- T
Long
Id of the freshly inserted row. Must be not
null and should be above 0.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |