Interface SerialNumberGenerator

    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void clearAll()
      Completely clear all (cached) ranges.
      void createSeries​(java.lang.String key, int type, long startValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      void createSeries​(java.lang.String key, int type, long startValue, java.lang.String template)
      Creates a new number series with the specified key, type and start value.
      java.util.Collection<NumberSeries> getAllInfo()
      Returns snapshot of all number series of this tenant.
      NumberSeries getInfo​(java.lang.String key)
      Returns a snapshot of a specified number series.
      NumberSeries getUniqueNumber​(java.lang.String key)
      Generates a new unique number for the given series.
      void removeSeries​(java.lang.String key)
      Removes a existing number series.
      void resetSeries​(java.lang.String key, int type, long startValue)
      Resets type and start value of a existing series.
    • Method Detail

      • getAllInfo

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

        NumberSeries getUniqueNumber​(java.lang.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:
        java.lang.IllegalArgumentException - if no series exists with this key
      • getInfo

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

        @Deprecated(since="5.0",
                    forRemoval=true)
        void createSeries​(java.lang.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:
        java.lang.IllegalArgumentException - if a series already exists with this key
      • createSeries

        void createSeries​(java.lang.String key,
                          int type,
                          long startValue,
                          java.lang.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:
        java.lang.IllegalArgumentException - if a series already exists with this key
      • removeSeries

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

        void resetSeries​(java.lang.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:
        java.lang.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.