Class SimpleCorrelationIdCache
java.lang.Object
com.broadleafcommerce.dataimport.processor.SimpleCorrelationIdCache
- All Implemented Interfaces:
CorrelationIdMappingCache
- Author:
- Phillip Verheyden (phillipuniverse)
-
Constructor Summary
ConstructorDescriptionSimpleCorrelationIdCache
(ConcurrentMap<String, ConcurrentMap<String, com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping>> seed) -
Method Summary
Modifier and TypeMethodDescriptioncom.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping
Obtain a mapping for the given correlation id and import id from the cacheCollection<com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping>
get
(String importId, Collection<String> correlationIds) Similar toCorrelationIdMappingCache.get(String, Collection)
but queries the cache in bulkCollection<com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping>
All of the correlationIds that this cache knows about for the given importvoid
put
(String importId, com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping mapping) Add a new mapping from a correlation id in the file to a resource tier identifiervoid
Once an import has finished processing there is no more need to keep the cache around.
-
Constructor Details
-
SimpleCorrelationIdCache
public SimpleCorrelationIdCache() -
SimpleCorrelationIdCache
public SimpleCorrelationIdCache(ConcurrentMap<String, ConcurrentMap<String, com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping>> seed)
-
-
Method Details
-
get
@Nullable public com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping get(String importId, String correlationId) Description copied from interface:CorrelationIdMappingCache
Obtain a mapping for the given correlation id and import id from the cache- Specified by:
get
in interfaceCorrelationIdMappingCache
- Parameters:
importId
- import that this appears incorrelationId
- the correlation id that should be validated- Returns:
- the mapping that is in the cache or an empty optional if no value is supplied
-
get
public Collection<com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping> get(String importId, Collection<String> correlationIds) Description copied from interface:CorrelationIdMappingCache
Similar toCorrelationIdMappingCache.get(String, Collection)
but queries the cache in bulk- Specified by:
get
in interfaceCorrelationIdMappingCache
- Parameters:
importId
- the import to validate correlation ids againstcorrelationIds
- the correlattion ids to obtain- Returns:
- the mappings found for the given correlationIds. While it is possible that this could
be less than the given
correlationIds
(or just empty if none were found) it should never exceed the size of the given ids to validate
-
put
public void put(String importId, com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping mapping) Description copied from interface:CorrelationIdMappingCache
Add a new mapping from a correlation id in the file to a resource tier identifier- Specified by:
put
in interfaceCorrelationIdMappingCache
- Parameters:
importId
- the relevant import for the mappingmapping
- the mapping of the import id to the correlationId
-
removeAll
Description copied from interface:CorrelationIdMappingCache
Once an import has finished processing there is no more need to keep the cache around. This removes all of the entries from the cache- Specified by:
removeAll
in interfaceCorrelationIdMappingCache
- Parameters:
importId
- import to remove mappings for
-
getAll
public Collection<com.broadleafcommerce.common.dataimport.messaging.CorrelationIdMapping> getAll(String importId) Description copied from interface:CorrelationIdMappingCache
All of the correlationIds that this cache knows about for the given import- Specified by:
getAll
in interfaceCorrelationIdMappingCache
- Parameters:
importId
- the import to obtain correlation id mappings for- Returns:
- all of the mappings found for the given import
-