Class GroovyServiceInvoker


  • public class GroovyServiceInvoker
    extends java.lang.Object

    Provides a 'Groovy Service' type service invoker class.

    Please note Fluent Service can only invoke Dynamic Groovy Services if the install time Groovy Secure API restriction is not enforced.

    Examples

    Please find the groovy service invoker examples below.

    Invoke "Reference Lookup" Service

    The example below invokes a "Reference Lookup" Groovy Service with a map of parameters and returns a result object.

     import com.avoka.tm.svc.*
    
     def params = [:]
     params.refNumber = ...
    
     def result = new GroovyServiceInvoker()
          .setServiceName("Ref Lookup")
          .setClientCode("maguire")
          .setVersion("0.2.1")
          .invoke(params) 
    Since:
    5.0.0
    • Constructor Detail

      • GroovyServiceInvoker

        public GroovyServiceInvoker()
        Create a groovy service invoker object.
      • GroovyServiceInvoker

        public GroovyServiceInvoker​(SvcDef svcDef)
        Create a 'Groovy Service' invoker object.
        Parameters:
        svcDef - the 'Groovy Service' type service definition to invoke (required)
    • Method Detail

      • setSvcDef

        public GroovyServiceInvoker setSvcDef​(SvcDef svcDef)
        Set the service definition to invoke.
        Parameters:
        svcDef - the service definition
        Returns:
        the groovy service invoker
      • setServiceName

        public GroovyServiceInvoker setServiceName​(java.lang.String serviceName)
        Set the service definition name to invoke.
        Parameters:
        serviceName - the service definition name to invoke
        Returns:
        the groovy service invoker
      • setVersionNumber

        @Deprecated
        public GroovyServiceInvoker setVersionNumber​(int versionNumber)
        Deprecated.
        Set the service definition version number to invoke.
        Parameters:
        versionNumber - service definition version number to invoke
        Returns:
        the groovy service invoker
      • setVersion

        public GroovyServiceInvoker setVersion​(java.lang.String version)
        Set the service definition version to invoke.
        Parameters:
        version - service definition version to invoke (required)
        Returns:
        the groovy service invoker
        Since:
        17.10.0
      • setClientCode

        public GroovyServiceInvoker setClientCode​(java.lang.String clientCode)
        Set the service definition organization client code to invoke.
        Parameters:
        clientCode - service definition client code to invoke
        Returns:
        the groovy service invoker
      • withHighestVersion

        public GroovyServiceInvoker withHighestVersion()
        Set flag to invoke the service with highest version number.
        Returns:
        the service invoker
      • invoke

        public java.lang.Object invoke​(java.util.Map<java.lang.String,​java.lang.Object> params)
        Invoke the service specified by the service definition name, version and client code, with the given params and return the resulting object.
        Parameters:
        params - the map of parameter to invoke the groovy service with
        Returns:
        invoke the service and return the resulting object
      • invoke

        public java.lang.Object invoke()
        Invoke the service specified by the service definition name, version and client code and return the resulting object.
        Returns:
        invoke the service and return the resulting object