Package com.avoka.fc.core.service.fluent
Class AbstractFluentService
java.lang.Object
com.avoka.fc.core.service.fluent.AbstractFluentService
- All Implemented Interfaces:
IFluentService
,IGroovyDebugLogService
,IServiceDefinitionAware
,IUnitTestableService
- Direct Known Subclasses:
FluentDeliveryProcessService
,FluentDynamicDataService
,FluentFormPrefillService
,FluentFormSavedProcessor
,FluentFormSecurityFilterService
,FluentFormVersionSelectorService
,FluentFunctionService
,FluentGroovyService
,FluentJobActionService
,FluentMediaTypeScanService
,FluentReceiptNumberService
,FluentRenderReceiptService
,FluentScheduledService
,FluentSubmissionCompletedProcessor
,FluentSubmissionDataValidator
,FluentTaskExpiryService
,FluentTrackingNumberService
,FluentTransactionHistoryPublisher
,FluentVirusScanService
public abstract class AbstractFluentService
extends Object
implements IFluentService, IGroovyDebugLogService
Provides an abstract Fluent Groovy service.
- Since:
- 5.0.0
-
Field Summary
Modifier and TypeFieldDescriptionThe input parameters to log.Fields inherited from interface com.avoka.fc.core.service.fluent.IFluentService
PARAM_ACTION_PROPERTIES, PARAMS_FILEDATA, PARAMS_FILENAME, PARAMS_FORM, PARAMS_FORM_XML, PARAMS_FUNC_PARAM, PARAMS_JOB, PARAMS_JOB_ACTION, PARAMS_PARAMS, PARAMS_REQUEST, PARAMS_ROWS, PARAMS_SVC_DEF, PARAMS_TEST_PARAMS, PARAMS_TXN, PARAMS_USER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildErrorMessage
(String message) Method to build the error message for global fluent serviceprotected 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.protected Throwable
Return the root cause of the exceptionprotected Client
Return the commit changes flag.Return the GroovyScript execution timeout in milliseconds.protected String
Return the function trigger.Return true if GroovyLogger DEBUG level message recording is enabled.Return the GroovyServiceLog record created after executing the script.Return the service logger.protected User
getRequestUser
(jakarta.servlet.http.HttpServletRequest request) Return the authenticated user value object for the request session, or null if none available.Return the service definitionprotected String
protected Integer
protected org.slf4j.Logger
Return the service Unit Test Script logger output.Invoke the Fluent Service using the given parameters.boolean
Return true if the Exception DEBUG level message recording is enabled.boolean
Return true if the Groovy Service logging is enabled.Run the service's Unit Test Script if defined for the service, returning null if succeeded or an error if it failed.void
setCommitChanges
(Boolean commitChanges) Set the commit changes flag.void
setExceptionDebugLoggingEnabled
(Boolean debugEnabled) Specify whether the Exception DEBUG level message recording is enabled.void
setExecutionTimeout
(Integer timeout) Return the GroovyScript execution timeout in milliseconds.void
setGroovyDebugLogging
(Boolean debugEnabled) Set whether GroovyLogger DEBUG level message recording is enabled.void
setGroovyLoggingEnabled
(Boolean loggingEnabled) Specify whether the Groovy Service logging is enabled.void
setGroovyScript
(String script) void
Set the service logger.void
setServiceDefinition
(ServiceDefinition serviceDefinition) Set the service definition.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.avoka.fc.core.service.fluent.IFluentService
getErrorType
Methods inherited from interface com.avoka.fc.core.service.IGroovyDebugLogService
isGroovyDebugLogging
-
Field Details
-
inputParams
The input parameters to log.
-
-
Constructor Details
-
AbstractFluentService
public AbstractFluentService()
-
-
Method Details
-
invoke
Invoke the Fluent Service using the given parameters.- Specified by:
invoke
in interfaceIFluentService
- Parameters:
parameters
- the service script parameters (required)- Returns:
- a new invocation result
- See Also:
-
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 interfaceIUnitTestableService
- Returns:
- an Exception if the test case failed, or null if the test case succeeded or no 'Unit Test Script' defined.
- See Also:
-
getTestLogOutput
Return the service Unit Test Script logger output.- Specified by:
getTestLogOutput
in interfaceIUnitTestableService
- Returns:
- the service Unit Test Script logger output
- Since:
- 17.10.0
- See Also:
-
getGroovyServiceLog
Return the GroovyServiceLog record created after executing the script.- Returns:
- the GroovyServiceLog record created after executing the script.
-
getGroovyDebugLogging
Return true if GroovyLogger DEBUG level message recording is enabled.- Specified by:
getGroovyDebugLogging
in interfaceIGroovyDebugLogService
- Returns:
- true if GroovyLogger DEBUG level message recording is enabled.
- Since:
- 20.11.7
-
setGroovyDebugLogging
Set whether GroovyLogger DEBUG level message recording is enabled.- Specified by:
setGroovyDebugLogging
in interfaceIGroovyDebugLogService
- 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
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
Specify whether the Groovy Service logging is enabled.- Parameters:
loggingEnabled
- specify whether the Groovy Service logging is enabled
-
getGroovyScript
- Returns:
- the Groovy Script content to execute
-
setGroovyScript
- Parameters:
script
- the Groovy Script content to execute
-
getExecutionTimeout
Return the GroovyScript execution timeout in milliseconds.- Returns:
- the GroovyScript execution timeout in milliseconds
-
setExecutionTimeout
Return the GroovyScript execution timeout in milliseconds.- Parameters:
timeout
- the GroovyScript execution timeout in milliseconds
-
getServiceDefinition
Return the service definition- Specified by:
getServiceDefinition
in interfaceIServiceDefinitionAware
- Returns:
- the service definition.
-
setServiceDefinition
Set the service definition.- Specified by:
setServiceDefinition
in interfaceIServiceDefinitionAware
- Parameters:
serviceDefinition
- the service definition to set
-
getCommitChanges
Return the commit changes flag.- Returns:
- the commit changes flag.
-
setCommitChanges
Set the commit changes flag.- Parameters:
commitChanges
- the commit changes flag
-
setLogger
Set the service logger.- Specified by:
setLogger
in interfaceIFluentService
- Parameters:
logger
- the service logger- Since:
- 17.10.0
- See Also:
-
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 errorstartCpuTimes
- 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 errorcontext
- the error context informationuserMsg
- the user messagesolution
- the solutionsubmission
- the submission objectform
- the formfunctionTrigger
- the function trigger- Returns:
- a new application exception
-
getServiceNameAndVersion
- Returns:
- the service definition name and version number
-
getServiceTimeout
- Returns:
- the service timeout
-
getClient
- Returns:
- the client security execution context
-
getCause
Return the root cause of the exception- Parameters:
e
- the error- Returns:
- the root cause of the exception
-
getRequestUser
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
Return the function trigger.- Returns:
- the function trigger
- Since:
- 17.10.0
-
buildErrorMessage
Method to build the error message for global fluent service- Parameters:
message
-- Returns:
- detailed message
- Since:
- 23.10.0
-