org.jbpm.casemgmt.api.generator

## Interface CaseIdGenerator

- All Known Implementing Classes:
    InMemoryCaseIdGenerator, NoneCaseIdGenerator, TableCaseIdGenerator

      public interface CaseIdGenerator

  Responsible for generating and keeping track of generated case identifiers. Identifiers are always prefixed (and by that registered) by constant - default is CASE.
  In addition, it's up to generator to to return fixed size generated string to keep the IDs in similar format. Recommended is to have it set to at least 10 items as part of the generated value:
  Generators should return following: `0000000001`, `0000000010`, `0000000100` instead of `1`, `10`, `100`

- - ### Method Summary

    All Methods Instance Methods Abstract 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.

- - ### Method Detail

    - #### getIdentifier

          String getIdentifier()

      Identifier of the generator so it can be found and registered at runtime
      Returns:
        unique identifier

    - #### register

          void register(String prefix)

      Should be called only one time per given prefix. Subsequent calls with same prefix do not affect the generator state.
      Parameters:
        `prefix` - unique prefix that should be used for generating case identifiers

    - #### unregister

          void unregister(String prefix)

      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.
      Parameters:
        `prefix` - unique prefix that should be used for generating case identifiers

    - #### generate

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

      Generates next value for given prefix. Returned value should include the prefix as part of the returned value.
      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

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