Class SimpleCorrelationIdCache

java.lang.Object
com.broadleafcommerce.dataimport.processor.SimpleCorrelationIdCache
All Implemented Interfaces:
CorrelationIdMappingCache

public class SimpleCorrelationIdCache extends Object implements CorrelationIdMappingCache
Author:
Phillip Verheyden (phillipuniverse)
  • 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 interface CorrelationIdMappingCache
      Parameters:
      importId - import that this appears in
      correlationId - 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 to CorrelationIdMappingCache.get(String, Collection) but queries the cache in bulk
      Specified by:
      get in interface CorrelationIdMappingCache
      Parameters:
      importId - the import to validate correlation ids against
      correlationIds - 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 interface CorrelationIdMappingCache
      Parameters:
      importId - the relevant import for the mapping
      mapping - the mapping of the import id to the correlationId
    • removeAll

      public void removeAll(String importId)
      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 interface CorrelationIdMappingCache
      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 interface CorrelationIdMappingCache
      Parameters:
      importId - the import to obtain correlation id mappings for
      Returns:
      all of the mappings found for the given import