org.jbpm.casemgmt.impl.generator

## Class InMemoryCaseIdGenerator

- java.lang.Object
- - org.jbpm.casemgmt.impl.generator.InMemoryCaseIdGenerator

- All Implemented Interfaces:
    CaseIdGenerator

      public class InMemoryCaseIdGenerator
      extends Object
      implements CaseIdGenerator

  Simple in memory (usually for test or demo purpose) case id generator. It does not provide any actual storage of the generated values.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `InMemoryCaseIdGenerator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `generate(String prefix, Map<String,Object> optionalParameters)` Generates next value for given prefix.
    `String` | `getIdentifier()` Identifier of the generator so it can be found and registered at runtime
    `void` | `register(String prefix)` Should be called only one time per given prefix.
    `void` | `unregister(String prefix)` Unregisters given prefix from the generator.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InMemoryCaseIdGenerator

          public InMemoryCaseIdGenerator()

  - ### Method Detail

    - #### register

          public void register(String prefix)

      Description copied from interface: `CaseIdGenerator`
      Should be called only one time per given prefix. Subsequent calls with same prefix do not affect the generator state.
      Specified by:
        `register` in interface `CaseIdGenerator`
      Parameters:
        `prefix` - unique prefix that should be used for generating case identifiers

    - #### unregister

          public void unregister(String prefix)

      Description copied from interface: `CaseIdGenerator`
      Unregisters given prefix from the generator. It's up to generator implementation to either remove the prefix and its latest value permanently or resume it in case of further registration of the same prefix.
      Specified by:
        `unregister` in interface `CaseIdGenerator`
      Parameters:
        `prefix` - unique prefix that should be used for generating case identifiers

    - #### generate

          public String generate(String prefix,
                                 Map<String,Object> optionalParameters)
                          throws CasePrefixNotFoundException

      Description copied from interface: `CaseIdGenerator`
      Generates next value for given prefix. Returned value should include the prefix as part of the returned value.
      Specified by:
        `generate` in interface `CaseIdGenerator`
      Parameters:
        `prefix` - unique prefix that should be used for generating case identifiers
        `optionalParameters` - map of optionalParameters that might be helpful for implementation
      Returns:
        complete case id in format (PREFIX-GENERATED_VALUE)
      Throws:
        `CasePrefixNotFoundException` - in case given prefix was not registered

    - #### getIdentifier

          public String getIdentifier()

      Description copied from interface: `CaseIdGenerator`
      Identifier of the generator so it can be found and registered at runtime
      Specified by:
        `getIdentifier` in interface `CaseIdGenerator`
      Returns:
        unique identifier

Copyright © 2001–2017 JBoss by Red Hat. All rights reserved.