Class ServiceLocator

java.lang.Object
com.avoka.fc.core.service.ServiceLocator

public class ServiceLocator extends Object
Provides a Service Locator for looking up service classes.

New services can be created based on the service definition settings.

  • Constructor Details

    • ServiceLocator

      public ServiceLocator()
  • Method Details

    • invalidateCache

      public static void invalidateCache()
      Invalidate the service definition cache.
      Since:
      4.3.2
    • getServiceForDefinition

      public static Object getServiceForDefinition(ServiceDefinition serviceDefinition)
      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 public static Object getServiceForName(String serviceName)
      Deprecated.
      use
      invalid reference
      ServiceDefinitionDao#getServiceForClientNameAndVersion(Long, String, Integer)
      or ServiceDefinitionDao.getClientService(Long, String, Integer) instead
      Return 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 public static Object getServiceForNameAndVersion(String serviceName, int versionNumber)
      Deprecated.
      use
      invalid reference
      ServiceDefinitionDao#getClientServiceWithFallback(Long, String, Integer)
      or ServiceDefinitionDao.getClientService(Long, String, Integer) along with getServiceForDefinition(ServiceDefinition) instead
      Return 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

      public static List getServiceListForType(String serviceType)
      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 null
      serviceType - the service type, cannot be null
      Returns:
      a new service instance for the given definition
    • getServiceForTypeDefault

      public static Object getServiceForTypeDefault(String serviceType)
      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

      public static boolean hasServiceForTypeDefault(String serviceType)
      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

      public static IEmailService getEmailService()
      Return the default email service.
      Returns:
      the default email service
      Since:
      4.3.2
    • getEmailService

      public static IEmailService getEmailService(Submission submission)
      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

      public static IPaymentGatewayService getPaymentGatewayService(Client client)
      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

      public static IHostedPaymentService getHostedPaymentServiceForClient(Client client)
      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

      public static IJobController getJobController(Job job)
      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

      public static IJobController getJobController(TemplateVersion templateVersion)
      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

      public static IFormVersionSelectorService getFormVersionSelectorServiceForForm(Form form)
      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

      public static IReceiptNumberService getReceiptNumberServiceForForm(Form form)
      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

      public static ITrackingNumberService getTrackingNumberServiceForForm(Form form)
      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

      public static IComposerHtmlFormRenderService 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

      public static ISubmissionCompletedProcessor getSubmissionCompletedProcessor(Submission submission)
      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

      public static ISubmissionDataStorageService getSubmissionDataStorageService(Submission submission)
      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

      public static ISubmissionDataStorageService getSubmissionDataStorageServiceDefault()
      Return the default SubmissionDataStorageService.
      Returns:
      the default SubmissionDataStorageService
      Since:
      4.0.0
    • getTwoFactorAuthenticationService

      public static ITwoFactorAuthenticationService getTwoFactorAuthenticationService(Portal portal)
      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