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 Summary
ConstructorsConstructorDescriptionPairedIdService
(List<IPairedType> pairedTypes, PairedIdRepository repository) -
Method Summary
Modifier and TypeMethodDescriptiongetAllPairedIds
(Collection<String> ids, IPairedType pairedType) Returns a list of PairedId found in the database for the provided ids and typegetAllPairedIds
(Collection<String> ids, Class<?> typeClass) Returns a list of PairedId found in the database for the provided ids and typegetAllPairedIds
(Collection<String> ids, String type) Returns a list of PairedId found in the database for the provided ids and typegetPairedIds
(String id) Returns the PairedId entries found in the database for the provided IDgetSinglePairedId
(String id, IPairedType pairedType) Returns the unique PairedId entry found in the database for the provided ID and type, if found.void
insertAll
(Collection<PairedId> pairedIds) 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
-
Constructor Details
-
PairedIdService
-
-
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 interfaceRunnable
- Throws:
IllegalStateException
- if any duplicate IPairedType was registered
-
getSinglePairedId
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 productpairedType
- The type of pairing- Returns:
- The product id, paired id and paired type, if found.
-
getPairedIds
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
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 fromtype
- the type of pairing to look for- Returns:
- list of all the pairedIds found for provided ids and PairedIdType
-
getAllPairedIds
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 fromtypeClass
- the type of pairing to look for- Returns:
- list of all the pairedIds found for provided ids and PairedIdType
-
getAllPairedIds
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 frompairedType
- the type of pairing to look for- Returns:
- list of all the pairedIds found for provided ids and PairedIdType
-
insertAll
-