Interface SerialNumberGenerator

All Known Implementing Classes:
DefaultCachingSerialNumberGenerator

public interface SerialNumberGenerator
Tenant specific generator for serial numbers. This generator provides logic for NumberSeriesManager.
  • Method Details

    • getAllInfo

      Collection<NumberSeries> getAllInfo()
      Returns snapshot of all number series of this tenant.
    • getUniqueNumber

      NumberSeries getUniqueNumber(String key)
      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

      NumberSeries getInfo(String key)
      Returns a snapshot of a specified number series.
      Parameters:
      key - the series key.
      Throws:
      IllegalArgumentException - if no series exists with this key
    • createSeries

      @Deprecated(since="5.0", forRemoval=true) void createSeries(String key, int type, long startValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new number series with the specified key, type and start value.
      Parameters:
      key - the series key
      type - the type; use one of NumberSeries.TYPE_ALPHANUMERIC and NumberSeries.TYPE_NUMERIC
      startValue - the start value - must be positive long
      Throws:
      IllegalArgumentException - if a series already exists with this key
    • createSeries

      void createSeries(String key, int type, long startValue, String template)
      Creates a new number series with the specified key, type and start value.
      Parameters:
      key - the series key
      type - the type; use one of NumberSeries.TYPE_ALPHANUMERIC and NumberSeries.TYPE_NUMERIC
      startValue - the start value - must be positive long
      template - the template to be applied on generated value
      Throws:
      IllegalArgumentException - if a series already exists with this key
    • removeSeries

      void removeSeries(String key)
      Removes a existing number series.
      Parameters:
      key - the series key
      Throws:
      IllegalArgumentException - if no series exists with this key
    • resetSeries

      void resetSeries(String key, int type, long startValue)
      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 key
      type - the series type
      startValue - 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.