Interface ModuleIntegrationService

All Superinterfaces:
Service

public interface ModuleIntegrationService
extends Service
Used for inter-module communication without introducing compile-time dependencies. Contains an API to invoke interfaces from a module on which there is no direct dependency.
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object call​(java.lang.String modulePrefix, java.lang.String api, java.lang.Object... args)
    Calls the given Inter-Module API.
    boolean isInboundInterfaceAvailable​(java.lang.String interfaceName, java.lang.String interfaceVersion, PlatformUserContext context)
    This method returns true if the interface with the given version is available in any modules available during runtime.
    boolean isModuleAvailable​(java.lang.String prefix)
    Given the prefix of a module, this method returns true if the module is available during the runtime, else returns false.
    java.util.List<Model> processInboundInterface​(java.lang.String interfaceName, java.lang.String interfaceVersion, java.util.List<Model> models, PlatformUserContext context)
    Given an inbound interface and a list of models to process, converts the models to CSV and executes the interface.
    java.util.List<Model> processInboundInterface​(java.lang.String interfaceName, java.lang.String interfaceVersion, java.util.List<Model> models, IntegrationContext integrationContext, PlatformUserContext context)
    Given an inbound interface, a list of models to process and integration specific parameters, converts the models to CSV and executes the interface.
    java.util.List<CsvRow> processInboundInterfaceCsv​(java.lang.String interfaceName, java.lang.String interfaceVersion, java.util.List<CsvRow> data, PlatformUserContext context)
    Given an inbound interface and a list of CsvRow, executes the interface.
  • Method Details

    • isInboundInterfaceAvailable

      boolean isInboundInterfaceAvailable​(java.lang.String interfaceName, java.lang.String interfaceVersion, PlatformUserContext context)
      This method returns true if the interface with the given version is available in any modules available during runtime. else return false
      Parameters:
      context -
      interfaceName -
      interfaceVersion -
      Returns:
    • processInboundInterface

      java.util.List<Model> processInboundInterface​(java.lang.String interfaceName, java.lang.String interfaceVersion, java.util.List<Model> models, PlatformUserContext context) throws java.lang.Exception
      Given an inbound interface and a list of models to process, converts the models to CSV and executes the interface. Return the models which were not processed successfully. Any transient fields on the models are mapped to fields by the same name on the inbound interface.

      This method throws an Exception if the interface does not exist.

      Throws:
      java.lang.Exception
    • processInboundInterface

      java.util.List<Model> processInboundInterface​(java.lang.String interfaceName, java.lang.String interfaceVersion, java.util.List<Model> models, IntegrationContext integrationContext, PlatformUserContext context) throws java.lang.Exception
      Given an inbound interface, a list of models to process and integration specific parameters, converts the models to CSV and executes the interface. Return the models which were not processed successfully. Any transient fields on the models are mapped to fields by the same name on the inbound interface.

      This method throws an Exception if the interface does not exist.

      Throws:
      java.lang.Exception
    • processInboundInterfaceCsv

      java.util.List<CsvRow> processInboundInterfaceCsv​(java.lang.String interfaceName, java.lang.String interfaceVersion, java.util.List<CsvRow> data, PlatformUserContext context) throws java.lang.Exception
      Given an inbound interface and a list of CsvRow, executes the interface. Return CsvRows which were not processed successfully (including an additional InputRefId column (row number) and Error column at the beginning of each row)

      This method throws an Exception if the interface does not exist.

      Throws:
      java.lang.Exception
    • isModuleAvailable

      boolean isModuleAvailable​(java.lang.String prefix)
      Given the prefix of a module, this method returns true if the module is available during the runtime, else returns false. (Redundant with ModuleService#isModuleAvailable(String) but provided here for convenience).
      Parameters:
      prefix - module prefix
      Returns:
      true iff the module is present
    • call

      java.lang.Object call​(java.lang.String modulePrefix, java.lang.String api, java.lang.Object... args)
      Calls the given Inter-Module API. Assumes that the called Module is deployed within the current Platform instance. (Call isModuleAvailable(String) first if you are in doubt.)

      As an example, assume we have a class like this in the ZBKS module:

      Parameters:
      modulePrefix - prefix of Module whose API is to be called
      api - API name as component.method, as identified by the InterModuleAPI annotation on the associated class
      args - arguments to be passed to the given api
      Returns:
      return value from the api call