Class AbstractFluentService

    • Constructor Detail

      • AbstractFluentService

        public AbstractFluentService()
    • Method Detail

      • runUnitTest

        public Throwable runUnitTest()
        Run the service's Unit Test Script if defined for the service, returning null if succeeded or an error if it failed. If there is no 'Unit Test Script' defined, this method will return null.
        Specified by:
        runUnitTest in interface IUnitTestableService
        Returns:
        an Exception if the test case failed, or null if the test case succeeded or no 'Unit Test Script' defined.
        See Also:
        IUnitTestableService.runUnitTest()
      • getGroovyServiceLog

        public GroovyServiceLog getGroovyServiceLog()
        Return the GroovyServiceLog record created after executing the script.
        Returns:
        the GroovyServiceLog record created after executing the script.
      • isGroovyDebugLogging

        public Boolean isGroovyDebugLogging()
        Return true if GroovyLogger DEBUG level message recording is enabled.
        Returns:
        true if GroovyLogger DEBUG level message recording is enabled.
      • setGroovyDebugLogging

        public void setGroovyDebugLogging​(Boolean debugEnabled)
        Set whether GroovyLogger DEBUG level message recording is enabled.
        Parameters:
        debugEnabled - the groovyDebugLoggingEnabled to set
      • isGroovyLoggingEnabled

        public boolean isGroovyLoggingEnabled()
        Return true if the Groovy Service logging is enabled.
        Returns:
        true if the Groovy Service logging is enabled.
      • setExceptionDebugLoggingEnabled

        public void setExceptionDebugLoggingEnabled​(Boolean debugEnabled)
        Specify whether the Exception DEBUG level message recording is enabled.
        Parameters:
        debugEnabled - specify the Exception DEBUG level message recording is enabled
        Since:
        19.5.3
      • isExceptionDebugLoggingEnabled

        public boolean isExceptionDebugLoggingEnabled()
        Return true if the Exception DEBUG level message recording is enabled.
        Returns:
        true if the Exception DEBUG level message recording is enabled.
        Since:
        19.5.3
      • setGroovyLoggingEnabled

        public void setGroovyLoggingEnabled​(Boolean loggingEnabled)
        Specify whether the Groovy Service logging is enabled.
        Parameters:
        loggingEnabled - specify whether the Groovy Service logging is enabled
      • getGroovyScript

        public String getGroovyScript()
        Returns:
        the Groovy Script content to execute
      • setGroovyScript

        public void setGroovyScript​(String script)
        Parameters:
        script - the Groovy Script content to execute
      • getExecutionTimeout

        public Integer getExecutionTimeout()
        Return the GroovyScript execution timeout in milliseconds.
        Returns:
        the GroovyScript execution timeout in milliseconds
      • setExecutionTimeout

        public void setExecutionTimeout​(Integer timeout)
        Return the GroovyScript execution timeout in milliseconds.
        Parameters:
        timeout - the GroovyScript execution timeout in milliseconds
      • getCommitChanges

        public Boolean getCommitChanges()
        Return the commit changes flag.
        Returns:
        the commit changes flag.
      • setCommitChanges

        public void setCommitChanges​(Boolean commitChanges)
        Set the commit changes flag.
        Parameters:
        commitChanges - the commit changes flag
      • getLogger

        public Logger getLogger()
        Return the service logger.
        Returns:
        the service logger
        Since:
        17.10.0
      • getSlf4jLogger

        protected org.slf4j.Logger getSlf4jLogger()
        Returns:
        the class logger
      • createExceptionAndLog

        protected ApplicationException createExceptionAndLog​(Date startTime,
                                                             com.jezhumble.javasysmon.CpuTimes startCpuTimes,
                                                             Long startFreeMemory,
                                                             Throwable cause,
                                                             String context,
                                                             String userMsg,
                                                             String solution,
                                                             JobAction jobAction,
                                                             Submission submission,
                                                             Form form,
                                                             String functionTrigger)
        Create application exception and optionally log ErrorLog and GroovyServiceLog records if Groovy Logging enabled.
        Parameters:
        startTime - the time the service was invoked prior to the error
        startCpuTimes - the CPU times when the service was invoked (required)
        startFreeMemory - the free memory in bytes when the service was invoked (required)
        cause - the root cause of the error
        context - the error context information
        userMsg - the user message
        solution - the solution
        submission - the submission object
        form - the form
        functionTrigger - the function trigger
        Returns:
        a new application exception
      • getServiceNameAndVersion

        protected String getServiceNameAndVersion()
        Returns:
        the service definition name and version number
      • getServiceTimeout

        protected Integer getServiceTimeout()
        Returns:
        the service timeout
      • getClient

        protected Client getClient()
        Returns:
        the client security execution context
      • getCause

        protected Throwable getCause​(Throwable e)
        Return the root cause of the exception
        Parameters:
        e - the error
        Returns:
        the root cause of the exception
      • getRequestUser

        protected User getRequestUser​(HttpServletRequest request)
        Return the authenticated user value object for the request session, or null if none available.
        Parameters:
        request - the servlet request (required)
        Returns:
        user value object
      • getFunctionTrigger

        protected String getFunctionTrigger()
        Return the function trigger.
        Returns:
        the function trigger
        Since:
        17.10.0