Class DefaultCachingSerialNumberGenerator
java.lang.Object
de.hybris.platform.persistence.numberseries.DefaultCachingSerialNumberGenerator
- All Implemented Interfaces:
SerialNumberGenerator
Default implementation of
SerialNumberGenerator which caches number ranges for each key.
Cache size may be specified in project.properties like this:
# set cache size for single series 'myseries' to 50
numberseries.cache.size.myseries=50
# set default cache size to 999
numberseries.cache.size=999
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearAll()Completely clear all (cached) ranges.voidcreateSeries(String key, int type, long startValue) Deprecated, for removal: This API element is subject to removal in a future version.since agesvoidcreateSeries(String key, int type, long startValue, String template) Creates a new number series with the specified key, type and start value.Returns snapshot of all number series of this tenant.protected intgetCacheSize(String key) getDao()Returns a snapshot of a specified number series.protected TenantgetUniqueNumber(String key) Generates a new unique number for the given series.voidremoveSeries(String key) Removes a existing number series.voidresetSeries(String key, int type, long startValue) Resets type and start value of a existing series.
-
Constructor Details
-
DefaultCachingSerialNumberGenerator
-
-
Method Details
-
createSeries
Description copied from interface:SerialNumberGeneratorCreates a new number series with the specified key, type and start value.- Specified by:
createSeriesin interfaceSerialNumberGenerator- Parameters:
key- the series keytype- the type; use one ofNumberSeries.TYPE_ALPHANUMERICandNumberSeries.TYPE_NUMERICstartValue- the start value - must be positive longtemplate- the template to be applied on generated value
-
createSeries
@Deprecated(since="ages", forRemoval=true) public void createSeries(String key, int type, long startValue) Deprecated, for removal: This API element is subject to removal in a future version.since agesDescription copied from interface:SerialNumberGeneratorCreates a new number series with the specified key, type and start value.- Specified by:
createSeriesin interfaceSerialNumberGenerator- Parameters:
key- the series keytype- the type; use one ofNumberSeries.TYPE_ALPHANUMERICandNumberSeries.TYPE_NUMERICstartValue- the start value - must be positive long
-
getUniqueNumber
Description copied from interface:SerialNumberGeneratorGenerates a new unique number for the given series. The returned number is consumed and will never be returned again. Please note that transactions have no effect upon number generation!- Specified by:
getUniqueNumberin interfaceSerialNumberGenerator- Parameters:
key- the series key
-
getInfo
Description copied from interface:SerialNumberGeneratorReturns a snapshot of a specified number series.- Specified by:
getInfoin interfaceSerialNumberGenerator- Parameters:
key- the series key.
-
getAllInfo
Description copied from interface:SerialNumberGeneratorReturns snapshot of all number series of this tenant.- Specified by:
getAllInfoin interfaceSerialNumberGenerator
-
removeSeries
Description copied from interface:SerialNumberGeneratorRemoves a existing number series.- Specified by:
removeSeriesin interfaceSerialNumberGenerator- Parameters:
key- the series key
-
resetSeries
Description copied from interface:SerialNumberGeneratorResets type and start value of a existing series. Please use with care since duplicate numbers are likely to be generated if start value is moved 'back'!- Specified by:
resetSeriesin interfaceSerialNumberGenerator- Parameters:
key- the series keytype- the series typestartValue- the start value
-
clearAll
public void clearAll()Description copied from interface:SerialNumberGeneratorCompletely clear all (cached) ranges. This is only called after the 'numberseries' table has been dropped.- Specified by:
clearAllin interfaceSerialNumberGenerator
-
getTenant
-
getDao
-
getCacheSize
-