Package com.avoka.fc.core.service
Class ServiceLocator
java.lang.Object
com.avoka.fc.core.service.ServiceLocator
Provides a Service Locator for looking up service classes.
New services can be created based on the service definition settings.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the Composer HTML form render service.Return the HTML form render service for the given form template version.static IEmailService
Return the default email service.static IEmailService
getEmailService
(Submission submission) Return the email service for the submission.static IFormVersionSelectorService
Returns the form version selector service configured for the formstatic IHostedPaymentService
Returns the hosted payment service configured for the clientstatic IJobController
getJobController
(Job job) Return the Job Controller service for the given job, or null if controller service not defined.static IJobController
getJobController
(TemplateVersion templateVersion) Return the Job Controller service for the given form template version, or null if service not associated.static IPaymentGatewayService
getPaymentGatewayService
(Client client) Returns the payment gateway service configured for the clientstatic IReceiptNumberService
Returns the receipt number service configured for the formstatic IFormSecurityFilterService
Return the form security filter service for a template version.static Object
getServiceForDefinition
(ServiceDefinition serviceDefinition) Return a new service instance for the given service definition.static Object
getServiceForDefinitionOrType
(ServiceDefinition serviceDefinition, String serviceType) Return a new service instance for the given service definition or type.static Object
getServiceForName
(String serviceName) Deprecated.static Object
getServiceForNameAndVersion
(String serviceName, int versionNumber) Deprecated.useinvalid reference
ServiceDefinitionDao#getClientServiceWithFallback(Long, String, Integer)
ServiceDefinitionDao.getClientService(Long, String, Integer)
along withgetServiceForDefinition(ServiceDefinition)
insteadstatic Object
getServiceForTypeDefault
(String serviceType) Return a new service instance for the given default service type.static List
getServiceListForType
(String serviceType) Return a new service instance for the given service definition type.getSubmissionCompletedProcessor
(Submission submission) Return the submission form completed processor service for the given submissions template version.getSubmissionDataStorageService
(Submission submission) Return the SubmissionDataStorageService for the given submission, or the default storage service if not defined.Return the default SubmissionDataStorageService.Return the submission preprocessor service for a template version.static ITrackingNumberService
Returns the tracking number service configured for the formReturns the 2-factor authentication service configured for the portal (via the security manager)static boolean
hasServiceForTypeDefault
(String serviceType) Return true if there is a ServiceDefinition for the given service type.static void
Invalidate the service definition cache.
-
Constructor Details
-
ServiceLocator
public ServiceLocator()
-
-
Method Details
-
invalidateCache
public static void invalidateCache()Invalidate the service definition cache.- Since:
- 4.3.2
-
getServiceForDefinition
Return a new service instance for the given service definition.- Parameters:
serviceDefinition
- the service definition- Returns:
- a new service instance for the given service definition
-
getServiceForName
Deprecated.useinvalid reference
ServiceDefinitionDao#getServiceForClientNameAndVersion(Long, String, Integer)
ServiceDefinitionDao.getClientService(Long, String, Integer)
insteadReturn a new service instance for the given service definition name. This will retrieve the service version marked as the current version.- Parameters:
serviceName
- the name of the service definition- Returns:
- a new service instance for the given service definition name, or null if no service with the given name exists
-
getServiceForNameAndVersion
Deprecated.useinvalid reference
ServiceDefinitionDao#getClientServiceWithFallback(Long, String, Integer)
ServiceDefinitionDao.getClientService(Long, String, Integer)
along withgetServiceForDefinition(ServiceDefinition)
insteadReturn a new service instance for the given service definition name and version number.- Parameters:
serviceName
- the name of the service definition (required)versionNumber
- the version number (required)- Returns:
- a new service instance for the given service definition name, or null if no service with the given name exists
- Since:
- 4.3.0
-
getServiceListForType
Return a new service instance for the given service definition type.- Parameters:
serviceType
- the type of the service definition- Returns:
- a new service instance for the given service definition type
-
getServiceForDefinitionOrType
public static Object getServiceForDefinitionOrType(ServiceDefinition serviceDefinition, String serviceType) Return a new service instance for the given service definition or type. If the service definition is not specified the default service definition for the service type will be used.- Parameters:
serviceDefinition
- the service definition, can be nullserviceType
- the service type, cannot be null- Returns:
- a new service instance for the given definition
-
getServiceForTypeDefault
Return a new service instance for the given default service type.- Parameters:
serviceType
- the service type, cannot be null- Returns:
- a new service instance for the given default service type
-
hasServiceForTypeDefault
Return true if there is a ServiceDefinition for the given service type.- Parameters:
serviceType
- the service name to lookup- Returns:
- true if there is a ServiceDefinition for the given service type
-
getEmailService
Return the default email service.- Returns:
- the default email service
- Since:
- 4.3.2
-
getEmailService
Return the email service for the submission. TM looks for the email service at the form version level, then the client level, then the global service.- Parameters:
submission
- the submission (required)- Returns:
- the email service instance, or null if no email service was found
- Since:
- 4.3.2
-
getPaymentGatewayService
Returns the payment gateway service configured for the client- Parameters:
client
- the client to look up the payment service for (required)- Returns:
- the client payment service, or null if no client payment service defined
- Since:
- 4.0.0
-
getHostedPaymentServiceForClient
Returns the hosted payment service configured for the client- Parameters:
client
- the client to look up the payment service for- Returns:
- the client hosted payment service, or null if no client payment service is defined or it is not a hosted service
-
getJobController
Return the Job Controller service for the given job, or null if controller service not defined.- Parameters:
job
- the job instance (required)- Returns:
- the Job Controller service for the given job, or null if controller service not defined
- Since:
- 4.0.0
-
getJobController
Return the Job Controller service for the given form template version, or null if service not associated.- Parameters:
templateVersion
- the form template version (required)- Returns:
- the Job Controller service for the given form template version, or null if service not associated
- Since:
- 4.0.0
-
getFormVersionSelectorServiceForForm
Returns the form version selector service configured for the form- Parameters:
form
- the form (required)- Returns:
- the form version selector service for the form, or if not set, the default form version selector service
- Since:
- 4.1.0
-
getReceiptNumberServiceForForm
Returns the receipt number service configured for the form- Parameters:
form
- the form (required)- Returns:
- the receipt number service for the form, or if not set, the default receipt number service
-
getTrackingNumberServiceForForm
Returns the tracking number service configured for the form- Parameters:
form
- the form (required)- Returns:
- the tracking number service for the form, or if not set, the default tracking number service
- Since:
- 4.0.0
-
getComposerHtmlFormRenderService
public static IComposerHtmlFormRenderService getComposerHtmlFormRenderService(TemplateVersion version) Return the HTML form render service for the given form template version.- Parameters:
version
- the form template version (required)- Returns:
- the default Composer HTML form render service.
- Since:
- 18.5.0
-
getComposerHtmlFormRenderService
Return the Composer HTML form render service.- Returns:
- the default Composer HTML form render service.
-
getSubmissionPreprocessorServiceForTemplateVersion
public static ISubmissionPreprocessorService getSubmissionPreprocessorServiceForTemplateVersion(TemplateVersion version) Return the submission preprocessor service for a template version. If the template version defines a submission preprocessor service, it is used, otherwise the default submission preprocessor service is returned. If neither are defined, null is returned.- Parameters:
version
- the non-null template version- Returns:
- the submission preprocessor service
-
getSubmissionCompletedProcessor
Return the submission form completed processor service for the given submissions template version.- Parameters:
submission
- the non-null form submission- Returns:
- the submission completed processor service, or null if non defined
-
getSubmissionDataStorageService
Return the SubmissionDataStorageService for the given submission, or the default storage service if not defined.- Parameters:
submission
- the submission record- Returns:
- the SubmissionDataStorageService for the given submission
- Since:
- 4.0.0
-
getSubmissionDataStorageServiceDefault
Return the default SubmissionDataStorageService.- Returns:
- the default SubmissionDataStorageService
- Since:
- 4.0.0
-
getTwoFactorAuthenticationService
Returns the 2-factor authentication service configured for the portal (via the security manager)- Parameters:
portal
- the portal (required)- Returns:
- the 2-factor authentication service for the portal, or null if not set
- Since:
- 4.2.0
-
getSecurityFilterServiceForVersion
public static IFormSecurityFilterService getSecurityFilterServiceForVersion(TemplateVersion version) Return the form security filter service for a template version.- Parameters:
version
- the non-null template version- Returns:
- the form security filter service, or null if none is set
-
invalid reference
ServiceDefinitionDao.getClientService(Long, String, Integer)
instead