Interface SerialNumberGenerator
- All Known Implementing Classes:
DefaultCachingSerialNumberGenerator
public interface SerialNumberGenerator
Tenant specific generator for serial numbers. This generator provides logic for
NumberSeriesManager.-
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.voidcreateSeries(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.Returns a snapshot of a specified number series.getUniqueNumber(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.
-
Method Details
-
getAllInfo
Collection<NumberSeries> getAllInfo()Returns snapshot of all number series of this tenant. -
getUniqueNumber
Generates 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!- Parameters:
key- the series key- Throws:
IllegalArgumentException- if no series exists with this key
-
getInfo
Returns a snapshot of a specified number series.- Parameters:
key- the series key.- Throws:
IllegalArgumentException- if no series exists with this key
-
createSeries
Deprecated, for removal: This API element is subject to removal in a future version.since 5.0 - please usecreateSeries(String, int, long, String)Creates a new number series with the specified key, type and start value.- Parameters:
key- the series keytype- the type; use one ofNumberSeries.TYPE_ALPHANUMERICandNumberSeries.TYPE_NUMERICstartValue- the start value - must be positive long- Throws:
IllegalArgumentException- if a series already exists with this key
-
createSeries
Creates a new number series with the specified key, type and start value.- 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- Throws:
IllegalArgumentException- if a series already exists with this key
-
removeSeries
Removes a existing number series.- Parameters:
key- the series key- Throws:
IllegalArgumentException- if no series exists with this key
-
resetSeries
Resets 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'!- Parameters:
key- the series keytype- the series typestartValue- the start value- Throws:
IllegalArgumentException- if no series exists with this key
-
clearAll
void clearAll()Completely clear all (cached) ranges. This is only called after the 'numberseries' table has been dropped.
-
createSeries(String, int, long, String)