Package services.gui

Class JatosGuiExceptionThrower


  • @Singleton
    public class JatosGuiExceptionThrower
    extends java.lang.Object
    Class with convenience methods to throw a JatosGuiException. It checks whether the call is an Ajax one. It puts the error message into the RequestScopeMessaging.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void throwAjax​(java.lang.Exception e)
      Throws a JatosGuiException for an Ajax request (doesn't return a view but a simple text) with the exception's message.
      void throwAjax​(java.lang.Exception e, int httpStatus)
      Throws a JatosGuiException for an Ajax request (doesn't return a view but a simple text) with the exception's message.
      void throwAjax​(java.lang.String errorMsg, int httpStatus)
      Throws a JatosGuiException for an Ajax request (doesn't return a view) with the given error msg and HTTP status.
      void throwHome​(play.mvc.Http.Request request, java.lang.Exception e)
      Throws a JatosGuiException.
      void throwRedirect​(java.lang.Exception e, play.api.mvc.Call call)
      Throws a JatosGuiException that either redirects to the given call if it's a non-Ajax request - or returns the exception's message if it's a Ajax request.
      void throwStudy​(play.mvc.Http.Request request, java.lang.Exception e, java.lang.Long studyId)
      Throws a JatosGuiException.
      void throwStudy​(play.mvc.Http.Request request, java.lang.String errorMsg, int httpStatus, java.lang.Long studyId)
      Throws a JatosGuiException with the given error msg and HTTP status.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • throwAjax

        public void throwAjax​(java.lang.String errorMsg,
                              int httpStatus)
                       throws JatosGuiException
        Throws a JatosGuiException for an Ajax request (doesn't return a view) with the given error msg and HTTP status.
        Throws:
        JatosGuiException
      • throwAjax

        public void throwAjax​(java.lang.Exception e)
                       throws JatosGuiException
        Throws a JatosGuiException for an Ajax request (doesn't return a view but a simple text) with the exception's message. The exception's type determines the response's HTTP status code.
        Throws:
        JatosGuiException
      • throwAjax

        public void throwAjax​(java.lang.Exception e,
                              int httpStatus)
                       throws JatosGuiException
        Throws a JatosGuiException for an Ajax request (doesn't return a view but a simple text) with the exception's message. The HTTP's status code is taken from the parameter.
        Throws:
        JatosGuiException
      • throwRedirect

        public void throwRedirect​(java.lang.Exception e,
                                  play.api.mvc.Call call)
                           throws JatosGuiException
        Throws a JatosGuiException that either redirects to the given call if it's a non-Ajax request - or returns the exception's message if it's a Ajax request. The exception's type determines the response's HTTP status code.
        Throws:
        JatosGuiException
      • throwHome

        public void throwHome​(play.mvc.Http.Request request,
                              java.lang.Exception e)
                       throws JatosGuiException
        Throws a JatosGuiException. If it's a non-Ajax request, it puts the exception's message into the request scope and returns the home view. If it's a Ajax request, it just returns the exception's message. The HTTP status code is determined by the exception type.
        Throws:
        JatosGuiException
      • throwStudy

        public void throwStudy​(play.mvc.Http.Request request,
                               java.lang.String errorMsg,
                               int httpStatus,
                               java.lang.Long studyId)
                        throws JatosGuiException
        Throws a JatosGuiException with the given error msg and HTTP status. If non Ajax it shows study's study view. Distinguishes between normal and Ajax request.
        Throws:
        JatosGuiException
      • throwStudy

        public void throwStudy​(play.mvc.Http.Request request,
                               java.lang.Exception e,
                               java.lang.Long studyId)
                        throws JatosGuiException
        Throws a JatosGuiException. If it's a non-Ajax request, it puts the exception's message into the request scope and returns the study's study view. If it's a Ajax request, it just returns the exception's message. The HTTP status code is determined by the exception type.
        Throws:
        JatosGuiException