de.hs_rm.cs.lecturenotes.server.core.transport.service
Class AnnotationCommServiceImpl

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
              extended by com.google.gwt.user.server.rpc.RemoteServiceServlet
                  extended by de.hs_rm.cs.lecturenotes.server.core.transport.service.AnnotationCommServiceImpl
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, AnnotationCommService, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public final class AnnotationCommServiceImpl
extends com.google.gwt.user.server.rpc.RemoteServiceServlet
implements AnnotationCommService

GWT RPC Service Servlet for everything relevant annotations.

Version:
$LastChangedRevision: 265 $
Author:
Enrico Homann
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.hs_rm.cs.lecturenotes.client.core.transport.service.AnnotationCommService
AnnotationCommService.Util
 
Constructor Summary
AnnotationCommServiceImpl()
           
 
Method Summary
 ResponseStatusEnum createAnnotation(Annotation entity)
          Creates a new annotation Annotation entity, whether a) DoecentAnnotation, or b) UserAnnotation.
 ResponseStatusEnum deleteAnnotation(long annotationId)
          Removes a Annotation and it's children from the database.
 java.util.List<Annotation> getAnnotationListByParagraphId(AnnotationDiscriminatorEnum annotationDiscr, long paragraphId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a List of Annotation object for the row identifier long paragraphId of Paragraph.
 java.util.List<Annotation> getAnnotationListByParaId(AnnotationDiscriminatorEnum annotationDiscr, long paraId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a List of Annotation object for the paragraph identifier long paraId of Paragraph.
 java.util.List<Annotation> getAnnotationListByParaId(long paraId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a list with all known annotations for long paraId.
 java.util.List<Annotation> getChildAnnotationByAnnotation(long parentId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a List of children Annotation, that are represented as "Answers/Comments" to annotations.
 java.lang.Long getNumberAnnotationsForParagraph(long paraId, boolean withResponses)
          Will return the number of annotations for Paragraph with long paraId.
 java.lang.Long getNumberResponsesForAnnotation(long annotationId)
          Will return the number of responses to Annotation with long annotationId.
 java.util.List<Annotation> getOwnershipAnnotationListByParaId(long paraId, AnnotationAttributeEnum orderAttribute, SQLSortDirectionEnum sortDirection)
          Will return a list with all known annotations for long paraId and the current session User.
 java.util.List<ParagraphStats> getTopAnnotatedParagraphs(long lectureId, long limitValue, boolean withResponses, boolean withContents, SQLSortDirectionEnum sortDirection)
          Will return a List of ParagraphStats objects that hold a Paragraph and its number of all known annotations.
 ResponseStatusEnum updateAnnotationPosition(long annotationId, AnnotationStickyPositionEnum position)
          Will update the position of the Annotation identified by long annotationId.
 
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
getSerializationPolicy, processCall, processPost
 
Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost
 
Methods inherited from class javax.servlet.http.HttpServlet
service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationCommServiceImpl

public AnnotationCommServiceImpl()
Method Detail

createAnnotation

public ResponseStatusEnum createAnnotation(Annotation entity)
                                    throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Creates a new annotation Annotation entity, whether a) DoecentAnnotation, or b) UserAnnotation.

Specified by:
createAnnotation in interface AnnotationCommService
Parameters:
entity - Annotation
Returns:
ResponseStatusEnum
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getAnnotationListByParagraphId

public java.util.List<Annotation> getAnnotationListByParagraphId(AnnotationDiscriminatorEnum annotationDiscr,
                                                                 long paragraphId,
                                                                 AnnotationAttributeEnum orderAttribute,
                                                                 SQLSortDirectionEnum sortDirection)
                                                          throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return a List of Annotation object for the row identifier long paragraphId of Paragraph.

Specified by:
getAnnotationListByParagraphId in interface AnnotationCommService
Parameters:
annotationDiscr - AnnotationDiscriminatorEnum, discriminator to separate DocentAnnotation and UserAnnotation
paragraphId - long
orderAttribute - AnnotationAttributeEnum
sortDirection - SQLSortDirection
Returns:
List of Annotation
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getAnnotationListByParaId

public java.util.List<Annotation> getAnnotationListByParaId(AnnotationDiscriminatorEnum annotationDiscr,
                                                            long paraId,
                                                            AnnotationAttributeEnum orderAttribute,
                                                            SQLSortDirectionEnum sortDirection)
                                                     throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return a List of Annotation object for the paragraph identifier long paraId of Paragraph.

Specified by:
getAnnotationListByParaId in interface AnnotationCommService
Parameters:
annotationDiscr - AnnotationDiscriminatorEnum, discriminator to separate DocentAnnotation and UserAnnotation
paraId - long
orderAttribute - AnnotationAttributeEnum
sortDirection - SQLSortDirection
Returns:
List of Annotation
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getAnnotationListByParaId

public java.util.List<Annotation> getAnnotationListByParaId(long paraId,
                                                            AnnotationAttributeEnum orderAttribute,
                                                            SQLSortDirectionEnum sortDirection)
                                                     throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return a list with all known annotations for long paraId.

Specified by:
getAnnotationListByParaId in interface AnnotationCommService
Parameters:
paraId - attribute from table annotation
orderAttribute - AnnotationAttributeEnum
sortDirection - SQLSortDirection
Returns:
list of Annotation objects
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getOwnershipAnnotationListByParaId

public java.util.List<Annotation> getOwnershipAnnotationListByParaId(long paraId,
                                                                     AnnotationAttributeEnum orderAttribute,
                                                                     SQLSortDirectionEnum sortDirection)
                                                              throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return a list with all known annotations for long paraId and the current session User.

Specified by:
getOwnershipAnnotationListByParaId in interface AnnotationCommService
Parameters:
paraId - attribute from table annotation
orderAttribute - AnnotationAttributeEnum
sortDirection - SQLSortDirection
Returns:
list of Annotation objects
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getChildAnnotationByAnnotation

public java.util.List<Annotation> getChildAnnotationByAnnotation(long parentId,
                                                                 AnnotationAttributeEnum orderAttribute,
                                                                 SQLSortDirectionEnum sortDirection)
                                                          throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return a List of children Annotation, that are represented as "Answers/Comments" to annotations.

Specified by:
getChildAnnotationByAnnotation in interface AnnotationCommService
Parameters:
parentId - long annotationId
orderAttribute - AnnotationAttributeEnum
sortDirection - SQLSortDirection
Returns:
List of Annotation
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

deleteAnnotation

public ResponseStatusEnum deleteAnnotation(long annotationId)
                                    throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Removes a Annotation and it's children from the database. It's a hard delete. This action cannot be undone.

Specified by:
deleteAnnotation in interface AnnotationCommService
Parameters:
annotationId - long
Returns:
ResponseStatusEnum with SUCCESS if the operation was successful or FAILURE otherwise
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getNumberResponsesForAnnotation

public java.lang.Long getNumberResponsesForAnnotation(long annotationId)
                                               throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return the number of responses to Annotation with long annotationId.

Specified by:
getNumberResponsesForAnnotation in interface AnnotationCommService
Parameters:
annotationId - long
Returns:
Long
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getNumberAnnotationsForParagraph

public java.lang.Long getNumberAnnotationsForParagraph(long paraId,
                                                       boolean withResponses)
                                                throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return the number of annotations for Paragraph with long paraId. Uses paraId to get the numbers for all versions of a Paragraph. boolean withResponses indicates whether responses shall be included in the calculation.

Specified by:
getNumberAnnotationsForParagraph in interface AnnotationCommService
Parameters:
paraId - long
withResponses - boolean
Returns:
Long
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getTopAnnotatedParagraphs

public java.util.List<ParagraphStats> getTopAnnotatedParagraphs(long lectureId,
                                                                long limitValue,
                                                                boolean withResponses,
                                                                boolean withContents,
                                                                SQLSortDirectionEnum sortDirection)
                                                         throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will return a List of ParagraphStats objects that hold a Paragraph and its number of all known annotations. boolean withResponses indicated whether responses to a Annotation shall be included in the calc.

Specified by:
getTopAnnotatedParagraphs in interface AnnotationCommService
Parameters:
lectureId - long
limitValue - long
withResponses - boolean
withContents - boolean
sortDirection - SQLSortDirectionEnum
Returns:
List of ParagraphStats
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

updateAnnotationPosition

public ResponseStatusEnum updateAnnotationPosition(long annotationId,
                                                   AnnotationStickyPositionEnum position)
                                            throws InvalidPermissionException
Description copied from interface: AnnotationCommService
Will update the position of the Annotation identified by long annotationId. Returns SUCCESS if operation was successful, or FAILURE otherwise.

Specified by:
updateAnnotationPosition in interface AnnotationCommService
Parameters:
annotationId - long
position - AnnotationStickyPositionEnum
Returns:
ResponseStatusEnum
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions