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

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.LectureCommServiceImpl
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, LectureCommService, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public final class LectureCommServiceImpl
extends com.google.gwt.user.server.rpc.RemoteServiceServlet
implements LectureCommService

GWT RPC Service Servlet for everything relevant to lectures.

Version:
$LastChangedRevision: 296 $
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.LectureCommService
LectureCommService.Util
 
Constructor Summary
LectureCommServiceImpl()
           
 
Method Summary
 ResponseStatusEnum createNewLecture(Lecture lecture)
          Creates a new Lecture on the server.
 Paragraph createNewParagraph(long position, long parent, long lectureId, java.lang.String title, java.lang.String content)
          Will create a new Paragraph object.
 ResponseStatusEnum deleteLecture(Lecture lecture)
          Hard deletes a Lecture and all its dependencies (but the user).
 boolean deleteParagraph(long paraId)
          Will soft-remove a Paragraph identified by long paraId.
 java.lang.String extractCode(long lectureId)
          Extracts source code from Lecture identified by long lectureId.
 java.lang.String getAbsolutePathLectureFilesImagesPrint()
          Will return the absolute path for files.
 java.lang.String getAbsolutePathLectureFilesImagesWeb()
          Will return the absolute path for files.
 Lecture getCompleteLecture(long lectureId)
          Will return the complete Lecture object for long lectureId.
 Paragraph getCompleteParagraph(long paraId, long lectureId)
          Will return a full Paragraph with contents and children and their contents.
 Paragraph getLatestVersionOfParagraph(long paraId)
          Will return the latest version of a Paragraph identified by long paraId.
 java.util.List<Lecture> getLectureListAll(LectureAttributeEnum sortAttribute, SQLSortDirectionEnum sortDirection)
          Will return the list with Lecture objects with all known Lecture objects.
 java.util.List<Lecture> getLectureListMostAnnotations(SQLSortDirectionEnum sortDirection)
          Will return the list with Lecture objects, sorted by the most annotations.
 java.util.List<Lecture> getLectureListOwnership(LectureAttributeEnum sortAttribute, SQLSortDirectionEnum sortDirection)
          Will return the list with Lecture objects owned by the current session User.
 java.util.List<Paragraph> getParagraphHistory(long paraId)
          Will return a List of Paragraph with all known versions to Paragraph with long paraId.
 java.lang.String renderParaAsHTML(java.lang.String contents, long lectureId)
          Renders a Lecture based String para to HTML.
 ResponseStatusEnum updateLectureHeader(Lecture lecture)
          Updates the header information of a Lecture without any Paragraphs.
 boolean updateParagraph(Paragraph para)
          Will update a Paragraph object using the values provided by Paragraph para.
 
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

LectureCommServiceImpl

public LectureCommServiceImpl()
Method Detail

getAbsolutePathLectureFilesImagesWeb

public java.lang.String getAbsolutePathLectureFilesImagesWeb()
Will return the absolute path for files. Context: Images Web.

Returns:
String

getAbsolutePathLectureFilesImagesPrint

public java.lang.String getAbsolutePathLectureFilesImagesPrint()
Will return the absolute path for files. Context: Images Web.

Returns:
String

getLectureListAll

public java.util.List<Lecture> getLectureListAll(LectureAttributeEnum sortAttribute,
                                                 SQLSortDirectionEnum sortDirection)
                                          throws InvalidPermissionException
Description copied from interface: LectureCommService
Will return the list with Lecture objects with all known Lecture objects.

Specified by:
getLectureListAll in interface LectureCommService
Parameters:
sortAttribute - LectureAttributeEnum attribute to sort for
sortDirection - SQLSortDirectionEnum direction of sorting
Returns:
List of Lecture
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getLectureListMostAnnotations

public java.util.List<Lecture> getLectureListMostAnnotations(SQLSortDirectionEnum sortDirection)
                                                      throws InvalidPermissionException
Description copied from interface: LectureCommService
Will return the list with Lecture objects, sorted by the most annotations.

Specified by:
getLectureListMostAnnotations in interface LectureCommService
Parameters:
sortDirection - SQLSortDirectionEnum direction of sorting
Returns:
List of Lecture
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getLectureListOwnership

public java.util.List<Lecture> getLectureListOwnership(LectureAttributeEnum sortAttribute,
                                                       SQLSortDirectionEnum sortDirection)
                                                throws InvalidPermissionException
Description copied from interface: LectureCommService
Will return the list with Lecture objects owned by the current session User.

Specified by:
getLectureListOwnership in interface LectureCommService
Parameters:
sortAttribute - LectureAttributeEnum attribute to sort for
sortDirection - SQLSortDirectionEnum direction of sorting
Returns:
List of Lecture
Throws:
InvalidPermissionException - Thrown if caller has insufficient permissions

getCompleteLecture

public Lecture getCompleteLecture(long lectureId)
                           throws InvalidPermissionException
