Package com.atlassian.bamboo.oid
Interface IdGeneratorDao
- All Known Implementing Classes:
IdGeneratorDaoImpl
@NotThreadSafe
public interface IdGeneratorDao
Handles generation of unique IDs for various entities.
Thread safe for different entity types. It's unsafe to call methods with the same entity type from different threads
(even if different methods are being called).
-
Method Summary
Modifier and TypeMethodDescription@NotNull List<IdGenerator>
findAll()
Get all generators id.@NotNull com.google.common.collect.Range<Long>
nextIdRange
(@NotNull BambooEntityType entityType) Reserve new range of ids for given entityvoid
resetId
(@NotNull BambooEntityOid lastOid) Reset forward next id value in generator for given entity.void
saveNextId
(@NotNull String name, long nextId) Saves next id value for given name.
-
Method Details
-
nextIdRange
@NotNull @NotNull com.google.common.collect.Range<Long> nextIdRange(@NotNull @NotNull BambooEntityType entityType) Reserve new range of ids for given entity- Parameters:
entityType
- entity type- Returns:
- id range
-
resetId
Reset forward next id value in generator for given entity. Should be called after some external changes that would generate entities without using generator. New value will be set only if it's bigger than old one.- Parameters:
lastOid
- current biggest oid; next id generator for it's type will be updated
-
findAll
Get all generators id. Used for data export. Avoid using for other reasons. -
saveNextId
Saves next id value for given name. Used during data import. Avoid using for other reasons.
-