Class PairedIdService

java.lang.Object
com.persequor.saga.modules.id.service.PairedIdService
All Implemented Interfaces:
com.persequor.extension.job.IInitializationJob, Runnable

@Singleton public class PairedIdService extends Object implements com.persequor.extension.job.IInitializationJob
  • Constructor Details

  • Method Details

    • run

      public void run()
      This method will be run at startup In order to avoid corrupting the data in DB, we need to make sure asap that there are no duplicately registered IPairedTypes
      Specified by:
      run in interface Runnable
      Throws:
      IllegalStateException - if any duplicate IPairedType was registered
    • getSinglePairedId

      public Optional<PairedId> getSinglePairedId(String id, IPairedType pairedType)
      Returns the unique PairedId entry found in the database for the provided ID and type, if found. Else, return Optional.empty()
      Parameters:
      id - string identifying the product
      pairedType - The type of pairing
      Returns:
      The product id, paired id and paired type, if found.
    • getPairedIds

      public List<PairedId> getPairedIds(String id)
      Returns the PairedId entries found in the database for the provided ID
      Parameters:
      id - string identifying the product
      Returns:
      All the paired ids with associated paired type, if any.
    • getAllPairedIds

      public List<PairedId> getAllPairedIds(Collection<String> ids, String type)
      Returns a list of PairedId found in the database for the provided ids and type
      Parameters:
      ids - Collection of PairedId.id to get the associated pairedId from
      type - the type of pairing to look for
      Returns:
      list of all the pairedIds found for provided ids and PairedIdType
    • getAllPairedIds

      public List<PairedId> getAllPairedIds(Collection<String> ids, Class<?> typeClass)
      Returns a list of PairedId found in the database for the provided ids and type
      Parameters:
      ids - Collection of PairedId.id to get the associated pairedId from
      typeClass - the type of pairing to look for
      Returns:
      list of all the pairedIds found for provided ids and PairedIdType
    • getAllPairedIds

      public List<PairedId> getAllPairedIds(Collection<String> ids, IPairedType pairedType)
      Returns a list of PairedId found in the database for the provided ids and type
      Parameters:
      ids - Collection of PairedId.id to get the associated pairedId from
      pairedType - the type of pairing to look for
      Returns:
      list of all the pairedIds found for provided ids and PairedIdType
    • insertAll

      public void insertAll(Collection<PairedId> pairedIds)