Description copied from interface: LectureCommService
Will return the complete Lecture object for long lectureId. Includes paragraphs and their children and Exercise objects.

Specified by:
getCompleteLecture in interface LectureCommService
Parameters:
lectureId - long
Returns:
Lecture
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

getLatestVersionOfParagraph

public Paragraph getLatestVersionOfParagraph(long paraId)
                                      throws InvalidPermissionException
Description copied from interface: LectureCommService
Will return the latest version of a Paragraph identified by long paraId.

Specified by:
getLatestVersionOfParagraph in interface LectureCommService
Parameters:
paraId - long
Returns:
Paragraph
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

getCompleteParagraph

public Paragraph getCompleteParagraph(long paraId,
                                      long lectureId)
                               throws InvalidPermissionException
Description copied from interface: LectureCommService
Will return a full Paragraph with contents and children and their contents.

Specified by:
getCompleteParagraph in interface LectureCommService
Parameters:
paraId - long
lectureId - long
Returns:
Paragraph
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

updateParagraph

public boolean updateParagraph(Paragraph para)
                        throws InvalidPermissionException
Description copied from interface: LectureCommService
Will update a Paragraph object using the values provided by Paragraph para. Always returns true.

Specified by:
updateParagraph in interface LectureCommService
Parameters:
para - Paragraph
Returns:
boolean
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

renderParaAsHTML

public java.lang.String renderParaAsHTML(java.lang.String contents,
                                         long lectureId)
                                  throws InvalidPermissionException
Description copied from interface: LectureCommService
Renders a Lecture based String para to HTML. Replaces Editor Tags with valid HTML Tags.

Specified by:
renderParaAsHTML in interface LectureCommService
Parameters:
contents - String
lectureId - long
Returns:
String
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

createNewParagraph

public Paragraph createNewParagraph(long position,
                                    long parent,
                                    long lectureId,
                                    java.lang.String title,
                                    java.lang.String content)
                             throws InvalidPermissionException
Description copied from interface: LectureCommService
Will create a new Paragraph object.

Specified by:
createNewParagraph in interface LectureCommService
Parameters:
position - long
parent - long
lectureId - lecture
title - String
content - String
Returns:
Paragraph
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

deleteParagraph

public boolean deleteParagraph(long paraId)
                        throws InvalidPermissionException
Description copied from interface: LectureCommService
Will soft-remove a Paragraph identified by long paraId.

Specified by:
deleteParagraph in interface LectureCommService
Parameters:
paraId - long
Returns:
boolean
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

extractCode

public java.lang.String extractCode(long lectureId)
                             throws InvalidPermissionException
Description copied from interface: LectureCommService
Extracts source code from Lecture identified by long lectureId. Will return the URL of the index HTML file to show up the result or null if there was an error.

Specified by:
extractCode in interface LectureCommService
Parameters:
lectureId - long
Returns:
String
Throws:
InvalidPermissionException - Thrown if caller has not the correct permissions

createNewLecture

public ResponseStatusEnum createNewLecture(Lecture lecture)
                                    throws InvalidPermissionException
Description copied from interface: LectureCommService
Creates a new Lecture on the server. Returns SUCCESS if the lecture was created or FAILURE if there was a failure.

Specified by:
createNewLecture in interface LectureCommService
Parameters:
lecture - Lecture object
Returns:
ResponseStatusEnum SUCCESS at successful creation, FAILURE at failure
Throws:
InvalidPermissionException - Thrown if the caller has insufficient permissions.

updateLectureHeader

public ResponseStatusEnum updateLectureHeader(Lecture lecture)
                                       throws InvalidPermissionException
Description copied from interface: LectureCommService
Updates the header information of a Lecture without any Paragraphs. Returns SUCCESS if the operation was successful, or FAILURE otherwise

Specified by:
updateLectureHeader in interface LectureCommService
Parameters:
lecture - Lecture
Returns:
ResponseStatusEnum
Throws:
InvalidPermissionException - Thrown if the caller has insufficient permissions.

deleteLecture

public ResponseStatusEnum deleteLecture(Lecture lecture)
                                 throws InvalidPermissionException
Description copied from interface: LectureCommService
Hard deletes a Lecture and all its dependencies (but the user). Removes Lecture's Paragraphs and their attachments. Returns SUCCESS at successful operation, or FAILURE at a failure.

Specified by:
deleteLecture in interface LectureCommService
Parameters:
lecture - Lecture
Returns:
ResponseStatusEnum
Throws:
InvalidPermissionException - Thrown if the caller has insufficient permissions.

getParagraphHistory

public java.util.List<Paragraph> getParagraphHistory(long paraId)
                                              throws InvalidPermissionException
Description copied from interface: LectureCommService
Will return a List of Paragraph with all known versions to Paragraph with long paraId.

Specified by:
getParagraphHistory in interface LectureCommService
Parameters:
paraId - long
Returns:
List of Paragraph
Throws:
InvalidPermissionException - Thrown if the caller has insufficient permissions.